Documentation
¶
Overview ¶
Package client contains all you need to communicate with the insanely fast 1API backend API.
Index ¶
- type Client
- func (c *Client) DisableDebugMode()
- func (c *Client) EnableDebugMode()
- func (c *Client) EncodeData(cfg *socketcfg.Socketcfg, cmd map[string]string) string
- func (c *Client) Getapiurl() string
- func (c *Client) Login() *listresponse.ListResponse
- func (c *Client) LoginExtended(cmdparams map[string]string) *listresponse.ListResponse
- func (c *Client) Logout() *listresponse.ListResponse
- func (c *Client) Request(cmd map[string]string) *listresponse.ListResponse
- func (c *Client) RequestAll(cmd map[string]string) *listresponse.ListResponse
- func (c *Client) ResetSubuserView()
- func (c *Client) SetCredentials(username string, password string, otpcode string)
- func (c *Client) SetSubuserView(username string)
- func (c *Client) Setapiurl(url string)
- func (c *Client) UseLiveSystem()
- func (c *Client) UseOTESystem()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client is the entry point class for communicating with the insanely fast 1API backend api. It allows two ways of communication: * session based communication * sessionless communication
A session based communication makes sense in case you use it to build your own frontend on top. It allows also to use 2FA (2 Factor Auth) by providing "otp" in the config parameter of the login method. A sessionless communication makes sense in case you do not need to care about the above and you have just to request some commands.
Possible commands can be found at https://github.com/hexonet/hexonet-api-documentation/tree/master/API
func NewClient ¶
func NewClient() *Client
NewClient represents the constructor for struct Client. The client is by default set to communicate with the LIVE system. Use method UseOTESystem to switch to the OT&E system instance.
func (*Client) DisableDebugMode ¶ added in v1.2.0
func (c *Client) DisableDebugMode()
DisableDebugMode method to disable debugMode for debug output
func (*Client) EnableDebugMode ¶ added in v1.2.0
func (c *Client) EnableDebugMode()
EnableDebugMode method to enable debugMode for debug output
func (*Client) EncodeData ¶
EncodeData method to use to encode provided data (socket configuration and api command) before sending it to the API server It returns the encoded data ready to use within POST request of type "application/x-www-form-urlencoded"
func (*Client) Login ¶
func (c *Client) Login() *listresponse.ListResponse
Login method to use as entry point for session based communication. Response is returned as ListResponse.
func (*Client) LoginExtended ¶
func (c *Client) LoginExtended(cmdparams map[string]string) *listresponse.ListResponse
LoginExtended method to use as entry point for session based communication. This method allows to provide further command parameters for startsession command. Response is returned as ListResponse.
func (*Client) Logout ¶
func (c *Client) Logout() *listresponse.ListResponse
Logout method to use for session based communication. This method logs you out and destroys the api session. Response is returned as ListResponse.
func (*Client) Request ¶
func (c *Client) Request(cmd map[string]string) *listresponse.ListResponse
Request method requests the given command to the api server and returns the response as ListResponse.
func (*Client) RequestAll ¶
func (c *Client) RequestAll(cmd map[string]string) *listresponse.ListResponse
RequestAll method requests ALL entries matching the request criteria by the given command from api server. So useful for client-side lists. Finally it returns the response as ListResponse.
func (*Client) ResetSubuserView ¶
func (c *Client) ResetSubuserView()
ResetSubuserView method to deactivate the use of a subuser account as data view
func (*Client) SetCredentials ¶
SetCredentials method to set username and password and otp code to use for api communication set otp code to empty string, if you do not use 2FA
func (*Client) SetSubuserView ¶
SetSubuserView method to activate the use of a subuser account as data view
func (*Client) UseLiveSystem ¶
func (c *Client) UseLiveSystem()
UseLiveSystem method to set api client to communicate with the LIVE backend API
func (*Client) UseOTESystem ¶
func (c *Client) UseOTESystem()
UseOTESystem method to set api client to communicate with the OT&E backend API