apiclient

package
v4.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2024 License: MIT Imports: 17 Imported by: 1

Documentation

Overview

Package apiclient contains all you need to communicate with the insanely fast HEXONET backend API.

Index

Constants

View Source
const ISPAPI_CONNECTION_URL_LIVE = "https://api.ispapi.net/api/call.cgi" //nolint

ISPAPI_CONNECTION_URL_LIVE represents the url used for the default connection setup

View Source
const ISPAPI_CONNECTION_URL_OTE = "https://api-ote.ispapi.net/api/call.cgi" //nolint

ISPAPI_CONNECTION_URL_OTE represents the url used for the OT&E (demo system) connection setup

View Source
const ISPAPI_CONNECTION_URL_PROXY = "http://127.0.0.1/api/call.cgi" //nolint

ISPAPI_CONNECTION_URL_PROXY represents the url used for the high performance connection setup

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClient

type APIClient struct {
	// contains filtered or unexported fields
}

APIClient is the entry point class for communicating with the insanely fast HEXONET 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 NewAPIClient

func NewAPIClient() *APIClient

NewAPIClient represents the constructor for struct APIClient.

func (*APIClient) DisableDebugMode

func (cl *APIClient) DisableDebugMode() *APIClient

DisableDebugMode method to disable Debug Output to logger

func (*APIClient) EnableDebugMode

func (cl *APIClient) EnableDebugMode() *APIClient

EnableDebugMode method to enable Debug Output to logger

func (*APIClient) GetPOSTData

func (cl *APIClient) GetPOSTData(cmd map[string]string, secured ...bool) string

GetPOSTData method to Serialize given command for POST request including connection configuration data

func (*APIClient) GetProxy

func (cl *APIClient) GetProxy() (string, error)

GetProxy method to get the configured proxy to use for API communication

func (*APIClient) GetReferer

func (cl *APIClient) GetReferer() (string, error)

GetReferer method to get configured HTTP Header `Referer` value

func (*APIClient) GetSession

func (cl *APIClient) GetSession() (string, error)

GetSession method to get the API Session that is currently set

func (*APIClient) GetURL

func (cl *APIClient) GetURL() string

GetURL method to get the API connection url that is currently set

func (*APIClient) GetUserAgent

func (cl *APIClient) GetUserAgent() string

GetUserAgent method to return the user agent string

func (*APIClient) GetVersion

func (cl *APIClient) GetVersion() string

GetVersion method to get current module version

func (*APIClient) Login

func (cl *APIClient) Login(params ...string) *R.Response

Login method to perform API login to start session-based communication 1st parameter: one time password

func (*APIClient) LoginExtended

func (cl *APIClient) LoginExtended(params ...interface{}) *R.Response

LoginExtended method to perform API login to start session-based communication. 1st parameter: map of additional command parameters 2nd parameter: one time password

func (*APIClient) Logout

func (cl *APIClient) Logout() *R.Response

Logout method to perform API logout to close API session in use

func (*APIClient) Request

func (cl *APIClient) Request(cmd map[string]interface{}) *R.Response

Request method to perform API request using the given command

func (*APIClient) RequestAllResponsePages

func (cl *APIClient) RequestAllResponsePages(cmd map[string]string) []R.Response

RequestAllResponsePages method to request all pages/entries for the given query command Use this method with caution as it requests all list data until done.

func (*APIClient) RequestNextResponsePage

func (cl *APIClient) RequestNextResponsePage(rr *R.Response) (*R.Response, error)

RequestNextResponsePage method to request the next page of list entries for the current list query Useful for lists

func (*APIClient) ResetUserView

func (cl *APIClient) ResetUserView() *APIClient

ResetUserView method to reset data view back from subuser to user

func (*APIClient) ReuseSession

func (cl *APIClient) ReuseSession(sessionobj map[string]interface{}) *APIClient

ReuseSession method to reuse given configuration out of a user session to rebuild and reuse connection settings

func (*APIClient) SaveSession

func (cl *APIClient) SaveSession(sessionobj map[string]interface{}) *APIClient

SaveSession method to apply data to a session for later reuse Please save/update that map into user session

func (*APIClient) SetCredentials

func (cl *APIClient) SetCredentials(uid string, pw string) *APIClient

SetCredentials method to set Credentials to be used for API communication

func (*APIClient) SetCustomLogger

func (cl *APIClient) SetCustomLogger(logger LG.ILogger) *APIClient

SetCustomLogger method to use a custom mechanism for debug mode outputs/logging

func (*APIClient) SetDefaultLogger

func (cl *APIClient) SetDefaultLogger() *APIClient

SetDefaultLogger method to use the default mechanism for debug mode outputs

func (*APIClient) SetOTP

func (cl *APIClient) SetOTP(value string) *APIClient

SetOTP method to set one time password to be used for API communication

func (*APIClient) SetProxy

func (cl *APIClient) SetProxy(proxy string) *APIClient

SetProxy method to set a proxy to use for API communication

func (*APIClient) SetReferer

func (cl *APIClient) SetReferer(referer string) *APIClient

SetReferer method to set a value for HTTP Header `Referer` to use for API communication

func (*APIClient) SetRemoteIPAddress

func (cl *APIClient) SetRemoteIPAddress(value string) *APIClient

SetRemoteIPAddress method to set an Remote IP Address to be used for API communication

func (*APIClient) SetRoleCredentials

func (cl *APIClient) SetRoleCredentials(uid string, role string, pw string) *APIClient

SetRoleCredentials method to set Role User Credentials to be used for API communication

func (*APIClient) SetSession

func (cl *APIClient) SetSession(value string) *APIClient

SetSession method to set an API session id to be used for API communication

func (*APIClient) SetURL

func (cl *APIClient) SetURL(value string) *APIClient

SetURL method to set another connection url to be used for API communication

func (*APIClient) SetUserAgent

func (cl *APIClient) SetUserAgent(str string, rv string, modules ...[]string) *APIClient

SetUserAgent method to customize user-agent header (useful for tools that use our SDK)

func (*APIClient) SetUserView

func (cl *APIClient) SetUserView(uid string) *APIClient

SetUserView method to set a data view to a given subuser

func (*APIClient) UseDefaultConnectionSetup

func (cl *APIClient) UseDefaultConnectionSetup() *APIClient

UseDefaultConnectionSetup to activate default conneciton setup (the default anyways)

func (*APIClient) UseHighPerformanceConnectionSetup

func (cl *APIClient) UseHighPerformanceConnectionSetup() *APIClient

UseHighPerformanceConnectionSetup to activate high performance conneciton setup

func (*APIClient) UseLIVESystem

func (cl *APIClient) UseLIVESystem() *APIClient

UseLIVESystem method to set LIVE System for API communication Usage of LIVE System is active by default.

func (*APIClient) UseOTESystem

func (cl *APIClient) UseOTESystem() *APIClient

UseOTESystem method to set OT&E System for API communication

Jump to

Keyboard shortcuts

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