Documentation ¶
Index ¶
- Constants
- func AssertFormValues(t *testing.T, r *http.Request, expectedValues map[string]interface{})
- func AssertRequestBulk(t *testing.T, r *http.Request, expectedBulkRequest []map[string]interface{})
- func ConvertSourceToJsonStrIfPossible(source interface{}) string
- func ConvertStructToMap(input interface{}) (map[string]interface{}, error)
- func Die(err error)
- func ExtractBulkFiltersFromRequest(r *http.Request) (res map[string]interface{}, err error)
- func GetBaseURL(cc string) string
- func GetBaseURLFromAuthFunc(f AuthFunc) string
- func GetDefaultHTTPClient() *http.Client
- func IsJSONResponseOK(responseStatus *common.Status) bool
- type AuthFunc
- type BodyMock
- type BulkInput
- type Client
- func (cli *Client) Close()
- func (cli *Client) GetSession() (sessionKey string, err error)
- func (cli *Client) InvalidateSession()
- func (cli *Client) Scan(ctx context.Context, apiMethod string, filters map[string]string, ...) error
- func (cli *Client) SendParametersInRequestBody()
- func (cli *Client) SendRequest(ctx context.Context, apiMethod string, filters map[string]string) (*http.Response, error)
- func (cli *Client) SendRequestBulk(ctx context.Context, inputs []BulkInput, filters map[string]string) (*http.Response, error)
- type ClientConstructor
- func (cc *ClientConstructor) Build() *Client
- func (cc *ClientConstructor) WithClientCode(clientCode string)
- func (cc *ClientConstructor) WithHeaderFunc(headersForEveryRequestFunc AuthFunc)
- func (cc *ClientConstructor) WithHttpClient(httpCli *http.Client)
- func (cc *ClientConstructor) WithPartnerKey(partnerKey string)
- func (cc *ClientConstructor) WithSessionKey(sk string)
- func (cc *ClientConstructor) WithSessionProvider(sessProv SessionProvider)
- func (cc *ClientConstructor) WithURL(url string)
- type ClientMock
- type DefaultSessionProvider
- type DestRespWithStatus
- type SessionProvider
Constants ¶
View Source
const ( //MaxIdleConns for Erply API MaxIdleConns = 25 //MaxConnsPerHost for Erply API MaxConnsPerHost = 25 )
View Source
const (
BaseUrl = "https://%s.erply.com/api/"
)
Variables ¶
This section is empty.
Functions ¶
func AssertFormValues ¶ added in v1.9.1
func AssertRequestBulk ¶ added in v1.9.1
func ConvertSourceToJsonStrIfPossible ¶ added in v1.13.1
func ConvertSourceToJsonStrIfPossible(source interface{}) string
func ConvertStructToMap ¶ added in v1.4.0
func ExtractBulkFiltersFromRequest ¶ added in v1.7.5
func GetBaseURL ¶
func GetBaseURLFromAuthFunc ¶ added in v1.3.1
func GetDefaultHTTPClient ¶
func IsJSONResponseOK ¶
Types ¶
type BodyMock ¶
BodyMock implements resp.Body
func NewMockFromStr ¶
NewFromStr creates BodyMock from a string
func NewMockFromStruct ¶
func NewMockFromStruct(input interface{}) *BodyMock
NewFromStruct creates BodyMock from a struct converted to json or string
type Client ¶
type Client struct { Url string // contains filtered or unexported fields }
func NewClientWithURL ¶ added in v1.7.3
func NewClientWithURL(sk, cc, partnerKey, url string, httpCli *http.Client, headersForEveryRequestFunc AuthFunc) *Client
NewClientWithURL allows creating a new Client with a hardcoded URL. Useful for testing purposes
func (*Client) GetSession ¶ added in v1.15.0
func (*Client) InvalidateSession ¶ added in v1.15.0
func (cli *Client) InvalidateSession()
func (*Client) SendParametersInRequestBody ¶ added in v1.22.0
func (cli *Client) SendParametersInRequestBody()
SendParametersInRequestBody indicates to the client that the request should add the data payload in the request body instead of using the query parameters. Using the request body eliminates the query size limitations imposed by the maximum URL length
func (*Client) SendRequest ¶
type ClientConstructor ¶ added in v1.15.0
type ClientConstructor struct {
// contains filtered or unexported fields
}
func (*ClientConstructor) Build ¶ added in v1.15.0
func (cc *ClientConstructor) Build() *Client
func (*ClientConstructor) WithClientCode ¶ added in v1.15.0
func (cc *ClientConstructor) WithClientCode(clientCode string)
func (*ClientConstructor) WithHeaderFunc ¶ added in v1.15.0
func (cc *ClientConstructor) WithHeaderFunc(headersForEveryRequestFunc AuthFunc)
func (*ClientConstructor) WithHttpClient ¶ added in v1.15.0
func (cc *ClientConstructor) WithHttpClient(httpCli *http.Client)
func (*ClientConstructor) WithPartnerKey ¶ added in v1.15.0
func (cc *ClientConstructor) WithPartnerKey(partnerKey string)
func (*ClientConstructor) WithSessionKey ¶ added in v1.15.0
func (cc *ClientConstructor) WithSessionKey(sk string)
func (*ClientConstructor) WithSessionProvider ¶ added in v1.15.0
func (cc *ClientConstructor) WithSessionProvider(sessProv SessionProvider)
func (*ClientConstructor) WithURL ¶ added in v1.15.0
func (cc *ClientConstructor) WithURL(url string)
type ClientMock ¶
type ClientMock struct { ErrToGive error ResponseToGive *http.Response Requests []*http.Request Lock sync.Mutex }
ClientMock mocks HttpClient interface
type DefaultSessionProvider ¶ added in v1.15.0
type DefaultSessionProvider struct {
SessionKey string
}
func (*DefaultSessionProvider) GetSession ¶ added in v1.15.0
func (dsp *DefaultSessionProvider) GetSession() (sessionKey string, err error)
func (*DefaultSessionProvider) Invalidate ¶ added in v1.15.0
func (dsp *DefaultSessionProvider) Invalidate()
type DestRespWithStatus ¶ added in v1.15.0
type SessionProvider ¶ added in v1.15.0
Click to show internal directories.
Click to hide internal directories.