class Client extends AbstractClient (View source)

IBS API Client

Constants

private VERSION

Current module version.

Kept in sync automatically by semantic-release — see .releaserc.json.

Properties

protected array<string, mixed> $context

context data for the client

from  AbstractClient
protected string $socketURL

API connection url

from  AbstractClient
protected AbstractSocketConfig $socketConfig

Object covering API connection data

from  AbstractClient
protected bool $debugMode

activity flag for debug mode

from  AbstractClient
protected string $ua

user agent

from  AbstractClient
protected array<int, mixed> $curlopts

additional curl options to use

from  AbstractClient
protected LoggerInterface $logger

logger instance for debug mode

from  AbstractClient
protected bool $isOTE

is connected to OT&E

from  AbstractClient
protected HttpTransport $transport

HTTP transport layer

from  AbstractClient

Methods

__construct()

Constructor

request(array $cmd = [], string $path = "")

Perform API request using the given command

newSocketConfig()

Instantiate IBS SocketConfig

setDefaultLogger()

Set default IBS logger

setCustomLogger(LoggerInterface $customLogger)

Set custom logger to use instead of the default one.

enableDebugMode()

Enable debug output to STDOUT

disableDebugMode()

Disable debug output

string
getPOSTData(array $cmd, bool $secured = false)

Serialize given command for POST request including connection configuration data

string|null
getSession()

Get the API Session ID that is currently set Note: not supported.

string
getURL()

Get the API connection url that is currently set

setUserAgent(string $str, string $rv, array $modules = [])

Set a custom user agent (for platforms that use this SDK)

string
getUserAgent()

Get the user agent string

setProxy(string $proxy = "")

Set proxy to use for API communication

string|null
getProxy()

Get proxy configuration for API communication

setReferer(string $referer = "")

Set Referer to use for API communication

string|null
getReferer()

Get Referer configuration for API communication

string
getVersion()

Get the current module version

setURL(string $value)

Set another connection url to be used for API communication

setSession(string $value = "")

Set an API session id to be used for API communication

setCredentials(string $uid = "", string $pw = "")

Set Credentials to be used for API communication

setRoleCredentials(string $uid = "", string $role = "", string $pw = "")

Set Role Credentials to be used for API communication Note: not supported.

useHighPerformanceConnectionSetup()

Activate High Performance Setup Note: not supported.

array
IDNConvert(array $domains)

Convert domain names to idn + punycode if necessary

array
autoIDNConvert(array $cmd)

Auto convert API command parameters to punycode, if necessary.

array
executeCurl(string $data, array $cfg, array $extraCurlOpts = [])

Delegate cURL execution to the transport layer.

void
close()

Close all cURL connections

string
getLiveUrl()

Get LIVE system URL

bool
isOTE()

Check whether the client is connected to the OT&E system

useOTESystem()

Set OT&E System for API communication

useLIVESystem()

Set LIVE System for API communication (this is the default setting)

setContext(array $context)

Set context data for the client

Details

__construct()

Constructor

ResponseInterface request(array $cmd = [], string $path = "")

Perform API request using the given command

Parameters

array $cmd

API command

string $path

Path to the API endpoint

Return Value

ResponseInterface

protected AbstractSocketConfig newSocketConfig()

Instantiate IBS SocketConfig

Return Value

AbstractSocketConfig

AbstractClient setDefaultLogger()

Set default IBS logger

Return Value

AbstractClient

AbstractClient setCustomLogger(LoggerInterface $customLogger)

Set custom logger to use instead of the default one.

Create your own class implementing \CNIC\LoggerInterface.

Parameters

LoggerInterface $customLogger

Return Value

AbstractClient

AbstractClient enableDebugMode()

Enable debug output to STDOUT

Return Value

AbstractClient

AbstractClient disableDebugMode()

Disable debug output

Return Value

AbstractClient

string getPOSTData(array $cmd, bool $secured = false)

Serialize given command for POST request including connection configuration data

Parameters

array $cmd

API command to encode

bool $secured

secure password (when used for output)

Return Value

string

string|null getSession()

Get the API Session ID that is currently set Note: not supported.

Return Value

string|null

Exceptions

Exception

string getURL()

Get the API connection url that is currently set

Return Value

string

AbstractClient setUserAgent(string $str, string $rv, array $modules = [])

Set a custom user agent (for platforms that use this SDK)

Parameters

string $str

user agent label

string $rv

user agent revision

array $modules

further modules to add to user agent string

Return Value

AbstractClient

string getUserAgent()

Get the user agent string

Return Value

string

AbstractClient setProxy(string $proxy = "")

Set proxy to use for API communication

Parameters

string $proxy

proxy to use (optional, for reset)

Return Value

AbstractClient

string|null getProxy()

Get proxy configuration for API communication

Return Value

string|null

AbstractClient setReferer(string $referer = "")

Set Referer to use for API communication

Parameters

string $referer

Referer (optional, for reset)

Return Value

AbstractClient

string|null getReferer()

Get Referer configuration for API communication

Return Value

string|null

string getVersion()

Get the current module version

Return Value

string

AbstractClient setURL(string $value)

Set another connection url to be used for API communication

Parameters

string $value

API connection url to set

Return Value

AbstractClient

AbstractClient setSession(string $value = "")

Set an API session id to be used for API communication

Parameters

string $value

API session id (optional, for reset)

Return Value

AbstractClient

Exceptions

Exception

AbstractClient setCredentials(string $uid = "", string $pw = "")

Set Credentials to be used for API communication

Parameters

string $uid

account name (optional, for reset)

string $pw

account password (optional, for reset)

Return Value

AbstractClient

AbstractClient setRoleCredentials(string $uid = "", string $role = "", string $pw = "")

Set Role Credentials to be used for API communication Note: not supported.

Parameters

string $uid

account name (optional, for reset)

string $role

role user id (optional, for reset)

string $pw

role user password (optional, for reset)

Return Value

AbstractClient

Exceptions

Exception

AbstractClient useHighPerformanceConnectionSetup()

Activate High Performance Setup Note: not supported.

Return Value

AbstractClient

Exceptions

Exception

array IDNConvert(array $domains)

Convert domain names to idn + punycode if necessary

Parameters

array $domains

list of domain names (or tlds)

Return Value

array

protected array autoIDNConvert(array $cmd)

Auto convert API command parameters to punycode, if necessary.

Note: IBS handles IDN conversion server-side.

Parameters

array $cmd

API command

Return Value

array

protected array executeCurl(string $data, array $cfg, array $extraCurlOpts = [])

Delegate cURL execution to the transport layer.

Parameters

string $data

serialized POST payload

array $cfg

connection config

array $extraCurlOpts

additional cURL options merged over the defaults

Return Value

array

[rawResponse, errorMessage|null]

void close()

Close all cURL connections

Return Value

void

string getLiveUrl()

Get LIVE system URL

Return Value

string

bool isOTE()

Check whether the client is connected to the OT&E system

Return Value

bool

AbstractClient useOTESystem()

Set OT&E System for API communication

Return Value

AbstractClient

AbstractClient useLIVESystem()

Set LIVE System for API communication (this is the default setting)

Return Value

AbstractClient

AbstractClient setContext(array $context)

Set context data for the client

Parameters

array $context

Return Value

AbstractClient