BasicHTTPClient
in package
implements
HTTPClient
The HTTP part of the Amadeus API client.
Interfaces, Classes, Traits and Enums
Table of Contents
- $accessToken : AccessToken|null
- $configuration : Configuration
- The configuration for this API client.
- $sslCertificate : string|null
- The ssl certificate for this API client.
- __construct() : mixed
- execute() : Response
- Execute HTTP Request using PHP-cURL extension
- getAccessToken() : AccessToken|null
- getConfiguration() : Configuration
- getSSLCertificate() : string|null
- getWithArrayParams() : Response
- A helper module for making generic getWithArrayParams requests calls.It is used by every namespaced API getWithArrayParams method.
- getWithOnlyPath() : Response
- A helper module for making generic getWithOnlyPath requests calls.It is used by every namespaced API getWithOnlyPath method.
- postWithStringBody() : Response
- A helper module for making generic postWithStringBody requests calls.It is used by every namespaced API postWithStringBody method.
- setSSLCertificate() : void
- detectError() : void
- Detect error based on the returned status code
- log() : void
- A simple log only triggered if in debug mode
- setCurlOptions() : void
- Set curl options
Properties
$accessToken
protected
AccessToken|null
$accessToken
= null
$configuration
The configuration for this API client.
private
Configuration
$configuration
$sslCertificate
The ssl certificate for this API client.
private
string|null
$sslCertificate
= null
Methods
__construct()
public
__construct(Configuration $configuration) : mixed
Parameters
- $configuration : Configuration
Return values
mixed —execute()
Execute HTTP Request using PHP-cURL extension
public
execute(Request $request) : Response
Parameters
- $request : Request
Tags
Return values
Response —getAccessToken()
public
getAccessToken() : AccessToken|null
Return values
AccessToken|null —getConfiguration()
public
getConfiguration() : Configuration
Return values
Configuration —getSSLCertificate()
public
getSSLCertificate() : string|null
Return values
string|null —getWithArrayParams()
A helper module for making generic getWithArrayParams requests calls.It is used by every namespaced API getWithArrayParams method.
public
getWithArrayParams(string $path, array<string|int, mixed> $params) : Response
$amadeus->getAirport()->getDirectDestinations()->get( ["departureAirportCode" => "MAD", "max" => 2] );
It can be used to make any generic API call that is automatically authenticated using your API credentials:
$this->amadeus->getClient()->getWithArrayParams(
'/v1/airport/direct-destinations',
["departureAirportCode" => "MAD", "max" => 2]
);
Parameters
- $path : string
- $params : array<string|int, mixed>
Tags
Return values
Response —getWithOnlyPath()
A helper module for making generic getWithOnlyPath requests calls.It is used by every namespaced API getWithOnlyPath method.
public
getWithOnlyPath(string $path) : Response
$amadeus->getShopping()->getHotelOffer("XXX")->get();
It can be used to make any generic API call that is automatically authenticated using your API credentials:
$this->amadeus->getClient()->getWithOnlyPath("/v3/shopping/hotel-offers"."/"."XXX");
Parameters
- $path : string
Tags
Return values
Response —postWithStringBody()
A helper module for making generic postWithStringBody requests calls.It is used by every namespaced API postWithStringBody method.
public
postWithStringBody(string $path, string $body[, array<string|int, mixed>|null $params = null ]) : Response
$flightOffers = $amadeus->getShopping()->getFlightOffers()->post($body);
It can be used to make any generic API call that is automatically authenticated using your API credentials:
$amadeus->getClient()->postWithStringBody(
'/v2/shopping/flight-offers',
$body
);
Parameters
- $path : string
- $body : string
- $params : array<string|int, mixed>|null = null
Tags
Return values
Response —setSSLCertificate()
public
setSSLCertificate(string $filePath) : void
Parameters
- $filePath : string
Return values
void —detectError()
Detect error based on the returned status code
protected
detectError(Response $response) : void
Parameters
- $response : Response
Tags
Return values
void —log()
A simple log only triggered if in debug mode
private
log(string $message) : void
Parameters
- $message : string
Return values
void —setCurlOptions()
Set curl options
private
setCurlOptions(mixed $curlHandle, Request $request) : void
Parameters
- $curlHandle : mixed
- $request : Request