Documentation

Api
in package

Class API.

Api php Client Binding API; representation of a Api server. Call instance methods upon this object to communicate with particular Api server endpoints. Aside from ping() and info(), most of the methods require the construction of either a DocumentParameters object or an NameTranslationParameters object. These provide the content data that will be processed by the service.

usage example: $api = new API($service_url, $user_key)

Tags
see
_construct()

Table of Contents

Properties

$binding_version  : string
Compatible server version.
$customHeaders  : array<string|int, mixed>
internal customHeaders array
$debug  : bool
More verbose output).
$headers  : array<string|int, mixed>
HTTP headers for Analytics API.
$max_retries  : int
The maximum retries for server connect
$ms_between_retries  : int
The millisecond sleep time between retries
$options  : array<string|int, mixed>
internal options array
$request  : RosetteRequest
internal Request object
$response_code  : string
response code
$service_url  : string
URL of the Analytics API (or test server).
$subUrl  : null|string
Endpoint for the operation.
$timeout  : null|int
The maximum time in seconds to wait for the response to arrive
$url_params  : array<string|int, mixed>
Parameters for the URL query.
$user_key  : null|string
User key (required for Analytics API).

Methods

__construct()  : mixed
Create an L{API} object.
addressSimilarity()  : mixed
Calls the addressSimilarity endpoint
categories()  : mixed
Calls the categories endpoint.
clearCustomHeaders()  : mixed
Clears all custom headers
clearOptions()  : mixed
Clears all options
clearUrlParams()  : mixed
Clears all URL extension parameters.
entities()  : mixed
Calls the entities endpoint.
events()  : mixed
Calls the events endpoint.
getBindingVersion()  : mixed
Returns the binding version
getCustomHeaders()  : array<string|int, mixed>
Setter for options
getDebug()  : bool
Retrieves debug setting (more verbose output).
getOption()  : string
Getter for options
getResponseCode()  : mixed
Returns response code.
getResponseHeader()  : mixed
getServiceUrl()  : string
Getter for the service_url.
getUrlParam()  : string
Getter for the URL parameter with the specified name
getUserAgent()  : mixed
Returns the string used for User-Agent
info()  : mixed
Calls the info endpoint.
language()  : mixed
Calls the language endpoint.
morphology()  : mixed
Calls the morphology endpoint.
nameDeduplication()  : mixed
Calls the name deduplication endpoint.
nameSimilarity()  : mixed
Calls the name similarity endpoint.
nameTranslation()  : mixed
Calls the name translation endpoint.
ping()  : mixed
Calls the Ping endpoint.
recordSimilarity()  : mixed
Calls the record similarity endpoint.
relationships()  : mixed
Calls the relationships endpoint.
semanticVectors()  : mixed
Calls the semantic vectors endpoint.
sentences()  : mixed
Calls the sentences endpoint.
sentiment()  : mixed
Calls the sentiment endpoint.
setCustomHeader()  : mixed
Setter for custom header
setDebug()  : mixed
Enables debug (more verbose output).
setMaxRetries()  : mixed
Sets the maximum retries for server connect
setMillisecondsBetweenRetries()  : mixed
Sets the millisecond sleep time between retries
setMockRequest()  : mixed
Sets on override Request for mocking purposes
setOption()  : mixed
Setter for options
setResponseCode()  : mixed
Sets the response code.
setServiceUrl()  : mixed
Setter for the service_url.
setTimeout()  : mixed
Sets the maximum time in seconds to wait for the response to arrive
setUrlParam()  : mixed
Setter for an additional query parameter to the Analytics API URL.
similarTerms()  : mixed
Calls the similarTerms endpoint
syntaxDependencies()  : mixed
Calls the syntax/dependencies endpoint
textEmbedding()  : mixed
Calls the text-embedding endpoint.
tokens()  : mixed
Calls the tokens endpoint.
topics()  : mixed
Calls the topics endpoint
transliteration()  : mixed
Calls the transliteration endpoint
addHeaders()  : array<string|int, mixed>
Adds custom headers to headers array if there are any
callEndpoint()  : mixed
Internal operations processor for most of the endpoints.
getValueFromArray()  : string
Gets the value of the item with key $name in the array if it exists
makeRequest()  : string
function makeRequest.

Properties

$binding_version

Compatible server version.

private static string $binding_version = '1.31.0'

$customHeaders

internal customHeaders array

private array<string|int, mixed> $customHeaders

$debug

More verbose output).

private bool $debug

$headers

HTTP headers for Analytics API.

private array<string|int, mixed> $headers

$max_retries

The maximum retries for server connect

private int $max_retries

$ms_between_retries

The millisecond sleep time between retries

private int $ms_between_retries

$options

internal options array

private array<string|int, mixed> $options

$response_code

response code

private string $response_code

$service_url

URL of the Analytics API (or test server).

private string $service_url

$subUrl

Endpoint for the operation.

private null|string $subUrl

$timeout

The maximum time in seconds to wait for the response to arrive

private null|int $timeout

$url_params

Parameters for the URL query.

private array<string|int, mixed> $url_params

$user_key

User key (required for Analytics API).

private null|string $user_key

Methods

__construct()

Create an L{API} object.

public __construct(string $user_key[, string $service_url = 'https://analytics.babelstreet.com/rest/v1/' ]) : mixed
Parameters
$user_key : string

An authentication string to be sent as user_key with all requests.

$service_url : string = 'https://analytics.babelstreet.com/rest/v1/'

URL of the Api API

addressSimilarity()

Calls the addressSimilarity endpoint

public addressSimilarity(mixed $params) : mixed
Parameters
$params : mixed
Tags
throws
RosetteException

categories()

Calls the categories endpoint.

public categories(mixed $params) : mixed
Parameters
$params : mixed
Tags
throws
RosetteException

clearCustomHeaders()

Clears all custom headers

public clearCustomHeaders() : mixed

clearOptions()

Clears all options

public clearOptions() : mixed

clearUrlParams()

Clears all URL extension parameters.

public clearUrlParams() : mixed

entities()

Calls the entities endpoint.

public entities(mixed $params) : mixed
Parameters
$params : mixed
Tags
throws
RosetteException

events()

Calls the events endpoint.

public events(mixed $params) : mixed
Parameters
$params : mixed
Tags
throws
RosetteException

getBindingVersion()

Returns the binding version

public getBindingVersion() : mixed

getCustomHeaders()

Setter for options

public getCustomHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed>

getDebug()

Retrieves debug setting (more verbose output).

public getDebug() : bool
Return values
bool

getOption()

Getter for options

public getOption(string $name) : string
Parameters
$name : string
Return values
string

getResponseCode()

Returns response code.

public getResponseCode() : mixed

getResponseHeader()

public getResponseHeader() : mixed

getServiceUrl()

Getter for the service_url.

public getServiceUrl() : string
Return values
string

getUrlParam()

Getter for the URL parameter with the specified name

public getUrlParam(string $param_name) : string
Parameters
$param_name : string
Return values
string

getUserAgent()

Returns the string used for User-Agent

public getUserAgent() : mixed

language()

Calls the language endpoint.

public language(mixed $params) : mixed
Parameters
$params : mixed
Tags
throws
RosetteException

morphology()

Calls the morphology endpoint.

public morphology(mixed $params[, string|null $facet = null ]) : mixed
Parameters
$params : mixed
$facet : string|null = null
Tags
throws
RosetteException

nameDeduplication()

Calls the name deduplication endpoint.

public nameDeduplication(mixed $nameDeduplicationParams) : mixed
Parameters
$nameDeduplicationParams : mixed
Tags
throws
RosetteException

nameSimilarity()

Calls the name similarity endpoint.

public nameSimilarity(mixed $nameSimilarityParams) : mixed
Parameters
$nameSimilarityParams : mixed
Tags
throws
RosetteException

nameTranslation()

Calls the name translation endpoint.

public nameTranslation(mixed $nameTranslationParams) : mixed
Parameters
$nameTranslationParams : mixed
Tags
throws
RosetteException

ping()

Calls the Ping endpoint.

public ping() : mixed
Tags
throws
RosetteException

recordSimilarity()

Calls the record similarity endpoint.

public recordSimilarity(mixed $recordSimilarityParams) : mixed
Parameters
$recordSimilarityParams : mixed
Tags
throws
RosetteException

relationships()

Calls the relationships endpoint.

public relationships(mixed $params) : mixed
Parameters
$params : mixed
Tags
throws
RosetteException

semanticVectors()

Calls the semantic vectors endpoint.

public semanticVectors(mixed $params) : mixed
Parameters
$params : mixed
Tags
throws
RosetteException

sentences()

Calls the sentences endpoint.

public sentences(mixed $params) : mixed
Parameters
$params : mixed
Tags
throws
RosetteException

sentiment()

Calls the sentiment endpoint.

public sentiment(mixed $params) : mixed
Parameters
$params : mixed
Tags
throws
RosetteException

setCustomHeader()

Setter for custom header

public setCustomHeader(string $header[, string $value = null ]) : mixed
Parameters
$header : string
$value : string = null

setDebug()

Enables debug (more verbose output).

public setDebug(bool $debug) : mixed
Parameters
$debug : bool

setMaxRetries()

Sets the maximum retries for server connect

public setMaxRetries(mixed $max_retries) : mixed
Parameters
$max_retries : mixed

setMillisecondsBetweenRetries()

Sets the millisecond sleep time between retries

public setMillisecondsBetweenRetries(mixed $ms_between_retries) : mixed
Parameters
$ms_between_retries : mixed

setMockRequest()

Sets on override Request for mocking purposes

public setMockRequest(mixed $requestObject) : mixed
Parameters
$requestObject : mixed

setOption()

Setter for options

public setOption(string $name, string $value) : mixed
Parameters
$name : string
$value : string

setResponseCode()

Sets the response code.

public setResponseCode(mixed $response_code) : mixed
Parameters
$response_code : mixed

setServiceUrl()

Setter for the service_url.

public setServiceUrl(mixed $url) : mixed
Parameters
$url : mixed

setTimeout()

Sets the maximum time in seconds to wait for the response to arrive

public setTimeout(int $timeout) : mixed
Parameters
$timeout : int

setUrlParam()

Setter for an additional query parameter to the Analytics API URL.

public setUrlParam(string $param_name, string $param_value) : mixed
Parameters
$param_name : string

(e.g. output)

$param_value : string

(e.g. rosette)

similarTerms()

Calls the similarTerms endpoint

public similarTerms(mixed $params) : mixed
Parameters
$params : mixed
Tags
throws
RosetteException

syntaxDependencies()

Calls the syntax/dependencies endpoint

public syntaxDependencies(mixed $params) : mixed
Parameters
$params : mixed
Tags
throws
RosetteException

textEmbedding()

Calls the text-embedding endpoint.

public textEmbedding(mixed $params) : mixed

Deprecated. Please use semanticVectors instead

Parameters
$params : mixed
Tags
throws
RosetteException

tokens()

Calls the tokens endpoint.

public tokens(mixed $params) : mixed
Parameters
$params : mixed
Tags
throws
RosetteException

topics()

Calls the topics endpoint

public topics(mixed $params) : mixed
Parameters
$params : mixed
Tags
throws
RosetteException

transliteration()

Calls the transliteration endpoint

public transliteration(mixed $params) : mixed
Parameters
$params : mixed
Tags
throws
RosetteException

addHeaders()

Adds custom headers to headers array if there are any

private addHeaders(array<string|int, mixed> $headers) : array<string|int, mixed>
Parameters
$headers : array<string|int, mixed>
Return values
array<string|int, mixed>

$headers

callEndpoint()

Internal operations processor for most of the endpoints.

private callEndpoint(mixed $parameters, mixed $subUrl) : mixed
Parameters
$parameters : mixed
$subUrl : mixed
Tags
throws
RosetteException

getValueFromArray()

Gets the value of the item with key $name in the array if it exists

private getValueFromArray(string $name, array<string|int, mixed> $array) : string
Parameters
$name : string
$array : array<string|int, mixed>
Return values
string

makeRequest()

function makeRequest.

private makeRequest(mixed $url, mixed $headers, mixed $data, mixed $method) : string

Encapsulates the GET/POST

Parameters
$url : mixed
$headers : mixed
$data : mixed
$method : mixed
Tags
throws
RosetteException
Return values
string

        
On this page

Search results