Documentation ¶
Index ¶
- Constants
- func GenerateHMACSHA256Digest(appID, secretKey string, timestamp int64) string
- type Client
- type ClientRequestOption
- func WithAuthReqired(auth bool) ClientRequestOption
- func WithBody(body io.Reader) ClientRequestOption
- func WithHeaders(headers map[string]string) ClientRequestOption
- func WithMethod(method string) ClientRequestOption
- func WithQueryParams(params map[string]string) ClientRequestOption
- func WithURI(uri string) ClientRequestOption
- type ClientRequestOptions
- type FileServiceClient
- func (c *FileServiceClient) DeleteFile(filename string) (*httputil.Response, error)
- func (c *FileServiceClient) GetFile(filename string) (*httputil.Response, error)
- func (c *FileServiceClient) GetFiles(prefix string) (*httputil.Response, error)
- func (c *FileServiceClient) InfoFile(filename string) (*httputil.Response, error)
- func (c *FileServiceClient) PostFile(filename string, reader io.Reader) (*httputil.Response, error)
- type OpenApiArgs
- type OpenApiMiddleware
- type SdkConfig
Constants ¶
View Source
const ( URI_ROOT = `/` URI_LIST = `/list` URI_INFO = `/info` )
View Source
const ( OpenApiAccessKey = "accessKey" OpenApiTimestamp = "timestamp" OpenApiSign = "sign" )
Variables ¶
This section is empty.
Functions ¶
func GenerateHMACSHA256Digest ¶
GenerateHMACSHA256Digest 用于生成摘要
Types ¶
type Client ¶
type Client struct { // 客户端ID AccessKey string `json:"accessKey"` // 客户端密钥 Secret string `json:"secret"` // 接入点 Endpoint string `json:"endpoint"` // 请求超时时间 单位秒 RequestTimeout int `json:"requestTimeout"` // contains filtered or unexported fields }
type ClientRequestOption ¶
type ClientRequestOption func(*ClientRequestOptions)
func WithAuthReqired ¶
func WithAuthReqired(auth bool) ClientRequestOption
func WithBody ¶
func WithBody(body io.Reader) ClientRequestOption
func WithHeaders ¶
func WithHeaders(headers map[string]string) ClientRequestOption
func WithMethod ¶
func WithMethod(method string) ClientRequestOption
func WithQueryParams ¶
func WithQueryParams(params map[string]string) ClientRequestOption
func WithURI ¶
func WithURI(uri string) ClientRequestOption
type ClientRequestOptions ¶
type ClientRequestOptions struct { // 请求方法 Method string `json:"method"` // 请求 API URI URI string `json:"uri"` // 是否需要鉴权 AuthReqired bool `json:"authReqired"` // 请求参数 QueryParams map[string]string `json:"queryParams"` // 请求头 Headers map[string]string `json:"headers"` // 请求体 Body io.Reader `json:"body"` }
func NewClientRequestOptions ¶
func NewClientRequestOptions(options ...ClientRequestOption) *ClientRequestOptions
type FileServiceClient ¶
type FileServiceClient struct {
Client
}
func NewFileServiceClient ¶
func NewFileServiceClient(accessKey, secret string, endpoint string, requestTimeout int) (*FileServiceClient, error)
func (*FileServiceClient) DeleteFile ¶
func (c *FileServiceClient) DeleteFile(filename string) (*httputil.Response, error)
DeleteFile 删除文件
func (*FileServiceClient) GetFile ¶
func (c *FileServiceClient) GetFile(filename string) (*httputil.Response, error)
GetFile 获取文件
func (*FileServiceClient) GetFiles ¶
func (c *FileServiceClient) GetFiles(prefix string) (*httputil.Response, error)
GetFiles 获取文件列表
type OpenApiArgs ¶
func GetOpenApiArgs ¶
func GetOpenApiArgs(c *gin.Context) (*OpenApiArgs, error)
type OpenApiMiddleware ¶
func NewOpenApiMiddleware ¶
func NewOpenApiMiddleware(apiKeys map[string]string, signTtl int) *OpenApiMiddleware
func (*OpenApiMiddleware) GetSecretByAccessKey ¶
func (mw *OpenApiMiddleware) GetSecretByAccessKey(accessKey string) (string, error)
func (*OpenApiMiddleware) OpenApiAuth ¶
func (mw *OpenApiMiddleware) OpenApiAuth(c *gin.Context)
Click to show internal directories.
Click to hide internal directories.