common

package
v1.0.657 Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: Apache-2.0 Imports: 13 Imported by: 2,702

Documentation

Index

Constants

View Source
const (
	POST = "POST"
	GET  = "GET"

	HTTP  = "http"
	HTTPS = "https"

	RootDomain = "tencentcloudapi.com"
	Path       = "/"
)

Variables

This section is empty.

Functions

func CompleteCommonParams

func CompleteCommonParams(request Request, region string, requestClient string)

func ConstructParams

func ConstructParams(req Request) (err error)

func GetServiceDomain

func GetServiceDomain(service string) (domain string)

Deprecated, use request.GetServiceDomain instead

func GetUrlQueriesEncoded

func GetUrlQueriesEncoded(params map[string]string) string

func ParseErrorFromHTTPResponse added in v1.0.211

func ParseErrorFromHTTPResponse(body []byte) (err error)

func ParseFromHttpResponse

func ParseFromHttpResponse(hr *http.Response, response Response) (err error)

Types

type BaseRequest

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

func (*BaseRequest) GetAction

func (r *BaseRequest) GetAction() string

func (*BaseRequest) GetBody added in v1.0.309

func (r *BaseRequest) GetBody() []byte

func (*BaseRequest) GetBodyReader

func (r *BaseRequest) GetBodyReader() io.Reader

func (*BaseRequest) GetContentType added in v1.0.309

func (r *BaseRequest) GetContentType() string

func (*BaseRequest) GetContext added in v1.0.324

func (r *BaseRequest) GetContext() context.Context

func (*BaseRequest) GetDomain

func (r *BaseRequest) GetDomain() string

func (*BaseRequest) GetHeader added in v1.0.379

func (r *BaseRequest) GetHeader() map[string]string

func (*BaseRequest) GetHttpMethod

func (r *BaseRequest) GetHttpMethod() string

func (*BaseRequest) GetParams

func (r *BaseRequest) GetParams() map[string]string

func (*BaseRequest) GetPath

func (r *BaseRequest) GetPath() string

func (*BaseRequest) GetRootDomain

func (r *BaseRequest) GetRootDomain() string

func (*BaseRequest) GetScheme

func (r *BaseRequest) GetScheme() string

func (*BaseRequest) GetService

func (r *BaseRequest) GetService() string

func (*BaseRequest) GetServiceDomain

func (r *BaseRequest) GetServiceDomain(service string) (domain string)

func (*BaseRequest) GetSkipSign added in v1.0.479

func (r *BaseRequest) GetSkipSign() bool

func (*BaseRequest) GetUrl

func (r *BaseRequest) GetUrl() string

func (*BaseRequest) GetVersion

func (r *BaseRequest) GetVersion() string

func (*BaseRequest) Init

func (r *BaseRequest) Init() *BaseRequest

func (*BaseRequest) SetBody added in v1.0.309

func (r *BaseRequest) SetBody(body []byte)

func (*BaseRequest) SetContentType added in v1.0.309

func (r *BaseRequest) SetContentType(contentType string)

func (*BaseRequest) SetContext added in v1.0.324

func (r *BaseRequest) SetContext(ctx context.Context)

func (*BaseRequest) SetDomain

func (r *BaseRequest) SetDomain(domain string)

func (*BaseRequest) SetHeader added in v1.0.379

func (r *BaseRequest) SetHeader(header map[string]string)

func (*BaseRequest) SetHttpMethod

func (r *BaseRequest) SetHttpMethod(method string)

func (*BaseRequest) SetPath added in v1.0.315

func (r *BaseRequest) SetPath(path string)

func (*BaseRequest) SetRootDomain

func (r *BaseRequest) SetRootDomain(rootDomain string)

func (*BaseRequest) SetScheme

func (r *BaseRequest) SetScheme(scheme string)

func (*BaseRequest) SetSkipSign added in v1.0.479

func (r *BaseRequest) SetSkipSign(skip bool)

func (*BaseRequest) WithApiInfo

func (r *BaseRequest) WithApiInfo(service, version, action string) *BaseRequest

func (*BaseRequest) WithContentType added in v1.0.309

func (r *BaseRequest) WithContentType(contentType string) *BaseRequest

type BaseResponse

type BaseResponse struct {
}

func (*BaseResponse) ParseErrorFromHTTPResponse

func (r *BaseResponse) ParseErrorFromHTTPResponse(body []byte) (err error)

type CommonRequest added in v1.0.192

type CommonRequest struct {
	*BaseRequest
	// contains filtered or unexported fields
}

func NewCommonRequest added in v1.0.192

func NewCommonRequest(service, version, action string) (request *CommonRequest)

func (*CommonRequest) GetHeader added in v1.0.210

func (cr *CommonRequest) GetHeader() map[string]string

func (*CommonRequest) GetOctetStreamBody added in v1.0.210

func (cr *CommonRequest) GetOctetStreamBody() []byte

func (*CommonRequest) IsOctetStream added in v1.0.210

func (cr *CommonRequest) IsOctetStream() bool

func (*CommonRequest) MarshalJSON added in v1.0.192

func (cr *CommonRequest) MarshalJSON() ([]byte, error)

func (*CommonRequest) SetActionParameters added in v1.0.192

func (cr *CommonRequest) SetActionParameters(data interface{}) error

SetActionParameters set common request's actionParameters to your data. note: your data Must be a json-formatted string or byte array or map[string]interface{} note: you could not call SetActionParameters and SetOctetStreamParameters at once

func (*CommonRequest) SetHeader added in v1.0.210

func (cr *CommonRequest) SetHeader(header map[string]string)

func (*CommonRequest) SetOctetStreamParameters added in v1.0.210

func (cr *CommonRequest) SetOctetStreamParameters(header map[string]string, body []byte)

SetOctetStreamParameters set request body to your data, and set head Content-Type to application/octet-stream note: you could not call SetActionParameters and SetOctetStreamParameters on the same request

type CommonResponse added in v1.0.192

type CommonResponse struct {
	*BaseResponse
	// contains filtered or unexported fields
}

func NewCommonResponse added in v1.0.192

func NewCommonResponse() (response *CommonResponse)

func (*CommonResponse) GetBody added in v1.0.192

func (r *CommonResponse) GetBody() []byte

func (*CommonResponse) UnmarshalJSON added in v1.0.192

func (r *CommonResponse) UnmarshalJSON(data []byte) error

type DeprecatedAPIErrorResponse

type DeprecatedAPIErrorResponse struct {
	Code     int    `json:"code"`
	Message  string `json:"message"`
	CodeDesc string `json:"codeDesc"`
}

type ErrorResponse

type ErrorResponse struct {
	Response struct {
		Error struct {
			Code    string `json:"Code"`
			Message string `json:"Message"`
		} `json:"Error,omitempty"`
		RequestId string `json:"RequestId"`
	} `json:"Response"`
}

type Request

type Request interface {
	GetAction() string
	GetBodyReader() io.Reader
	GetScheme() string
	GetRootDomain() string
	GetServiceDomain(string) string
	GetDomain() string
	GetHttpMethod() string
	GetParams() map[string]string
	GetBody() []byte
	GetPath() string
	GetService() string
	GetUrl() string
	GetVersion() string
	GetContentType() string
	GetContext() context.Context
	GetHeader() map[string]string
	GetSkipSign() bool
	SetScheme(string)
	SetRootDomain(string)
	SetDomain(string)
	SetHttpMethod(string)
	SetPath(string)
	SetContentType(string)
	SetBody([]byte)
	SetContext(context.Context)
	SetHeader(header map[string]string)
	SetSkipSign(skip bool)
}

type Response

type Response interface {
	ParseErrorFromHTTPResponse(body []byte) error
}

Jump to

Keyboard shortcuts

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