helper

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MethodGet            HttpMethod  = "GET"
	MethodPost           HttpMethod  = "POST"
	ContentJSON          ContentType = "application/json"
	ContentFormUrlEncode ContentType = "application/x-www-form-urlencoded"
)

Variables

This section is empty.

Functions

func Ase256Decode

func Ase256Decode(cipherText []byte, encKey string, iv []byte) (error, []byte)

func Ase256Encode

func Ase256Encode(plaintext string, key string, iv string, blockSize int) (error, string)

func DecryptData

func DecryptData(data string, encryptKey string) (error, []byte)

func GetFunctionName

func GetFunctionName(i interface{}) string

func PKCS5Padding

func PKCS5Padding(ciphertext []byte, blockSize int, after int) []byte

func PKCS5Trimming

func PKCS5Trimming(encrypt []byte) []byte

func SliceContains

func SliceContains[T comparable](array []T, target T) bool

Types

type ApiHelper

type ApiHelper struct {
	Token          string
	Type           string
	Language       string
	BaseUrl        string
	QueryParam     string
	Path           string
	Body           []byte
	ContentType    ContentType
	Method         HttpMethod
	File           string
	FileFieldName  string
	ContentTypeStr string

	BodyBuffer *bytes.Buffer
	// contains filtered or unexported fields
}

func NewApiHelper

func NewApiHelper(path, token, baseUrl, apiType, language string) *ApiHelper

func (*ApiHelper) Get

func (h *ApiHelper) Get() ([]byte, error)

func (*ApiHelper) Post

func (h *ApiHelper) Post() ([]byte, error)

func (*ApiHelper) Send

func (h *ApiHelper) Send() ([]byte, error)

func (*ApiHelper) SetBody

func (h *ApiHelper) SetBody(body []byte) *ApiHelper

func (*ApiHelper) SetContentType

func (h *ApiHelper) SetContentType(contentType ContentType) *ApiHelper

func (*ApiHelper) SetQuery

func (h *ApiHelper) SetQuery(values map[string]string) *ApiHelper

func (*ApiHelper) SetUploadFile added in v0.0.3

func (h *ApiHelper) SetUploadFile(filePath string) *ApiHelper

func (*ApiHelper) String

func (h *ApiHelper) String() string

type ContentType

type ContentType string

type HttpMethod

type HttpMethod string

Jump to

Keyboard shortcuts

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