qiniu

package
v0.0.25 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchFilesRequest added in v0.0.18

type BatchFilesRequest struct {
	// 操作类型,move/copy/restoreAr
	Type BatchFilesType
	// 需要移动/复制/解冻的源文件key
	SrcKeys []string
	// 移动/复制到的目标文件key
	DstKeys []string
	// 源文件所在桶
	SrcBucket *string
	// 目标文件所在桶
	DestBucket *string
	// 解冻文件天数
	AfterDay int
	// 是否强制覆盖
	Force bool
}

type BatchFilesType added in v0.0.18

type BatchFilesType string
const (
	BatchFilesTypeMove      BatchFilesType = "move"
	BatchFilesTypeCopy      BatchFilesType = "copy"
	BatchFilesTypeRestoreAr                = "restoreAr"
)

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a struct that represents a Qiniu client. It contains a Mac object for authentication, a CdnManager for CDN operations, and a BucketManager for bucket operations.

func NewClient

func NewClient(accessKey, secretKey string) *Client

NewClient is a function that creates a new Qiniu client. It takes an access key and a secret key as parameters, and returns a pointer to a Client object. The function creates a new Mac object with the access key and secret key, a new CdnManager with the Mac object, and a new BucketManager with the Mac object and a Config object that enables HTTPS. The function then creates a new Client object with the Mac object, the CdnManager, and the BucketManager, and returns a pointer to it.

func (*Client) BatchFiles added in v0.0.18

func (c *Client) BatchFiles(req *BatchFilesRequest) error

BatchFiles 批量移动/复制文件

func (*Client) Delete

func (c *Client) Delete(bucket, key string) error

Delete is a method of Client that deletes a specified file. It takes a string representing the bucket where the file is located and a string representing the key of the file as parameters. The method calls the Delete method of the BucketManager object in the Client, passing the bucket and the key. The method returns an error if the Delete method of the BucketManager returns an error.

func (*Client) GetTimestampSignUrl added in v0.0.14

func (c *Client) GetTimestampSignUrl(urlPath url.URL, secretKey string, expiration time.Duration) string

func (*Client) GetUploadToken

func (c *Client) GetUploadToken(putPolicy storage.PutPolicy) string

GetUploadToken is a method of Client that gets an upload token. It takes a PutPolicy object as a parameter. The method calls the UploadToken method of the PutPolicy object, passing the Mac object in the Client. The method returns the upload token as a string.

func (*Client) ListFiles added in v0.0.10

func (c *Client) ListFiles(bucket, prefix, delimiter, marker string, limit int) ([]storage.ListItem, []string, string, bool, error)

ListFiles 列举文件,每次最大1000

func (*Client) MakePublicUrl added in v0.0.10

func (c *Client) MakePublicUrl(domain, key string) string

MakePublicUrl 公开空间访问链接

func (*Client) PutFile

func (c *Client) PutFile(ctx context.Context, req *PutFileRequest) (*PutRet, error)

PutFile 上传文件

func (*Client) RefreshUrls

func (c *Client) RefreshUrls(urlsToRefresh []string) error

RefreshUrls is a method of Client that refreshes the cache of the specified URLs. It takes a slice of strings representing the URLs to refresh as a parameter. The method calls the RefreshUrls method of the CdnManager object in the Client, passing the URLs to refresh. The method returns an error if the RefreshUrls method of the CdnManager returns an error.

func (*Client) VerifyCallback added in v0.0.21

func (c *Client) VerifyCallback(req *http.Request) (bool, error)

VerifyCallback 验证上传回调请求是否来自七牛

type PutFileRequest added in v0.0.18

type PutFileRequest struct {
	// 上传桶
	Bucket string
	// 上传文件key
	Key string
	// 上传文件内容,Data和LocalFile必须有一个不为nil
	Data []byte
	// 本地文件路径
	LocalFile *string
	// 文件上传的上传策略
	PutPolicy storage.PutPolicy
	// 文件上传,资源管理等配置
	Config *storage.Config
	// 表示分片上传
	Extra *storage.PutExtra
}

type PutRet added in v0.0.18

type PutRet struct {
	Key          string `json:"key"`
	Hash         string `json:"hash"`
	Fsize        int64  `json:"fsize"`
	PersistentID string `json:"persistentId"`
}

type SmsClient

type SmsClient struct {
	// contains filtered or unexported fields
}

func NewSmsClient

func NewSmsClient(accessKey, secretKey string) *SmsClient

func (SmsClient) SendMessage

func (c SmsClient) SendMessage(signatureId, templateId string, mobiles []string, parameters map[string]interface{}) (*string, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL