Documentation
¶
Index ¶
- func BuildFormBody(data map[string]string) io.Reader
- func CheckStatus(resp *http.Response) error
- func DecodeResponse(resp *http.Response) (io.ReadCloser, error)
- func ErrEncryptParams(err error) error
- func GenerateZaloSignKey(apiType string, params map[string]any) string
- func IsClientError(resp *http.Response) bool
- func IsServerError(resp *http.Response) bool
- func IsSuccess(resp *http.Response) bool
- func JoinURL(base, path string) string
- func MakeURL(sc session.Context, baseURL string, params map[string]any, ...) string
- func ReadBytes(resp *http.Response) ([]byte, error)
- func ReadJSON(resp *http.Response, target any) error
- func ReadString(resp *http.Response) (string, error)
- func Request(ctx context.Context, sc session.MutableContext, urlStr string, ...) (*http.Response, error)
- func ResolveURL(base, href string) string
- func SignZaloURL(baseURL string, apiType string, params map[string]any) string
- type BaseResponse
- type BuildOptions
- type EncryptParamResult
- type EncryptedPayload
- type FormData
- type Opt
- type Params
- type ParamsEncryptor
- type RequestOptions
- type Response
- type URLBuilder
- type ZaloResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckStatus ¶
func DecodeResponse ¶
func DecodeResponse(resp *http.Response) (io.ReadCloser, error)
func ErrEncryptParams ¶
ErrEncryptParams wraps encryption parameter errors
func IsClientError ¶
func IsServerError ¶
func Request ¶
func Request(ctx context.Context, sc session.MutableContext, urlStr string, opt *RequestOptions) (*http.Response, error)
func ResolveURL ¶
Types ¶
type BaseResponse ¶
func ParseBaseResponse ¶
func ParseBaseResponse(resp *http.Response) (*BaseResponse, error)
type BuildOptions ¶
type EncryptParamResult ¶
func GetEncryptParam ¶
func GetEncryptParam(sc session.Context, encryptParams bool, typeStr string) (*EncryptParamResult, error)
GetEncryptParam generates encrypted parameters for Zalo API requests
type EncryptedPayload ¶
type EncryptedPayload struct {
EncryptedData string `json:"encrypted_data"`
EncryptedParams Params `json:"encrypted_params"`
Enk string `json:"enk"`
}
func EncryptParam ¶
EncryptParam encrypts the provided data using session context
type Opt ¶
type Opt func(*BuildOptions)
func WithChunkSize ¶
func WithContentType ¶
func WithFileName ¶
type Params ¶
type ParamsEncryptor ¶
func NewParamsEncryptor ¶
func NewParamsEncryptor(apiType uint, imei string, firstLaunchTime int64) (ParamsEncryptor, error)
type RequestOptions ¶
type URLBuilder ¶
type URLBuilder struct {
// contains filtered or unexported fields
}
func NewURL ¶
func NewURL(baseURL string) *URLBuilder
func (*URLBuilder) Build ¶
func (u *URLBuilder) Build() string
func (*URLBuilder) Param ¶
func (u *URLBuilder) Param(key, value string) *URLBuilder
func (*URLBuilder) Params ¶
func (u *URLBuilder) Params(params map[string]string) *URLBuilder
type ZaloResponse ¶
func HandleZaloResponse ¶
func ParseZaloResponse ¶
func ParseZaloResponse[T any](resp *http.Response) (*ZaloResponse[T], error)
Click to show internal directories.
Click to hide internal directories.