删除图库图片

最近更新时间:2023-12-01 17:57:58

我的收藏

简介

本文档提供关于删除图库图片的相关 API 概览以及 SDK 示例代码。
API
操作描述
该接口用于删除图库图片。

删除图库图片

该接口用于删除图库图片。

方法原型

func (s *CIService) DelImage(ctx context.Context, name string, opt *DelImageOptions) (*Response, error)

请求示例

// 将 examplebucket-1250000000 和 COS_REGION 修改为真实的信息
// CI 任务需要提供 CIURL
bu, _ := url.Parse("https://examplebucket-1250000000.cos.COS_REGION.myqcloud.com")
cu, _ := url.Parse("https://examplebucket-1250000000.ci.COS_REGION.myqcloud.com")
b := &cos.BaseURL{BucketURL: bu, CIURL: cu}
c := cos.NewClient(b, &http.Client{
Transport: &cos.AuthorizationTransport{
SecretID: os.Getenv("SECRETID"),
SecretKey: os.Getenv("SECRETKEY"),
}
})
opt := &cos.DelImageOptions{
EntityId: "car",
}
_, err := c.CI.DelImage(context.Background(), "pic/car.jpg", opt)
log_status(err)

参数说明

type DelImageOptions struct {
XMLName xml.Name `xml:"Request"`
EntityId string `xml:"EntityId,omitempty"`
}
参数名称
参数描述
类型
是否必填
EntityId
物品 ID
string