request

package
v1.1.48 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2022 License: MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessTokenType

type AccessTokenType string
const (
	AccessTokenTypeNone   AccessTokenType = "none_access_token"
	AccessTokenTypeApp    AccessTokenType = "app_access_token"
	AccessTokenTypeTenant AccessTokenType = "tenant_access_token"
	AccessTokenTypeUser   AccessTokenType = "user_access_token"
)

type File

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

func NewFile

func NewFile() *File

func (*File) ContentStream

func (f *File) ContentStream() io.Reader

func (*File) IsStream

func (f *File) IsStream() bool

func (*File) MIMEHeader

func (f *File) MIMEHeader() textproto.MIMEHeader

func (*File) Name

func (f *File) Name() string

func (*File) Read

func (f *File) Read(p []byte) (n int, err error)

func (*File) SetContent

func (f *File) SetContent(content []byte) *File

func (*File) SetContentStream

func (f *File) SetContentStream(reader io.Reader) *File

func (*File) SetName

func (f *File) SetName(name string) *File

func (*File) SetType

func (f *File) SetType(typ string) *File

func (*File) Type

func (f *File) Type() string

type FormData

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

func NewFormData

func NewFormData() *FormData

func (*FormData) AddFile added in v1.1.12

func (fd *FormData) AddFile(field string, file *File) *FormData

func (*FormData) AddParam added in v1.1.12

func (fd *FormData) AddParam(field string, val interface{}) *FormData

func (*FormData) Files

func (fd *FormData) Files() []*File

func (*FormData) HasStream

func (fd *FormData) HasStream() bool

func (*FormData) Params

func (fd *FormData) Params() map[string]interface{}

type Info

type Info struct {
	Domain                 string
	HttpPath               string                       // request http path
	HttpMethod             string                       // request http method
	QueryParams            string                       // request query
	Input                  interface{}                  // request body
	AccessibleTokenTypeSet map[AccessTokenType]struct{} // request accessible token type
	AccessTokenType        AccessTokenType              // request access token type
	TenantKey              string
	UserAccessToken        string      // user access token
	IsNotDataField         bool        // response body is not data field
	Output                 interface{} // response body data
	Retryable              bool

	IsResponseStream     bool
	IsResponseStreamReal bool
	NeedHelpDeskAuth     bool
	// contains filtered or unexported fields
}

func GetInfoByCtx

func GetInfoByCtx(ctx context.Context) *Info

func (*Info) WithContext

func (i *Info) WithContext(ctx *core.Context)

type Opt

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

type OptFn

type OptFn func(*Opt)

func NeedHelpDeskAuth added in v1.1.41

func NeedHelpDeskAuth() OptFn

func SetNotDataField added in v1.0.2

func SetNotDataField() OptFn

func SetPathParams

func SetPathParams(pathParams map[string]interface{}) OptFn

func SetQueryParams

func SetQueryParams(queryParams map[string]interface{}) OptFn

func SetResponseStream added in v1.0.2

func SetResponseStream() OptFn

func SetTenantKey

func SetTenantKey(tenantKey string) OptFn

func SetUserAccessToken

func SetUserAccessToken(userAccessToken string) OptFn

type Request

type Request struct {
	*Info
	HTTPRequest         *http.Request
	HTTPResponse        *http.Response
	RequestBody         []byte
	RequestBodyStream   io.Reader
	RequestBodyFilePath string
	ContentType         string
	Err                 error
}

func NewRequest

func NewRequest(httpPath, httpMethod string, accessTokenTypes []AccessTokenType,
	input interface{}, output interface{}, optFns ...OptFn) *Request

func NewRequest2

func NewRequest2(httpPath, httpMethod string, accessTokenType AccessTokenType,
	input interface{}, output interface{}, optFns ...OptFn) *Request

Deprecated, please use `NewRequestWithNative`

func NewRequestByAuth

func NewRequestByAuth(httpPath, httpMethod string, input, output interface{}) *Request

func NewRequestWithNative added in v1.1.10

func NewRequestWithNative(httpPath, httpMethod string, accessTokenType AccessTokenType,
	input interface{}, output interface{}, optFns ...OptFn) *Request

func (*Request) DataFilled

func (r *Request) DataFilled() bool

func (*Request) Init

func (r *Request) Init(domain string) error

func (*Request) String

func (r *Request) String() string

func (*Request) Url added in v1.1.41

func (r *Request) Url() string

type UserID

type UserID struct {
	Type constants.UserIDType
	ID   string
}

Jump to

Keyboard shortcuts

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