Documentation ¶
Index ¶
- func IsResponseOK(resp Response, err error) bool
- type Auth
- type Client
- type ClientAuthSignature
- type ClientAuthSignatureBase
- type ClientAuthSignatureBaseConfig
- type ClientAuthSms
- type DoRequest
- type HttpResponse
- type Response
- type RestApiClient
- type RestApiClientBase
- func (r *RestApiClientBase) AuthPath(path string) string
- func (r *RestApiClientBase) Construct(withBodySender DoRequest, withQuerySender DoRequest)
- func (r *RestApiClientBase) Delete(ctx op_context.Context, path string, cmd interface{}, response interface{}, ...) (Response, error)
- func (r *RestApiClientBase) Get(ctx op_context.Context, path string, cmd interface{}, response interface{}, ...) (Response, error)
- func (r *RestApiClientBase) Init(httpClient *http_request.HttpClient, baseUrl string, userAgent string, ...)
- func (r *RestApiClientBase) Login(ctx op_context.Context, user string, password string) (Response, error)
- func (r *RestApiClientBase) Logout(ctx op_context.Context) (Response, error)
- func (r *RestApiClientBase) Patch(ctx op_context.Context, path string, cmd interface{}, response interface{}, ...) (Response, error)
- func (r *RestApiClientBase) Post(ctx op_context.Context, path string, cmd interface{}, response interface{}, ...) (Response, error)
- func (r *RestApiClientBase) Prepare(ctx op_context.Context) (Response, error)
- func (r *RestApiClientBase) Put(ctx op_context.Context, path string, cmd interface{}, response interface{}, ...) (Response, error)
- func (r *RestApiClientBase) RequestBody(ctx op_context.Context, method string, path string, cmd interface{}, ...) (Response, error)
- func (r *RestApiClientBase) RequestQuery(ctx op_context.Context, method string, path string, cmd interface{}, ...) (Response, error)
- func (r *RestApiClientBase) RequestRefreshToken(ctx op_context.Context) (Response, error)
- func (r *RestApiClientBase) SendRequest(send DoRequest, ctx op_context.Context, method string, path string, ...) (Response, error)
- func (r *RestApiClientBase) SendSmsConfirmation(send DoRequest, ctx op_context.Context, resp Response, code string, ...) (Response, error)
- func (r *RestApiClientBase) SetRefreshToken(token string)
- func (r *RestApiClientBase) UpdateCsrfToken(ctx op_context.Context) (Response, error)
- func (r *RestApiClientBase) UpdateTokens(ctx op_context.Context) (Response, error)
- func (r *RestApiClientBase) Url(path string) string
- type RestApiClientWithConfig
- type RestApiClientWithConfigCfg
- type RestApiMethod
- type TenancyAuth
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsResponseOK ¶
Types ¶
type Client ¶
type Client struct { RestApiClient RestApiClient // contains filtered or unexported fields }
func New ¶
func New(restApiClient RestApiClient, auth ...Auth) *Client
func (*Client) SetPropagateAuthUser ¶
func (*Client) SetPropagateContextId ¶
type ClientAuthSignature ¶
type ClientAuthSignature struct { Signer crypt_utils.ESigner EndpoindsConfig auth.EndpointsAuthConfig }
func (*ClientAuthSignature) HandleResponse ¶
func (a *ClientAuthSignature) HandleResponse(resp Response)
func (*ClientAuthSignature) MakeHeaders ¶
func (a *ClientAuthSignature) MakeHeaders(ctx op_context.Context, operation api.Operation, cmd interface{}) (map[string]string, error)
type ClientAuthSignatureBase ¶
type ClientAuthSignatureBase struct { ClientAuthSignatureBaseConfig ClientAuthSignature // contains filtered or unexported fields }
func NewClientAuthSignature ¶
func NewClientAuthSignature() *ClientAuthSignatureBase
func (*ClientAuthSignatureBase) Config ¶
func (a *ClientAuthSignatureBase) Config() interface{}
type ClientAuthSms ¶
type ClientAuthSms struct {
// contains filtered or unexported fields
}
func NewClientAuthSms ¶
func NewClientAuthSms() *ClientAuthSms
func (*ClientAuthSms) HandleResponse ¶
func (a *ClientAuthSms) HandleResponse(resp Response)
func (*ClientAuthSms) MakeHeaders ¶
func (a *ClientAuthSms) MakeHeaders(ctx op_context.Context, operation api.Operation, cmd interface{}) (map[string]string, error)
func (*ClientAuthSms) SetCode ¶
func (a *ClientAuthSms) SetCode(code string)
type DoRequest ¶
type DoRequest = func(ctx op_context.Context, httpClient *http_request.HttpClient, method string, path string, cmd interface{}, headers ...map[string]string) (Response, error)
type HttpResponse ¶
func NewResponse ¶
func NewResponse(raw *http.Response) (*HttpResponse, error)
func (*HttpResponse) Body ¶
func (r *HttpResponse) Body() []byte
func (*HttpResponse) Code ¶
func (r *HttpResponse) Code() int
func (*HttpResponse) Error ¶
func (r *HttpResponse) Error() generic_error.Error
func (*HttpResponse) Header ¶
func (r *HttpResponse) Header() http.Header
func (*HttpResponse) Message ¶
func (r *HttpResponse) Message() string
func (*HttpResponse) SetError ¶
func (r *HttpResponse) SetError(err generic_error.Error)
type Response ¶
type Response interface { Code() int Header() http.Header Body() []byte Message() string Error() generic_error.Error SetError(err generic_error.Error) }
func DefaultSendWithBody ¶
func DefaultSendWithBody(ctx op_context.Context, httpClient *http_request.HttpClient, method string, url string, cmd interface{}, headers ...map[string]string) (Response, error)
func DefaultSendWithQuery ¶
func DefaultSendWithQuery(ctx op_context.Context, httpClient *http_request.HttpClient, method string, url string, cmd interface{}, headers ...map[string]string) (Response, error)
type RestApiClient ¶
type RestApiClient interface { Url(path string) string Login(ctx op_context.Context, user string, password string) (Response, error) Logout(ctx op_context.Context) (Response, error) UpdateTokens(ctx op_context.Context) (Response, error) UpdateCsrfToken(ctx op_context.Context) (Response, error) RequestRefreshToken(ctx op_context.Context) (Response, error) Post(ctx op_context.Context, path string, cmd interface{}, response interface{}, headers ...map[string]string) (Response, error) Put(ctx op_context.Context, path string, cmd interface{}, response interface{}, headers ...map[string]string) (Response, error) Patch(ctx op_context.Context, path string, cmd interface{}, response interface{}, headers ...map[string]string) (Response, error) Get(ctx op_context.Context, path string, cmd interface{}, response interface{}, headers ...map[string]string) (Response, error) Delete(ctx op_context.Context, path string, cmd interface{}, response interface{}, headers ...map[string]string) (Response, error) SendSmsConfirmation(send DoRequest, ctx op_context.Context, resp Response, code string, method string, url string, cmd interface{}, headers ...map[string]string) (Response, error) }
type RestApiClientBase ¶
type RestApiClientBase struct { BaseUrl string UserAgent string Tenancy *TenancyAuth AccessToken string RefreshToken string CsrfToken string SendWithBody DoRequest SendWithQuery DoRequest HttpClient *http_request.HttpClient }
func DefaultRestApiClient ¶
func DefaultRestApiClient(httpClient *http_request.HttpClient, baseUrl string, userAgent ...string) *RestApiClientBase
func NewRestApiClientBase ¶
func NewRestApiClientBase(withBodySender DoRequest, withQuerySender DoRequest) *RestApiClientBase
func (*RestApiClientBase) AuthPath ¶
func (r *RestApiClientBase) AuthPath(path string) string
func (*RestApiClientBase) Construct ¶
func (r *RestApiClientBase) Construct(withBodySender DoRequest, withQuerySender DoRequest)
func (*RestApiClientBase) Delete ¶
func (r *RestApiClientBase) Delete(ctx op_context.Context, path string, cmd interface{}, response interface{}, headers ...map[string]string) (Response, error)
func (*RestApiClientBase) Get ¶
func (r *RestApiClientBase) Get(ctx op_context.Context, path string, cmd interface{}, response interface{}, headers ...map[string]string) (Response, error)
func (*RestApiClientBase) Init ¶
func (r *RestApiClientBase) Init(httpClient *http_request.HttpClient, baseUrl string, userAgent string, tenancy ...*TenancyAuth)
func (*RestApiClientBase) Login ¶
func (r *RestApiClientBase) Login(ctx op_context.Context, user string, password string) (Response, error)
func (*RestApiClientBase) Logout ¶
func (r *RestApiClientBase) Logout(ctx op_context.Context) (Response, error)
func (*RestApiClientBase) Patch ¶
func (r *RestApiClientBase) Patch(ctx op_context.Context, path string, cmd interface{}, response interface{}, headers ...map[string]string) (Response, error)
func (*RestApiClientBase) Post ¶
func (r *RestApiClientBase) Post(ctx op_context.Context, path string, cmd interface{}, response interface{}, headers ...map[string]string) (Response, error)
func (*RestApiClientBase) Prepare ¶
func (r *RestApiClientBase) Prepare(ctx op_context.Context) (Response, error)
func (*RestApiClientBase) Put ¶
func (r *RestApiClientBase) Put(ctx op_context.Context, path string, cmd interface{}, response interface{}, headers ...map[string]string) (Response, error)
func (*RestApiClientBase) RequestBody ¶
func (r *RestApiClientBase) RequestBody(ctx op_context.Context, method string, path string, cmd interface{}, response interface{}, headers ...map[string]string) (Response, error)
func (*RestApiClientBase) RequestQuery ¶
func (r *RestApiClientBase) RequestQuery(ctx op_context.Context, method string, path string, cmd interface{}, response interface{}, headers ...map[string]string) (Response, error)
func (*RestApiClientBase) RequestRefreshToken ¶
func (r *RestApiClientBase) RequestRefreshToken(ctx op_context.Context) (Response, error)
func (*RestApiClientBase) SendRequest ¶
func (r *RestApiClientBase) SendRequest(send DoRequest, ctx op_context.Context, method string, path string, cmd interface{}, response interface{}, headers ...map[string]string) (Response, error)
func (*RestApiClientBase) SendSmsConfirmation ¶
func (*RestApiClientBase) SetRefreshToken ¶
func (r *RestApiClientBase) SetRefreshToken(token string)
func (*RestApiClientBase) UpdateCsrfToken ¶
func (r *RestApiClientBase) UpdateCsrfToken(ctx op_context.Context) (Response, error)
func (*RestApiClientBase) UpdateTokens ¶
func (r *RestApiClientBase) UpdateTokens(ctx op_context.Context) (Response, error)
func (*RestApiClientBase) Url ¶
func (r *RestApiClientBase) Url(path string) string
type RestApiClientWithConfig ¶
type RestApiClientWithConfig struct { RestApiClientWithConfigCfg *RestApiClientBase http_request.WithHttpClient }
func DefaultRestApiClientWithConfig ¶
func DefaultRestApiClientWithConfig() *RestApiClientWithConfig
func NewAutoReconnectRestApiClient ¶
func NewAutoReconnectRestApiClient(reconnectHandlers api_client.AutoReconnectHandlers) *RestApiClientWithConfig
func NewRestApiClientWithConfig ¶
func NewRestApiClientWithConfig(withBodySender DoRequest, withQuerySender DoRequest) *RestApiClientWithConfig
func (*RestApiClientWithConfig) Config ¶
func (r *RestApiClientWithConfig) Config() interface{}
type RestApiMethod ¶
type TenancyAuth ¶
Click to show internal directories.
Click to hide internal directories.