Documentation
¶
Index ¶
- func BasicAuth(username, password string) string
- func ConsumeRestJSON[Resp ApiResp](c *CallData) (*Resp, response.ErrorState)
- func GetJSONResp[Resp ApiResp](api RemoteApi, resp *http.Response) (*Resp, response.ErrorState)
- func PrepareCall(c CallData) (*http.Request, response.ErrorState)
- func RemoteCall[Req any, Resp ApiResp](param *RemoteCallParamData[Req]) (*Resp, response.ErrorState)
- func TransmitRequestWithAuth(path, api, method string, requestByte []byte, headers map[string]string, ...) (int, map[string]string, any, error)
- func TransmitSoap[Resp any](request any, url string, debug bool, timeout time.Duration) (*Resp, error)
- type ApiResp
- type Auth
- type AuthSystem
- type CallApiInterface
- type CallData
- type CallParam
- type CallParamData
- type CallResp
- type CallResult
- type OAuth2Token
- type RemoteApi
- type RemoteApiModel
- func (m RemoteApiModel) ConsumeRestApi(requestJson []byte, apiName, path, contentType, method string, ...) ([]byte, string, int, error)
- func (m RemoteApiModel) ConsumeRestBasicAuthApi(requestJson []byte, apiName, path, contentType, method string, ...) ([]byte, string, error)
- func (m RemoteApiModel) GetApi(apiName string) RemoteApi
- type RemoteCallParamData
- type RequestBodyType
- type TokenCache
- type TypeList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConsumeRestJSON ¶ added in v0.9.52
func ConsumeRestJSON[Resp ApiResp](c *CallData) (*Resp, response.ErrorState)
func GetJSONResp ¶ added in v0.9.52
func PrepareCall ¶
func PrepareCall(c CallData) (*http.Request, response.ErrorState)
func RemoteCall ¶ added in v0.9.52
func RemoteCall[Req any, Resp ApiResp](param *RemoteCallParamData[Req]) (*Resp, response.ErrorState)
func TransmitRequestWithAuth ¶
func TransmitRequestWithAuth( path, api, method string, requestByte []byte, headers map[string]string, parseRemoteResp func([]byte, string, int) (int, map[string]string, any, error), consumeHandler func([]byte, string, string, string, string, map[string]string) ([]byte, string, int, error), ) (int, map[string]string, any, error)
Types ¶
type AuthSystem ¶ added in v0.12.2
type AuthSystem interface {
Login() (*TokenCache, libError.Error)
}
type CallApiInterface ¶
type CallApiInterface interface { GetApi(apiName string) RemoteApi ConsumeRestBasicAuthApi(requestJson []byte, apiName, path, contentType, method string, headers map[string]string) ([]byte, string, error) ConsumeRestApi(requestJson []byte, apiName, path, contentType, method string, headers map[string]string) ([]byte, string, int, error) }
type CallData ¶
type CallParam ¶ added in v0.3.4
type CallParam *CallParamData
type CallParamData ¶ added in v0.9.16
type CallResp ¶
func ConsumeRest ¶
func ConsumeRest[Resp any](c CallData) (*Resp, *response.WsRemoteResponse, *CallResp, response.ErrorState)
type CallResult ¶ added in v0.3.4
type CallResult[RespType any] struct { Resp *RespType WsResp *response.WsRemoteResponse Status *CallResp Error response.ErrorState }
func Call ¶ added in v0.3.4
func Call[RespType any](param CallParam) CallResult[RespType]
func MultiCall ¶ added in v0.3.6
func MultiCall(paramList []CallParam, core CallApiInterface) []CallResult[response.WsRemoteResponse]
type OAuth2Token ¶ added in v0.12.2
type RemoteApi ¶
type RemoteApi struct { Domain string `yaml:"domain"` Name string `yaml:"name"` AuthData Auth `yaml:"auth"` Options map[string]string `yaml:"options"` Auth AuthSystem `yaml:"-"` TokenCacheLock *sync.Mutex `yaml:"-"` TokenCache *TokenCache `yaml:"-"` }
func (RemoteApi) AddBasicAuthHeader ¶ added in v0.12.2
func (*RemoteApi) Authenticate ¶ added in v0.12.2
func (RemoteApi) GetAuthHeader ¶ added in v0.12.4
func (RemoteApi) GetBasicAuthHeader ¶ added in v0.12.2
type RemoteApiModel ¶
func (RemoteApiModel) ConsumeRestApi ¶
func (RemoteApiModel) ConsumeRestBasicAuthApi ¶
func (RemoteApiModel) GetApi ¶
func (m RemoteApiModel) GetApi(apiName string) RemoteApi
type RemoteCallParamData ¶ added in v0.9.52
type RequestBodyType ¶ added in v0.11.15
type RequestBodyType int
const ( JSON RequestBodyType = iota Form Empty )
type TokenCache ¶ added in v0.12.2
type TokenCache struct { AccessToken *OAuth2Token RefreshToken *OAuth2Token }
func InitTokenCache ¶ added in v0.12.4
func InitTokenCache() (*TokenCache, *sync.Mutex)
initilaizes a token cache which will be used across all APIs should be called once per remote-api
func (TokenCache) Expired ¶ added in v0.12.9
func (t TokenCache) Expired() bool
Click to show internal directories.
Click to hide internal directories.