Documentation ¶
Index ¶
- Constants
- func GeneralMultipartSerializer(form *MultipartForm) (io.Reader, string, error)
- func JSONBodyDeserializer(body []byte, target interface{}) (interface{}, error)
- func JSONBodySerializer(body interface{}) (io.Reader, error)
- type APIHasBody
- func APIMakeDoNewRequestWithBodySerializer[T any, R any](simpleAPISelf *SimpleAPIDef, method string, relativeURL string, ...) APIHasBody[T, R]
- func APIMakePatchJSONBody[T any, R any](simpleAPISelf *SimpleAPIDef, relativeURL string) APIHasBody[T, R]
- func APIMakePostJSONBody[T any, R any](simpleAPISelf *SimpleAPIDef, relativeURL string) APIHasBody[T, R]
- func APIMakePutJSONBody[T any, R any](simpleAPISelf *SimpleAPIDef, relativeURL string) APIHasBody[T, R]
- type APIMultipart
- func APIMakeDoNewRequestWithMultipartSerializer[R any](simpleAPISelf *SimpleAPIDef, method string, relativeURL string, ...) APIMultipart[R]
- func APIMakePatchMultipartBody[R any](simpleAPISelf *SimpleAPIDef, relativeURL string) APIMultipart[R]
- func APIMakePostMultipartBody[R any](simpleAPISelf *SimpleAPIDef, relativeURL string) APIMultipart[R]
- func APIMakePutMultipartBody[R any](simpleAPISelf *SimpleAPIDef, relativeURL string) APIMultipart[R]
- type APINoBody
- type APIResponse
- type BodyDeserializer
- type BodySerializer
- type Interceptor
- type MultipartForm
- type MultipartSerializer
- type PathParam
- type ResponseWithError
- type SimpleAPIDef
- type SimpleHTTPDef
- func (simpleHTTPSelf *SimpleHTTPDef) AddInterceptor(interceptors ...*Interceptor)
- func (simpleHTTPSelf *SimpleHTTPDef) ClearInterceptor()
- func (simpleHTTPSelf *SimpleHTTPDef) Delete(givenURL string) *ResponseWithError
- func (simpleHTTPSelf *SimpleHTTPDef) DoNewRequest(context context.Context, header http.Header, method string, givenURL string) *ResponseWithError
- func (simpleHTTPSelf *SimpleHTTPDef) DoNewRequestWithBodyOptions(context context.Context, header http.Header, method string, givenURL string, ...) *ResponseWithError
- func (simpleHTTPSelf *SimpleHTTPDef) DoRequest(request *http.Request) *ResponseWithError
- func (simpleHTTPSelf *SimpleHTTPDef) Get(givenURL string) *ResponseWithError
- func (simpleHTTPSelf *SimpleHTTPDef) GetContextTimeout() (context.Context, context.CancelFunc)
- func (simpleHTTPSelf *SimpleHTTPDef) GetHTTPClient() *http.Client
- func (simpleHTTPSelf *SimpleHTTPDef) Head(givenURL string) *ResponseWithError
- func (simpleHTTPSelf *SimpleHTTPDef) Options(givenURL string) *ResponseWithError
- func (simpleHTTPSelf *SimpleHTTPDef) Patch(givenURL, contentType string, body io.Reader) *ResponseWithError
- func (simpleHTTPSelf *SimpleHTTPDef) Post(givenURL, contentType string, body io.Reader) *ResponseWithError
- func (simpleHTTPSelf *SimpleHTTPDef) Put(givenURL, contentType string, body io.Reader) *ResponseWithError
- func (simpleHTTPSelf *SimpleHTTPDef) RemoveInterceptor(interceptors ...*Interceptor)
- func (simpleHTTPSelf *SimpleHTTPDef) RoundTrip(request *http.Request) (*http.Response, error)
- func (simpleHTTPSelf *SimpleHTTPDef) SetHTTPClient(client *http.Client)
Constants ¶
const ( // DefaultTimeoutMillisecond Default Request TimeoutMillisecond DefaultTimeoutMillisecond = 30 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func GeneralMultipartSerializer ¶
func GeneralMultipartSerializer(form *MultipartForm) (io.Reader, string, error)
GeneralMultipartSerializer Default Multipart Body serializer
func JSONBodyDeserializer ¶
JSONBodyDeserializer Default JSON Body deserializer
func JSONBodySerializer ¶
JSONBodySerializer Default JSON Body serializer
Types ¶
type APIHasBody ¶
type APIHasBody[T any, R any] func(pathParam PathParam, body T, target *R) *fpgo.MonadIODef[*APIResponse[R]]
APIHasBody API with request body options
func APIMakeDoNewRequestWithBodySerializer ¶
func APIMakeDoNewRequestWithBodySerializer[T any, R any](simpleAPISelf *SimpleAPIDef, method string, relativeURL string, contentType string, bodySerializer BodySerializer) APIHasBody[T, R]
APIMakeDoNewRequestWithBodySerializer Make a API with request body options
func APIMakePatchJSONBody ¶
func APIMakePatchJSONBody[T any, R any](simpleAPISelf *SimpleAPIDef, relativeURL string) APIHasBody[T, R]
APIMakePatchJSONBody Make a Patch API with json Body
func APIMakePostJSONBody ¶
func APIMakePostJSONBody[T any, R any](simpleAPISelf *SimpleAPIDef, relativeURL string) APIHasBody[T, R]
APIMakePostJSONBody Make a Post API with json Body
func APIMakePutJSONBody ¶
func APIMakePutJSONBody[T any, R any](simpleAPISelf *SimpleAPIDef, relativeURL string) APIHasBody[T, R]
APIMakePutJSONBody Make a Put API with json Body
type APIMultipart ¶
type APIMultipart[R any] func(pathParam PathParam, body *MultipartForm, target *R) *fpgo.MonadIODef[*APIResponse[R]]
APIMultipart API with request body options
func APIMakeDoNewRequestWithMultipartSerializer ¶
func APIMakeDoNewRequestWithMultipartSerializer[R any](simpleAPISelf *SimpleAPIDef, method string, relativeURL string, multipartSerializer MultipartSerializer) APIMultipart[R]
APIMakeDoNewRequestWithMultipartSerializer Make a API with request body options
func APIMakePatchMultipartBody ¶
func APIMakePatchMultipartBody[R any](simpleAPISelf *SimpleAPIDef, relativeURL string) APIMultipart[R]
APIMakePatchMultipartBody Make a Patch API with multipart Body
func APIMakePostMultipartBody ¶
func APIMakePostMultipartBody[R any](simpleAPISelf *SimpleAPIDef, relativeURL string) APIMultipart[R]
APIMakePostMultipartBody Make a Post API with multipart Body
func APIMakePutMultipartBody ¶
func APIMakePutMultipartBody[R any](simpleAPISelf *SimpleAPIDef, relativeURL string) APIMultipart[R]
APIMakePutMultipartBody Make a Put API with multipart Body
type APINoBody ¶
type APINoBody[R any] func(pathParam PathParam, target *R) *fpgo.MonadIODef[*APIResponse[R]]
APINoBody API without request body options
func APIMakeDelete ¶
func APIMakeDelete[R any](simpleAPISelf *SimpleAPIDef, relativeURL string) APINoBody[R]
APIMakeDelete Make a Delete API
func APIMakeDoNewRequest ¶
func APIMakeDoNewRequest[R any](simpleAPISelf *SimpleAPIDef, method string, relativeURL string) APINoBody[R]
APIMakeDoNewRequest Make a API without body options
func APIMakeGet ¶
func APIMakeGet[R any](simpleAPISelf *SimpleAPIDef, relativeURL string) APINoBody[R]
APIMakeGet Make a Get API
type APIResponse ¶
type APIResponse[R any] struct { ResponseWithError TargetObject *R }
APIResponse Response with Error & Type
type BodyDeserializer ¶
BodyDeserializer Deserialize the body (for response)
type BodySerializer ¶
BodySerializer Serialize the body (for put/post/patch etc)
type MultipartForm ¶
type MultipartForm struct { Value map[string][]string // File The absolute paths of files File map[string][]string }
MultipartForm Path params for API usages
type MultipartSerializer ¶
type MultipartSerializer func(body *MultipartForm) (io.Reader, string, error)
MultipartSerializer Serialize the multipart body (for put/post/patch etc)
type ResponseWithError ¶
ResponseWithError Response with Error
type SimpleAPIDef ¶
type SimpleAPIDef struct { BaseURL string DefaultHeader http.Header RequestSerializerForMultipart MultipartSerializer RequestSerializerForJSON BodySerializer ResponseDeserializer BodyDeserializer // contains filtered or unexported fields }
SimpleAPIDef SimpleAPIDef inspired by Retrofits
func NewSimpleAPI ¶
func NewSimpleAPI(baseURL string) *SimpleAPIDef
NewSimpleAPI New a NewSimpleAPI instance
func NewSimpleAPIWithSimpleHTTP ¶
func NewSimpleAPIWithSimpleHTTP(baseURL string, simpleHTTP *SimpleHTTPDef) *SimpleAPIDef
NewSimpleAPIWithSimpleHTTP a SimpleAPIDef instance with a SimpleHTTP
func (*SimpleAPIDef) GetSimpleHTTP ¶
func (simpleAPISelf *SimpleAPIDef) GetSimpleHTTP() *SimpleHTTPDef
GetSimpleHTTP Get the SimpleHTTP
type SimpleHTTPDef ¶
type SimpleHTTPDef struct { TimeoutMillisecond int64 // contains filtered or unexported fields }
SimpleHTTPDef SimpleHTTP inspired by Retrofits
func NewSimpleHTTPWithClientAndInterceptors ¶
func NewSimpleHTTPWithClientAndInterceptors(client *http.Client, interceptors ...*Interceptor) *SimpleHTTPDef
NewSimpleHTTPWithClientAndInterceptors a SimpleHTTP instance with a given client & interceptor(s)
func (*SimpleHTTPDef) AddInterceptor ¶
func (simpleHTTPSelf *SimpleHTTPDef) AddInterceptor(interceptors ...*Interceptor)
AddInterceptor Add the interceptor(s)
func (*SimpleHTTPDef) ClearInterceptor ¶
func (simpleHTTPSelf *SimpleHTTPDef) ClearInterceptor()
ClearInterceptor Clear the interceptor(s)
func (*SimpleHTTPDef) Delete ¶
func (simpleHTTPSelf *SimpleHTTPDef) Delete(givenURL string) *ResponseWithError
Delete HTTP Method Delete
func (*SimpleHTTPDef) DoNewRequest ¶
func (simpleHTTPSelf *SimpleHTTPDef) DoNewRequest(context context.Context, header http.Header, method string, givenURL string) *ResponseWithError
DoNewRequest Do New HTTP Request
func (*SimpleHTTPDef) DoNewRequestWithBodyOptions ¶
func (simpleHTTPSelf *SimpleHTTPDef) DoNewRequestWithBodyOptions(context context.Context, header http.Header, method string, givenURL string, body io.Reader, contentType string) *ResponseWithError
DoNewRequestWithBodyOptions Do New HTTP Request with body options
func (*SimpleHTTPDef) DoRequest ¶
func (simpleHTTPSelf *SimpleHTTPDef) DoRequest(request *http.Request) *ResponseWithError
DoRequest Do HTTP Request with interceptors
func (*SimpleHTTPDef) Get ¶
func (simpleHTTPSelf *SimpleHTTPDef) Get(givenURL string) *ResponseWithError
Get HTTP Method Get
func (*SimpleHTTPDef) GetContextTimeout ¶
func (simpleHTTPSelf *SimpleHTTPDef) GetContextTimeout() (context.Context, context.CancelFunc)
GetContextTimeout Get Context by TimeoutMillisecond
func (*SimpleHTTPDef) GetHTTPClient ¶
func (simpleHTTPSelf *SimpleHTTPDef) GetHTTPClient() *http.Client
GetHTTPClient Get the http client
func (*SimpleHTTPDef) Head ¶
func (simpleHTTPSelf *SimpleHTTPDef) Head(givenURL string) *ResponseWithError
Head HTTP Method Head
func (*SimpleHTTPDef) Options ¶
func (simpleHTTPSelf *SimpleHTTPDef) Options(givenURL string) *ResponseWithError
Options HTTP Method Options
func (*SimpleHTTPDef) Patch ¶
func (simpleHTTPSelf *SimpleHTTPDef) Patch(givenURL, contentType string, body io.Reader) *ResponseWithError
Patch HTTP Method Patch
func (*SimpleHTTPDef) Post ¶
func (simpleHTTPSelf *SimpleHTTPDef) Post(givenURL, contentType string, body io.Reader) *ResponseWithError
Post HTTP Method Post
func (*SimpleHTTPDef) Put ¶
func (simpleHTTPSelf *SimpleHTTPDef) Put(givenURL, contentType string, body io.Reader) *ResponseWithError
Put HTTP Method Put
func (*SimpleHTTPDef) RemoveInterceptor ¶
func (simpleHTTPSelf *SimpleHTTPDef) RemoveInterceptor(interceptors ...*Interceptor)
RemoveInterceptor Remove the interceptor(s)
func (*SimpleHTTPDef) SetHTTPClient ¶
func (simpleHTTPSelf *SimpleHTTPDef) SetHTTPClient(client *http.Client)
SetHTTPClient Get the http client and setup interceptors