client

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package client contains all you need to communicate with the insanely fast 1API backend API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	socketcfg.Socketcfg
	// contains filtered or unexported fields
}

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

func (c *Client) EncodeData(cfg *socketcfg.Socketcfg, cmd map[string]string) string

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) Getapiurl

func (c *Client) Getapiurl() string

Getapiurl is the getter method for apiurl property

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

func (c *Client) SetCredentials(username string, password string, otpcode string)

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

func (c *Client) SetSubuserView(username string)

SetSubuserView method to activate the use of a subuser account as data view

func (*Client) Setapiurl

func (c *Client) Setapiurl(url string)

Setapiurl is the setter method for apiurl

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

Directories

Path Synopsis
Package socketcfg provides apiconnector client connection settings
Package socketcfg provides apiconnector client connection settings

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL