Connector
in package
implements
LoggerAwareInterface
Uses
LoggerAwareTrait
LibGuides connector.
Tags
Interfaces, Classes, Traits and Enums
- LoggerAwareInterface
Table of Contents
- $client : Client
- The HTTP_Request object used for API transactions
- $apiVersion : float
- API version number
- $displayDescription : bool
- Optionally load & display the description of each resource
- $host : string
- Base URL for API
- $iid : string
- Institution code
- __construct() : mixed
- Constructor
- query() : array<string|int, mixed>
- Execute a search. Adds all the querystring parameters into $this->client and returns the parsed response
- call() : object
- Small wrapper for sendRequest, process to simplify error handling.
- debug() : void
- Log a debug message.
- log() : void
- Send a message to the logger.
- logError() : void
- Log an error message.
- logWarning() : void
- Log a warning message.
- prepareParams() : array<string|int, mixed>
- Prepare API parameters
- process() : array<string|int, mixed>
- Translate API response into more convenient format.
Properties
$client
The HTTP_Request object used for API transactions
public
Client
$client
$apiVersion
API version number
protected
float
$apiVersion
$displayDescription
Optionally load & display the description of each resource
protected
bool
$displayDescription
$host
Base URL for API
protected
string
$host
$iid
Institution code
protected
string
$iid
Methods
__construct()
Constructor
public
__construct(string $iid, Client $client[, float $apiVersion = 1 ][, string $baseUrl = null ][, bool $displayDescription = false ]) : mixed
Sets up the LibGuides Client
Parameters
- $iid : string
-
Institution ID
- $client : Client
-
HTTP client
- $apiVersion : float = 1
-
API version number
- $baseUrl : string = null
-
API base URL (optional)
- $displayDescription : bool = false
-
Optionally load & display the description of each resource
Return values
mixed —query()
Execute a search. Adds all the querystring parameters into $this->client and returns the parsed response
public
query(array<string|int, mixed> $params, int $offset[, int $limit = 20 ][, bool $returnErr = true ]) : array<string|int, mixed>
Parameters
- $params : array<string|int, mixed>
-
Incoming search parameters.
- $offset : int
-
Search offset
- $limit : int = 20
-
Search limit
- $returnErr : bool = true
-
Should we return errors in a structured way (true) or simply throw an exception (false)?
Tags
Return values
array<string|int, mixed> —An array of query results
call()
Small wrapper for sendRequest, process to simplify error handling.
protected
call(string $qs[, string $method = 'GET' ]) : object
Parameters
- $qs : string
-
Query string
- $method : string = 'GET'
-
HTTP method
Tags
Return values
object —The parsed data
debug()
Log a debug message.
protected
debug(string $msg[, array<string|int, mixed> $context = [] ][, bool $prependClass = true ]) : void
Parameters
- $msg : string
-
Log message
- $context : array<string|int, mixed> = []
-
Log context
- $prependClass : bool = true
-
Prepend class name to message?
Return values
void —log()
Send a message to the logger.
protected
log(string $level, string $message[, array<string|int, mixed> $context = [] ][, bool $prependClass = false ]) : void
Parameters
- $level : string
-
Log level
- $message : string
-
Log message
- $context : array<string|int, mixed> = []
-
Log context
- $prependClass : bool = false
-
Prepend class name to message?
Return values
void —logError()
Log an error message.
protected
logError(string $msg[, array<string|int, mixed> $context = [] ][, bool $prependClass = true ]) : void
Parameters
- $msg : string
-
Log message
- $context : array<string|int, mixed> = []
-
Log context
- $prependClass : bool = true
-
Prepend class name to message?
Return values
void —logWarning()
Log a warning message.
protected
logWarning(string $msg[, array<string|int, mixed> $context = [] ][, bool $prependClass = true ]) : void
Parameters
- $msg : string
-
Log message
- $context : array<string|int, mixed> = []
-
Log context
- $prependClass : bool = true
-
Prepend class name to message?
Return values
void —prepareParams()
Prepare API parameters
protected
prepareParams(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
- $params : array<string|int, mixed>
-
Incoming parameters
Return values
array<string|int, mixed> —process()
Translate API response into more convenient format.
protected
process(array<string|int, mixed> $data) : array<string|int, mixed>
Parameters
- $data : array<string|int, mixed>
-
The raw response
Return values
array<string|int, mixed> —The processed response