本文整理汇总了PHP中Swagger\Client\ApiClient类的典型用法代码示例。如果您正苦于以下问题:PHP ApiClient类的具体用法?PHP ApiClient怎么用?PHP ApiClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ApiClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*
* @param \Swagger\Client\ApiClient|null $apiClient The api client to use
*/
public function __construct(\Swagger\Client\ApiClient $apiClient = null)
{
if ($apiClient == null) {
$apiClient = new ApiClient();
$apiClient->getConfig()->setHost('http://example.com/rest/default');
}
$this->apiClient = $apiClient;
}
示例2: ApiClient
/**
* Constructor
* @param \Swagger\Client\ApiClient|null $apiClient The api client to use
*/
function __construct($apiClient = null)
{
if ($apiClient == null) {
$apiClient = new ApiClient();
$apiClient->getConfig()->setHost('https://localhost/');
}
$this->apiClient = $apiClient;
}
示例3: __construct
/**
* Constructor
*
* @param \Swagger\Client\ApiClient|null $apiClient The api client to use
*/
public function __construct(\Swagger\Client\ApiClient $apiClient = null)
{
if ($apiClient === null) {
$apiClient = new ApiClient();
$apiClient->getConfig()->setHost('http://petstore.swagger.io/v2');
}
$this->apiClient = $apiClient;
}
示例4: complaintsComplaintsWithHttpInfo
/**
* complaintsComplaintsWithHttpInfo
*
* Complaints: Free service (with registration), providing community and government complaint lookup by phone number for up to 2,000 queries per month. Details include number complaint rates from (FTC, FCC, IRS, Indiana Attorney General) and key entity tag extractions from complaints.
*
* @param string $phone_number phone number to search (required)
* @return Array of \Swagger\Client\Model\Complaints, HTTP status code, HTTP response headers (array of strings)
* @throws \Swagger\Client\ApiException on non-2xx response
*/
public function complaintsComplaintsWithHttpInfo($phone_number)
{
// verify the required parameter 'phone_number' is set
if ($phone_number === null) {
throw new \InvalidArgumentException('Missing the required parameter $phone_number when calling complaintsComplaints');
}
// parse inputs
$resourcePath = "/api/2015-11-01/Complaints/{phoneNumber}";
$httpBody = '';
$queryParams = array();
$headerParams = array();
$formParams = array();
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'text/json', 'application/xml', 'text/xml'));
if (!is_null($_header_accept)) {
$headerParams['Accept'] = $_header_accept;
}
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
// path params
if ($phone_number !== null) {
$resourcePath = str_replace("{" . "phoneNumber" . "}", $this->apiClient->getSerializer()->toPathValue($phone_number), $resourcePath);
}
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody;
// $_tempBody is the method argument, if present
} elseif (count($formParams) > 0) {
$httpBody = $formParams;
// for HTTP post (form)
}
// make the API Call
try {
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi($resourcePath, 'GET', $queryParams, $httpBody, $headerParams, '\\Swagger\\Client\\Model\\Complaints');
if (!$response) {
return array(null, $statusCode, $httpHeader);
}
return array(\Swagger\Client\ObjectSerializer::deserialize($response, '\\Swagger\\Client\\Model\\Complaints', $httpHeader), $statusCode, $httpHeader);
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\Complaints', $e->getResponseHeaders());
$e->setResponseObject($data);
break;
}
throw $e;
}
}
示例5: clienresBranchGet
/**
* clienresBranchGet
*
* Clientes por Sucursal
*
* @param double $start_latitude Latitude component of start location. (required)
* @param double $start_longitude Longitude component of start location. (required)
* @param double $end_latitude Latitude component of end location. (required)
* @param double $end_longitude Longitude component of end location. (required)
* @return \Swagger\Client\Model\Cliente[]
* @throws \Swagger\Client\ApiException on non-2xx response
*/
public function clienresBranchGet($start_latitude, $start_longitude, $end_latitude, $end_longitude)
{
// verify the required parameter 'start_latitude' is set
if ($start_latitude === null) {
throw new \InvalidArgumentException('Missing the required parameter $start_latitude when calling clienresBranchGet');
}
// verify the required parameter 'start_longitude' is set
if ($start_longitude === null) {
throw new \InvalidArgumentException('Missing the required parameter $start_longitude when calling clienresBranchGet');
}
// verify the required parameter 'end_latitude' is set
if ($end_latitude === null) {
throw new \InvalidArgumentException('Missing the required parameter $end_latitude when calling clienresBranchGet');
}
// verify the required parameter 'end_longitude' is set
if ($end_longitude === null) {
throw new \InvalidArgumentException('Missing the required parameter $end_longitude when calling clienresBranchGet');
}
// parse inputs
$resourcePath = "/clienres/branch";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$httpBody = '';
$queryParams = array();
$headerParams = array();
$formParams = array();
$_header_accept = ApiClient::selectHeaderAccept(array('application/json'));
if (!is_null($_header_accept)) {
$headerParams['Accept'] = $_header_accept;
}
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
// query params
if ($start_latitude !== null) {
$queryParams['start_latitude'] = $this->apiClient->getSerializer()->toQueryValue($start_latitude);
}
// query params
if ($start_longitude !== null) {
$queryParams['start_longitude'] = $this->apiClient->getSerializer()->toQueryValue($start_longitude);
}
// query params
if ($end_latitude !== null) {
$queryParams['end_latitude'] = $this->apiClient->getSerializer()->toQueryValue($end_latitude);
}
// query params
if ($end_longitude !== null) {
$queryParams['end_longitude'] = $this->apiClient->getSerializer()->toQueryValue($end_longitude);
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody;
// $_tempBody is the method argument, if present
} else {
if (count($formParams) > 0) {
$httpBody = $formParams;
// for HTTP post (form)
}
}
// make the API Call
try {
list($response, $httpHeader) = $this->apiClient->callApi($resourcePath, $method, $queryParams, $httpBody, $headerParams, '\\Swagger\\Client\\Model\\Cliente[]');
if (!$response) {
return null;
}
return $this->apiClient->getSerializer()->deserialize($response, '\\Swagger\\Client\\Model\\Cliente[]', $httpHeader);
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\Cliente[]', $e->getResponseHeaders());
$e->setResponseObject($data);
break;
case 0:
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\Error', $e->getResponseHeaders());
$e->setResponseObject($data);
break;
}
throw $e;
}
return null;
}
示例6: syncschedule
/**
* syncschedule
*
*
*
* @param string $device_id The relay id (required)
* @param string $module_id The thermostat id (required)
* @param \Swagger\Client\Model\NAThermProgram $therm_program The thermostat program (zones, timetable and name) (required)
* @return \Swagger\Client\Model\NAOkResponse
* @throws \Swagger\Client\ApiException on non-2xx response
*/
public function syncschedule($device_id, $module_id, $therm_program)
{
// verify the required parameter 'device_id' is set
if ($device_id === null) {
throw new \InvalidArgumentException('Missing the required parameter $device_id when calling syncschedule');
}
// verify the required parameter 'module_id' is set
if ($module_id === null) {
throw new \InvalidArgumentException('Missing the required parameter $module_id when calling syncschedule');
}
// verify the required parameter 'therm_program' is set
if ($therm_program === null) {
throw new \InvalidArgumentException('Missing the required parameter $therm_program when calling syncschedule');
}
// parse inputs
$resourcePath = "/syncschedule";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST";
$httpBody = '';
$queryParams = array();
$headerParams = array();
$formParams = array();
$_header_accept = ApiClient::selectHeaderAccept(array());
if (!is_null($_header_accept)) {
$headerParams['Accept'] = $_header_accept;
}
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
// query params
if ($device_id !== null) {
$queryParams['device_id'] = $this->apiClient->getSerializer()->toQueryValue($device_id);
}
// query params
if ($module_id !== null) {
$queryParams['module_id'] = $this->apiClient->getSerializer()->toQueryValue($module_id);
}
// body params
$_tempBody = null;
if (isset($therm_program)) {
$_tempBody = $therm_program;
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody;
// $_tempBody is the method argument, if present
} else {
if (count($formParams) > 0) {
$httpBody = $formParams;
// for HTTP post (form)
}
}
//TODO support oauth
//TODO support oauth
// make the API Call
try {
list($response, $httpHeader) = $this->apiClient->callApi($resourcePath, $method, $queryParams, $httpBody, $headerParams, '\\Swagger\\Client\\Model\\NAOkResponse');
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\NAOkResponse', $httpHeader);
$e->setResponseObject($data);
break;
}
throw $e;
}
if (!$response) {
return null;
}
return $this->apiClient->getSerializer()->deserialize($response, '\\Swagger\\Client\\Model\\NAOkResponse');
}
示例7: getPetsWithHttpInfo
/**
* getPetsWithHttpInfo
*
* Get your pets
*
* @return Array of \Swagger\Client\Model\Animal, HTTP status code, HTTP response headers (array of strings)
* @throws \Swagger\Client\ApiException on non-2xx response
*/
public function getPetsWithHttpInfo()
{
// parse inputs
$resourcePath = "/pets";
$httpBody = '';
$queryParams = array();
$headerParams = array();
$formParams = array();
$_header_accept = ApiClient::selectHeaderAccept(array('application/json'));
if (!is_null($_header_accept)) {
$headerParams['Accept'] = $_header_accept;
}
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array('application/x-www-form-urlencoded'));
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody;
// $_tempBody is the method argument, if present
} elseif (count($formParams) > 0) {
$httpBody = $formParams;
// for HTTP post (form)
}
// make the API Call
try {
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi($resourcePath, 'GET', $queryParams, $httpBody, $headerParams, '\\Swagger\\Client\\Model\\Animal');
if (!$response) {
return array(null, $statusCode, $httpHeader);
}
return array(\Swagger\Client\ObjectSerializer::deserialize($response, '\\Swagger\\Client\\Model\\Animal', $httpHeader, 'className'), $statusCode, $httpHeader);
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\Animal', $e->getResponseHeaders());
$e->setResponseObject($data);
break;
}
throw $e;
}
}
示例8: signUpWithHttpInfo
/**
* signUpWithHttpInfo
*
* create a new user
*
* @param string $app_id ID of app (required)
* @param \Swagger\Client\Model\UserBody $body request body (required)
* @return Array of \Swagger\Client\Model\CloudUser, HTTP status code, HTTP response headers (array of strings)
* @throws \Swagger\Client\ApiException on non-2xx response
*/
public function signUpWithHttpInfo($app_id, $body)
{
// verify the required parameter 'app_id' is set
if ($app_id === null) {
throw new \InvalidArgumentException('Missing the required parameter $app_id when calling signUp');
}
// verify the required parameter 'body' is set
if ($body === null) {
throw new \InvalidArgumentException('Missing the required parameter $body when calling signUp');
}
// parse inputs
$resourcePath = "user/{app_id}/signup";
$httpBody = '';
$queryParams = array();
$headerParams = array();
$formParams = array();
$_header_accept = ApiClient::selectHeaderAccept(array('application/json'));
if (!is_null($_header_accept)) {
$headerParams['Accept'] = $_header_accept;
}
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array('application/json'));
// path params
if ($app_id !== null) {
$resourcePath = str_replace("{" . "app_id" . "}", $this->apiClient->getSerializer()->toPathValue($app_id), $resourcePath);
}
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);
// body params
$_tempBody = null;
if (isset($body)) {
$_tempBody = $body;
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody;
// $_tempBody is the method argument, if present
} elseif (count($formParams) > 0) {
$httpBody = $formParams;
// for HTTP post (form)
}
// make the API Call
try {
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi($resourcePath, 'POST', $queryParams, $httpBody, $headerParams, '\\Swagger\\Client\\Model\\CloudUser');
if (!$response) {
return array(null, $statusCode, $httpHeader);
}
return array(\Swagger\Client\ObjectSerializer::deserialize($response, '\\Swagger\\Client\\Model\\CloudUser', $httpHeader), $statusCode, $httpHeader);
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\CloudUser', $e->getResponseHeaders());
$e->setResponseObject($data);
break;
}
throw $e;
}
}
示例9: deliveryCreate
/**
* deliveryCreate
*
* Create a delivery
*
* @param string $order_id Order to create delivery for (required)
* @param string $delivery_id Unique ID of the delivery (required)
* @param string[] $products (required)
* @param \DateTime $delivered (required)
* @param bool $send_mail Whether to send email to customer or not for this shipment (optional)
* @return \Swagger\Client\Model\Delivery
* @throws \Swagger\Client\ApiException on non-2xx response
*/
public function deliveryCreate($order_id, $delivery_id, $products, $delivered, $send_mail = null)
{
// verify the required parameter 'order_id' is set
if ($order_id === null) {
throw new \InvalidArgumentException('Missing the required parameter $order_id when calling deliveryCreate');
}
// verify the required parameter 'delivery_id' is set
if ($delivery_id === null) {
throw new \InvalidArgumentException('Missing the required parameter $delivery_id when calling deliveryCreate');
}
// verify the required parameter 'products' is set
if ($products === null) {
throw new \InvalidArgumentException('Missing the required parameter $products when calling deliveryCreate');
}
// verify the required parameter 'delivered' is set
if ($delivered === null) {
throw new \InvalidArgumentException('Missing the required parameter $delivered when calling deliveryCreate');
}
// parse inputs
$resourcePath = "/api/orders/{order_id}/deliveries/";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST";
$httpBody = '';
$queryParams = array();
$headerParams = array();
$formParams = array();
$_header_accept = ApiClient::selectHeaderAccept(array());
if (!is_null($_header_accept)) {
$headerParams['Accept'] = $_header_accept;
}
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
// path params
if ($order_id !== null) {
$resourcePath = str_replace("{" . "order_id" . "}", $this->apiClient->getSerializer()->toPathValue($order_id), $resourcePath);
}
// form params
if ($delivery_id !== null) {
$formParams['delivery_id'] = $this->apiClient->getSerializer()->toFormValue($delivery_id);
}
// form params
if ($products !== null) {
$formParams['products'] = $this->apiClient->getSerializer()->toFormValue($products);
}
// form params
if ($delivered !== null) {
$formParams['delivered'] = $this->apiClient->getSerializer()->toFormValue($delivered);
}
// form params
if ($send_mail !== null) {
$formParams['send_mail'] = $this->apiClient->getSerializer()->toFormValue($send_mail);
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody;
// $_tempBody is the method argument, if present
} else {
if (count($formParams) > 0) {
// for HTTP post (form)
$httpBody = $formParams;
}
}
$apiKey = $this->apiClient->getApiKeyWithPrefix('Authorization');
if (isset($apiKey)) {
$headerParams['Authorization'] = $apiKey;
}
// make the API Call
try {
$response = $this->apiClient->callAPI($resourcePath, $method, $queryParams, $httpBody, $headerParams);
} catch (ApiException $e) {
switch ($e->getCode()) {
case 0:
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\Delivery');
$e->setResponseObject($data);
break;
}
throw $e;
}
if (!$response) {
return null;
}
$responseObject = $this->apiClient->getSerializer()->deserialize($response, '\\Swagger\\Client\\Model\\Delivery');
return $responseObject;
}
示例10: printInfoWithHttpInfo
/**
* printInfoWithHttpInfo
*
* Display API information
*
* @param bool $pretty_print_query_parameter Controls whether response is pretty-printed (with indentation and new lines) (optional, default to true)
* @param int $depth Controls the details depth of response objects. \nEg. GET /datacenters/[ID]\n\t- depth=0: only direct properties are included. Children (servers etc.) are not included\n\t- depth=1: direct properties and children references are included\n\t- depth=2: direct properties and children properties are included\n\t- depth=3: direct properties and children properties and children's children are included\n\t- depth=... and so on (optional, default to 0)
* @return Array of \Swagger\Client\Model\Info, HTTP status code, HTTP response headers (array of strings)
* @throws \Swagger\Client\ApiException on non-2xx response
*/
public function printInfoWithHttpInfo($pretty_print_query_parameter = null, $depth = null)
{
// parse inputs
$resourcePath = "/";
$httpBody = '';
$queryParams = array();
$headerParams = array();
$formParams = array();
$_header_accept = ApiClient::selectHeaderAccept(array('application/json'));
if (!is_null($_header_accept)) {
$headerParams['Accept'] = $_header_accept;
}
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array('*/*'));
// query params
if ($pretty_print_query_parameter !== null) {
$queryParams['Pretty print query parameter'] = $this->apiClient->getSerializer()->toQueryValue($pretty_print_query_parameter);
}
// query params
if ($depth !== null) {
$queryParams['depth'] = $this->apiClient->getSerializer()->toQueryValue($depth);
}
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody;
// $_tempBody is the method argument, if present
} elseif (count($formParams) > 0) {
$httpBody = $formParams;
// for HTTP post (form)
}
// make the API Call
try {
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi($resourcePath, 'GET', $queryParams, $httpBody, $headerParams, '\\Swagger\\Client\\Model\\Info');
if (!$response) {
return array(null, $statusCode, $httpHeader);
}
return array(\Swagger\Client\ObjectSerializer::deserialize($response, '\\Swagger\\Client\\Model\\Info', $httpHeader), $statusCode, $httpHeader);
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\Info', $e->getResponseHeaders());
$e->setResponseObject($data);
break;
default:
$data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\Error', $e->getResponseHeaders());
$e->setResponseObject($data);
break;
}
throw $e;
}
}
示例11: getmeasure
/**
* getmeasure
*
*
*
* @param string $access_token Your access token (required)
* @param string $device_id Id of the device whose module's measurements you want to retrieve. This _id can be found in the user's devices field. (required)
* @param string $scale Defines the time interval between two measurements.\nPossible values :\nmax -> every value stored will be returned\n30min -> 1 value every 30 minutes\n1hour -> 1 value every hour\n3hours -> 1 value every 3 hours\n1day -> 1 value per day\n1week -> 1 value per week\n1month -> 1 value per month (required)
* @param string[] $type Sets the type of measurement you want to retrieve.\nThe different types of measurements must be given in a comma separated list of strings.\nExample: type=\"Temperature,Humidity\"\nDepending on the device's type and the scale, different measurements are available:\nFor Weather Station :\n\n max -> Temperature, CO2, Humidity, Pressure, Noise, Rain (if\nmodule_id is a rain sensor)\n\n 30min, 1hour, 3hours -> Temperature, CO2, Humidity, Pressure,\nNoise, min_temp, max_temp, min_hum, max_hum, min_pressure, max_pressure, min_noise, max_noise, sum_rain (if module_id is a rain sensor)\n\n 1day, 1week, 1month -> Temperature, Co2, Humidity, Pressure, Noise,\nmin_temp, date_min_temp, max_temp, date_max_temp, min_hum, date_min_hum, max_hum, date_max_hum, min_pressure, date_min_pressure, max_pressure, date_max_pressure, min_noise, date_min_noise, max_noise, date_max_noise, date_min_co2, date_max_co2, sum_rain (if module_id is a rain sensor)\nPlease note, the measurements sent in the response will be in the same order as in this list.\nAll measurements are expressed in metric units:\n\n Temperature: Celsius\n\n Humidity: %\n\n Co2: ppm\n\n Pressure: mbar\n\n Noise: db\n\n Rain: mm\n\nFor Thermostat:\n\n max -> Temperature, Sp_Temperature, BoilerOn, BoilerOff\n\n 30min, 1hour, 3hours -> Temperature, Sp_Temperature, min_temp,\nmax_temp, sum_boiler_on, sum_boiler_off\n\n 1day, 1week, 1month -> Temperature, min_temp, date_min_temp,\nmax_temp, sum_boiler_on, sum_boiler_off\n\n where\n\nTemperature: Celsius\n\n Sp_Temperature (temperature setpoint): Celsius\n\n BoilerOn: Duration, since the previous data point, during which the\nboiler has been on (in seconds)\n\n BoilerOff : Duration, since the previous data point, during which\nthe boiler has been off (in seconds).\n\n sum_boiler_on: Total duration during which the boiler has been on,\nat a specific scale (in seconds).\n\n sum_boiler_off: Total duration during which the boiler has been\noff, at a specific scale (in seconds). (required)
* @param string $module_id If you don't specify any module_id you will retrieve the device's measurements. If you specify a module_id you will retrieve the module's measurements. (optional)
* @param int $date_begin Starting timestamp (utc) of the requested measurements.\nPlease note measurement retrieving is limited to 1024 measurements. (optional)
* @param int $date_end Ending timestamp (utc) of the request measurements.\nIf you want only the last measurement, do not provide date_begin, and set date_end to \"last\". (optional)
* @param int $limit Limits the number of measurements returned (default & max is 1024) (optional)
* @param bool $optimize Allows you to choose the format of the answer.\nIf you build a mobile app and bandwith usage is an issue, use optimize = true.\nUse optimize = false, for an easier parse. In this case, values are indexed by sorted timestamp.\nExample of un-optimized response :\n{\"status\": \"ok\", \n \"body\": {\n \"1347575400\": [18.3,39],\n \"1347586200\": [20.6,48]\n },\n\"time_exec\": 0.012136936187744}\nIf optimize is set true, measurements are returned as an array of series of regularly spaced measurements. Each series is defined by a beginning time beg_time and a step between measurements, step_time:\n{\"status\": \"ok\",\n \"body\": [\n {\"beg_time\": 1347575400,\n \"step_time\": 10800,\n \"value\": \n [[18.3,39],\n [ 20.6,48]]\n }],\n\"time_exec\": 0.014238119125366}\nDefault value is true. (optional)
* @param bool $real_time In scales higher than max, since the data is aggregated, the timestamps returned are by default offset by +(scale/2).\nFor instance, if you ask for measurements at a daily scale, you will receive data timestamped at 12:00 if real_time is set to false (default case), and timestamped at 00:00 if real_time is set to true.\nNB : The servers always store data with real_time set to true and data are offset by this parameter AFTER having being time-filtered, thus you could have data after date_end if real_time is set to false. (optional)
* @return \Swagger\Client\Model\NAMeasureResponse
* @throws \Swagger\Client\ApiException on non-2xx response
*/
public function getmeasure($access_token, $device_id, $scale, $type, $module_id = null, $date_begin = null, $date_end = null, $limit = null, $optimize = null, $real_time = null)
{
// verify the required parameter 'access_token' is set
if ($access_token === null) {
throw new \InvalidArgumentException('Missing the required parameter $access_token when calling getmeasure');
}
// verify the required parameter 'device_id' is set
if ($device_id === null) {
throw new \InvalidArgumentException('Missing the required parameter $device_id when calling getmeasure');
}
// verify the required parameter 'scale' is set
if ($scale === null) {
throw new \InvalidArgumentException('Missing the required parameter $scale when calling getmeasure');
}
// verify the required parameter 'type' is set
if ($type === null) {
throw new \InvalidArgumentException('Missing the required parameter $type when calling getmeasure');
}
// parse inputs
$resourcePath = "/api/getmeasure";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$httpBody = '';
$queryParams = array();
$headerParams = array();
$formParams = array();
$_header_accept = ApiClient::selectHeaderAccept(array());
if (!is_null($_header_accept)) {
$headerParams['Accept'] = $_header_accept;
}
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
// query params
if ($access_token !== null) {
$queryParams['access_token'] = $this->apiClient->getSerializer()->toQueryValue($access_token);
}
// query params
if ($device_id !== null) {
$queryParams['device_id'] = $this->apiClient->getSerializer()->toQueryValue($device_id);
}
// query params
if ($module_id !== null) {
$queryParams['module_id'] = $this->apiClient->getSerializer()->toQueryValue($module_id);
}
// query params
if ($scale !== null) {
$queryParams['scale'] = $this->apiClient->getSerializer()->toQueryValue($scale);
}
// query params
if ($type !== null) {
$queryParams['type'] = $this->apiClient->getSerializer()->toQueryValue($type);
}
// query params
if ($date_begin !== null) {
$queryParams['date_begin'] = $this->apiClient->getSerializer()->toQueryValue($date_begin);
}
// query params
if ($date_end !== null) {
$queryParams['date_end'] = $this->apiClient->getSerializer()->toQueryValue($date_end);
}
// query params
if ($limit !== null) {
$queryParams['limit'] = $this->apiClient->getSerializer()->toQueryValue($limit);
}
// query params
if ($optimize !== null) {
$queryParams['optimize'] = $this->apiClient->getSerializer()->toQueryValue($optimize);
}
// query params
if ($real_time !== null) {
$queryParams['real_time'] = $this->apiClient->getSerializer()->toQueryValue($real_time);
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody;
// $_tempBody is the method argument, if present
} else {
if (count($formParams) > 0) {
$httpBody = $formParams;
// for HTTP post (form)
}
}
// make the API Call
//.........这里部分代码省略.........
示例12: addPetUsingByteArrayWithHttpInfo
/**
* addPetUsingByteArrayWithHttpInfo
*
* Fake endpoint to test byte array in body parameter for adding a new pet to the store
*
* @param string $body Pet object in the form of byte array (optional)
* @return Array of null, HTTP status code, HTTP response headers (array of strings)
* @throws \Swagger\Client\ApiException on non-2xx response
*/
public function addPetUsingByteArrayWithHttpInfo($body = null)
{
// parse inputs
$resourcePath = "/pet?testing_byte_array=true";
$httpBody = '';
$queryParams = array();
$headerParams = array();
$formParams = array();
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
if (!is_null($_header_accept)) {
$headerParams['Accept'] = $_header_accept;
}
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array('application/json', 'application/xml'));
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);
// body params
$_tempBody = null;
if (isset($body)) {
$_tempBody = $body;
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody;
// $_tempBody is the method argument, if present
} elseif (count($formParams) > 0) {
$httpBody = $formParams;
// for HTTP post (form)
}
// this endpoint requires OAuth (access token)
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
}
// make the API Call
try {
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi($resourcePath, 'POST', $queryParams, $httpBody, $headerParams);
return array(null, $statusCode, $httpHeader);
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
示例13: updateWithHttpInfo
/**
* updateWithHttpInfo
*
* Modify a Lan
*
* @param string $datacenter_id (required)
* @param map[string,string] $lan_id (required)
* @param \Swagger\Client\Model\Lan $lan Modified Lan (required)
* @param bool $pretty_print_query_parameter Controls whether response is pretty-printed (with indentation and new lines) (optional, default to true)
* @param int $depth Controls the details depth of response objects. \nEg. GET /datacenters/[ID]\n\t- depth=0: only direct properties are included. Children (servers etc.) are not included\n\t- depth=1: direct properties and children references are included\n\t- depth=2: direct properties and children properties are included\n\t- depth=3: direct properties and children properties and children's children are included\n\t- depth=... and so on (optional, default to 0)
* @return Array of \Swagger\Client\Model\Lan, HTTP status code, HTTP response headers (array of strings)
* @throws \Swagger\Client\ApiException on non-2xx response
*/
public function updateWithHttpInfo($datacenter_id, $lan_id, $lan, $pretty_print_query_parameter = null, $depth = null)
{
// verify the required parameter 'datacenter_id' is set
if ($datacenter_id === null) {
throw new \InvalidArgumentException('Missing the required parameter $datacenter_id when calling update');
}
// verify the required parameter 'lan_id' is set
if ($lan_id === null) {
throw new \InvalidArgumentException('Missing the required parameter $lan_id when calling update');
}
// verify the required parameter 'lan' is set
if ($lan === null) {
throw new \InvalidArgumentException('Missing the required parameter $lan when calling update');
}
// parse inputs
$resourcePath = "/datacenters/{datacenterId}/lans/{lanId}";
$httpBody = '';
$queryParams = array();
$headerParams = array();
$formParams = array();
$_header_accept = ApiClient::selectHeaderAccept(array('application/json'));
if (!is_null($_header_accept)) {
$headerParams['Accept'] = $_header_accept;
}
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array('application/json'));
// query params
if ($pretty_print_query_parameter !== null) {
$queryParams['Pretty print query parameter'] = $this->apiClient->getSerializer()->toQueryValue($pretty_print_query_parameter);
}
// query params
if ($depth !== null) {
$queryParams['depth'] = $this->apiClient->getSerializer()->toQueryValue($depth);
}
// path params
if ($datacenter_id !== null) {
$resourcePath = str_replace("{" . "datacenterId" . "}", $this->apiClient->getSerializer()->toPathValue($datacenter_id), $resourcePath);
}
// path params
if ($lan_id !== null) {
$resourcePath = str_replace("{" . "lanId" . "}", $this->apiClient->getSerializer()->toPathValue($lan_id), $resourcePath);
}
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);
// body params
$_tempBody = null;
if (isset($lan)) {
$_tempBody = $lan;
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody;
// $_tempBody is the method argument, if present
} elseif (count($formParams) > 0) {
$httpBody = $formParams;
// for HTTP post (form)
}
// this endpoint requires HTTP basic authentication
if (strlen($this->apiClient->getConfig()->getUsername()) !== 0 or strlen($this->apiClient->getConfig()->getPassword()) !== 0) {
$headerParams['Authorization'] = 'Basic ' . base64_encode($this->apiClient->getConfig()->getUsername() . ":" . $this->apiClient->getConfig()->getPassword());
}
// make the API Call
try {
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi($resourcePath, 'PUT', $queryParams, $httpBody, $headerParams, '\\Swagger\\Client\\Model\\Lan');
if (!$response) {
return array(null, $statusCode, $httpHeader);
}
return array(\Swagger\Client\ObjectSerializer::deserialize($response, '\\Swagger\\Client\\Model\\Lan', $httpHeader), $statusCode, $httpHeader);
} catch (ApiException $e) {
switch ($e->getCode()) {
case 202:
$data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\Lan', $e->getResponseHeaders());
$e->setResponseObject($data);
break;
default:
$data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\Error', $e->getResponseHeaders());
$e->setResponseObject($data);
break;
}
throw $e;
}
}
示例14: orderBookGetOrderBook
/**
* orderBookGetOrderBook
*
* Get current orderbook.
*
* @param string $symbol Instrument symbol. Send a series (e.g. XBT) to get data for the nearest contract in that series. (required)
* @param Number $depth Orderbook depth. (optional)
* @return \Swagger\Client\Model\OrderBook[]
* @throws \Swagger\Client\ApiException on non-2xx response
*/
public function orderBookGetOrderBook($symbol, $depth = null)
{
// verify the required parameter 'symbol' is set
if ($symbol === null) {
throw new \InvalidArgumentException('Missing the required parameter $symbol when calling orderBookGetOrderBook');
}
// parse inputs
$resourcePath = "/orderBook";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$httpBody = '';
$queryParams = array();
$headerParams = array();
$formParams = array();
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript'));
if (!is_null($_header_accept)) {
$headerParams['Accept'] = $_header_accept;
}
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array('application/json', 'application/x-www-form-urlencoded'));
// query params
if ($symbol !== null) {
$queryParams['symbol'] = $this->apiClient->getSerializer()->toQueryValue($symbol);
}
// query params
if ($depth !== null) {
$queryParams['depth'] = $this->apiClient->getSerializer()->toQueryValue($depth);
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody;
// $_tempBody is the method argument, if present
} else {
if (count($formParams) > 0) {
$httpBody = $formParams;
// for HTTP post (form)
}
}
// make the API Call
try {
list($response, $httpHeader) = $this->apiClient->callApi($resourcePath, $method, $queryParams, $httpBody, $headerParams, '\\Swagger\\Client\\Model\\OrderBook[]');
if (!$response) {
return null;
}
return $this->apiClient->getSerializer()->deserialize($response, '\\Swagger\\Client\\Model\\OrderBook[]', $httpHeader);
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\OrderBook[]', $e->getResponseHeaders());
$e->setResponseObject($data);
break;
case 400:
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\Error', $e->getResponseHeaders());
$e->setResponseObject($data);
break;
case 401:
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\Error', $e->getResponseHeaders());
$e->setResponseObject($data);
break;
case 404:
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\Error', $e->getResponseHeaders());
$e->setResponseObject($data);
break;
}
throw $e;
}
return null;
}
示例15: deleteUserWithHttpInfo
/**
* deleteUserWithHttpInfo
*
* Delete user
*
* @param string $username The name that needs to be deleted (required)
* @return Array of null, HTTP status code, HTTP response headers (array of strings)
* @throws \Swagger\Client\ApiException on non-2xx response
*/
public function deleteUserWithHttpInfo($username)
{
// verify the required parameter 'username' is set
if ($username === null) {
throw new \InvalidArgumentException('Missing the required parameter $username when calling deleteUser');
}
// parse inputs
$resourcePath = "/user/{username}";
$httpBody = '';
$queryParams = array();
$headerParams = array();
$formParams = array();
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
if (!is_null($_header_accept)) {
$headerParams['Accept'] = $_header_accept;
}
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
// path params
if ($username !== null) {
$resourcePath = str_replace("{" . "username" . "}", $this->apiClient->getSerializer()->toPathValue($username), $resourcePath);
}
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody;
// $_tempBody is the method argument, if present
} elseif (count($formParams) > 0) {
$httpBody = $formParams;
// for HTTP post (form)
}
// make the API Call
try {
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi($resourcePath, 'DELETE', $queryParams, $httpBody, $headerParams);
return array(null, $statusCode, $httpHeader);
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}