Documentation ¶
Index ¶
- type APIAccess
- type APIAccessStruct
- func (apiAccessStruct *APIAccessStruct) Auth() (string, error)
- func (apiAccessStruct *APIAccessStruct) Config(arr map[string]interface{})
- func (apiAccessStruct *APIAccessStruct) Decode(result json.RawMessage) (map[string]interface{}, error)
- func (apiAccessStruct *APIAccessStruct) GetAPIURL(path string) string
- func (apiAccessStruct *APIAccessStruct) GetConfig() APIAccessStruct
- func (apiAccessStruct *APIAccessStruct) GetEndpoints() []string
- func (apiAccessStruct *APIAccessStruct) Nonce() string
- func (apiAccessStruct *APIAccessStruct) Post(input, payload map[string]interface{}) (*PostResponse, error)
- func (apiAccessStruct *APIAccessStruct) Send(path string, input, payload map[string]interface{}) (*PostResponse, error)
- func (apiAccessStruct *APIAccessStruct) SetEndpoints(input map[string]interface{}) error
- func (apiAccessStruct *APIAccessStruct) SetPath(path string)
- type PostResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIAccess ¶
type APIAccess interface { Config(arr map[string]interface{}) GetAPIURL(path string) string SetPath(path string) GetConfig() APIAccessStruct SetEndpoints(input []string) Send(path, input, payload string) map[string]interface{} Nonce() string Auth() string Post(input, payload string) map[string]interface{} GetEndpoints() []string Decode(result json.RawMessage) map[string]interface{} }
APIAccess is interface that states which methods need to be implemented
type APIAccessStruct ¶
type APIAccessStruct struct { Version int Domain string UserAgent string Path string URL string Endpoints []string Timeout int64 // contains filtered or unexported fields }
APIAccessStruct is the object that will be implementing APIAcess interface
func New ¶
func New(apiKey, apiSecret string) (apiAccessStruct *APIAccessStruct)
New is used as a constructor for APIAccessStruct, use it to create new APIAcess objects
func (*APIAccessStruct) Auth ¶
func (apiAccessStruct *APIAccessStruct) Auth() (string, error)
Auth is a APIAccessStruct implementation of APIAccess interface function Auth It creates an authorization token passed to the API
func (*APIAccessStruct) Config ¶
func (apiAccessStruct *APIAccessStruct) Config(arr map[string]interface{})
Config is a ApiAccessStruct implementation of APIAccess interface function Config It receives a map of key-value pairs with which APIAccessStruct can be initialized
func (*APIAccessStruct) Decode ¶
func (apiAccessStruct *APIAccessStruct) Decode(result json.RawMessage) (map[string]interface{}, error)
Decode is a APIAccessStruct implementation of APIAccess interface function Decode It decodes bytes passed as arguments
func (*APIAccessStruct) GetAPIURL ¶
func (apiAccessStruct *APIAccessStruct) GetAPIURL(path string) string
GetAPIURL is a APIAccessStruct implementation of APIAccess interface function GetAPIURL It returns full API URL by concatenating domain name with api version and path
func (*APIAccessStruct) GetConfig ¶
func (apiAccessStruct *APIAccessStruct) GetConfig() APIAccessStruct
GetConfig is a APIAccessStruct implementation of APIAccess interface function GetConfig It returns configuration set up inside APIAccessStruct
func (*APIAccessStruct) GetEndpoints ¶
func (apiAccessStruct *APIAccessStruct) GetEndpoints() []string
GetEndpoints is a APIAccessStruct implementation of APIAccess interface function GetEndpoints It returns list of endpoints inside the APIAccessStruct object
func (*APIAccessStruct) Nonce ¶
func (apiAccessStruct *APIAccessStruct) Nonce() string
Nonce is a APIAccessStruct implementation of APIAccess interface function Nonce It creates a nonce like given in requirements
func (*APIAccessStruct) Post ¶
func (apiAccessStruct *APIAccessStruct) Post(input, payload map[string]interface{}) (*PostResponse, error)
Post is a APIAccessStruct implementation of APIAccess interface function Post It executes a Post request
func (*APIAccessStruct) Send ¶
func (apiAccessStruct *APIAccessStruct) Send(path string, input, payload map[string]interface{}) (*PostResponse, error)
Send is a APIAccessStruct implementation of APIAccess interface function Send It sets the path for API call and executes the POST request to API
func (*APIAccessStruct) SetEndpoints ¶
func (apiAccessStruct *APIAccessStruct) SetEndpoints(input map[string]interface{}) error
SetEndpoints is a APIAccessStruct implementation of APIAccess interface function SetEndpoints It is used to set endpoints of the APIAccessStruct to response received from calling POST with given input
func (*APIAccessStruct) SetPath ¶
func (apiAccessStruct *APIAccessStruct) SetPath(path string)
SetPath is a APIAccessStruct implementation of APIAccess interface function SetPath It sets the path inside the struct to the one that is passed as argument
type PostResponse ¶
PostResponse contains data returned from POST request