Overview

Namespaces

  • ApiAxle
    • Api
    • Shared
  • ApiAxleTest
    • Api
    • Shared
  • PHP

Classes

  • Api
  • Key
  • Keyring
  • Overview
  • Namespace
  • Class
  • Tree
  • Todo

Class Key

ApiAxle\Api\Key class

Wraps Key related calls to the ApiAxle API

Namespace: ApiAxle\Api
Author: Phillip Shipley <phillip@phillipshipley.com>
Located at src/ApiAxle/Api/Key.php
Methods summary
public
# __construct( array $config = false, string $key = false )

Construct a new Key object

Construct a new Key object

If a $key is provided, it will be fetched from the ApiAxle API and properties will be set accordingly.

Parameters

$config
array
$config
$key
string
$key
public string
# getKey( )

Return current key value

Return current key value

Returns

string
public
# setKey( string $key )

Set key value

Set key value

Parameters

$key
string
$key
public ApiAxle\Api\Key
# setData( array $data )

Set object properties

Set object properties

Parameters

$data
array
$data

Returns

ApiAxle\Api\Key
public array
# getData( )

Get API settings as array

Get API settings as array

Returns

array
public array
# getDataForApiCall( )

Get an array of only the fields needed for an API call (ignore created/updated, etc.)

Get an array of only the fields needed for an API call (ignore created/updated, etc.)

Returns

array
public ApiAxle\Api\Key
# get( string $key )

Fetch key information from ApiAxle API and update object properties

Fetch key information from ApiAxle API and update object properties

Parameters

$key
string
$key

Returns

ApiAxle\Api\Key
public ApiAxle\Api\Key
# create( string $key, array $data = false )

Create a new key

Create a new key

Parameters

$key
string
$key
$data
array
$data

Returns

ApiAxle\Api\Key

Throws

ErrorException
public ApiAxle\Api\Key
# update( array $data )

Update a key

Update a key

Parameters

$data
array
$data

Returns

ApiAxle\Api\Key

Throws

ErrorException
public boolean
# delete( string $key = false )

Delete a key

Delete a key

Parameters

$key
string
$key

Returns

boolean

Throws

Exception
ErrorException
public ApiAxle\Shared\ItemList
# getList( integer $from = 0, integer $to = 100, string $resolve = 'true' )

Get a list of all Keys

Get a list of all Keys

Parameters $from and $to are used for pagination of results

Parameters

$from
integer
$from
$to
integer
$to
$resolve
string
$resolve

Returns

ApiAxle\Shared\ItemList
public ApiAxle\Shared\ItemList
# getApiList( string $resolve = 'true' )

Get a list of APIs that this Key has access to

Get a list of APIs that this Key has access to

Parameters

$resolve
string
$resolve Wether or not to also get API details

Returns

ApiAxle\Shared\ItemList

Throws

Exception
ErrorException
public stdClass
# getApiCharts( string $granularity = 'minute' )

Get most used APIs for this key

Get most used APIs for this key

Parameters

$granularity
string
$granularity Options are second, minute, hour, day

Returns

stdClass

Throws

Exception
Exception
public type
# getStats( integer $timestart = false, integer $timeend = false, string $granularity = 'minute', string $format_timeseries = 'true', string $format_timestamp = 'epoch_seconds', ApiAxle\Api\Api $forapi = false )

Get real time hits for a key

Get real time hits for a key

Parameters

$timestart
integer
$timestart
$timeend
integer
$timeend
$granularity
string
$granularity
$format_timeseries
string
$format_timeseries
$format_timestamp
string
$format_timestamp
$forapi
ApiAxle\Api\Api
$forapi

Returns

type

Throws

Exception
public stdClass
# getCharts( string $granularity = 'minute' )

Get most used keys and their stats

Get most used keys and their stats

Parameters

$granularity
string
$granularity Options are second, minute, hour, day

Returns

stdClass

Throws

Exception
public ApiAxle\Shared\Config
# getConfig( )

Return config object

Return config object

Returns

ApiAxle\Shared\Config
public boolean
# isValid( )

Validate that required fields are set before attempting to provision/update

Validate that required fields are set before attempting to provision/update

Returns

boolean

Throws

Exception
Properties summary
protected ApiAxle\Shared\Config $config
#

Configuration data

Configuration data

protected string $key
#

The actual api key

The actual api key

protected integer $createdAt
#

Created at timestamp. Set automatically when creating a new key.

Created at timestamp. Set automatically when creating a new key.

protected integer $updatedAt
#

Updated at timestamp. Set automatically whenever updating a key.

Updated at timestamp. Set automatically whenever updating a key.

protected string $sharedSecret
#

(optional) A shared secret which is used when signing a call to the api.

(optional) A shared secret which is used when signing a call to the api.

protected integer $qpd 172800
#

(default: 172800) Number of queries that can be called per day. Set to -1 for no limit.

(default: 172800) Number of queries that can be called per day. Set to -1 for no limit.

protected integer $qps 2
#

(default: 2) Number of queries that can be called per second. Set to -1 for no limit.

(default: 2) Number of queries that can be called per second. Set to -1 for no limit.

protected array $forApis
#

(optional) Names of the Apis that this key belongs to.

(optional) Names of the Apis that this key belongs to.

protected boolean $disabled false
#

(default: false) Disable this API causing errors when it's hit.

(default: false) Disable this API causing errors when it's hit.

protected string $isNSA 'false'
#

(default: false) If you're the NSA set this flag to true and you'll activate GOD mode getting you into any API regardless of your being linked to it or not.

(default: false) If you're the NSA set this flag to true and you'll activate GOD mode getting you into any API regardless of your being linked to it or not.

fillup/apiaxle API documentation generated by ApiGen 2.8.0