vendor/xeroapi/xero-php-oauth2/lib/Api/AccountingApi.php line 31172

Open in your IDE?
  1. <?php
  2. /**
  3.  * AccountingApi
  4.  * PHP version 5
  5.  *
  6.  * @category Class
  7.  * @package  XeroAPI\XeroPHP Accounting
  8.  * @author   OpenAPI Generator team
  9.  * @link     https://openapi-generator.tech
  10.  */
  11. /**
  12.  * Xero Accounting API
  13.  *
  14.  * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
  15.  *
  16.  * OpenAPI spec version: 2.38.0
  17.  * Contact: [email protected]
  18.  * Generated by: https://openapi-generator.tech
  19.  * OpenAPI Generator version: 5.4.0
  20.  *
  21.  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
  22.  * https://openapi-generator.tech
  23.  * Do not edit the class manually.
  24.  */
  25. namespace XeroAPI\XeroPHP\Api;
  26. use GuzzleHttp\Client;
  27. use GuzzleHttp\ClientInterface;
  28. use GuzzleHttp\Exception\RequestException;
  29. use GuzzleHttp\Psr7\MultipartStream;
  30. use GuzzleHttp\Psr7\Request;
  31. use GuzzleHttp\RequestOptions;
  32. use XeroAPI\XeroPHP\ApiException;
  33. use XeroAPI\XeroPHP\Configuration;
  34. use XeroAPI\XeroPHP\HeaderSelector;
  35. use XeroAPI\XeroPHP\AccountingObjectSerializer;
  36. /**
  37.  * AccountingApi Class Doc Comment
  38.  *
  39.  * @category Class
  40.  * @package  XeroAPI\XeroPHP
  41.  * @author   OpenAPI Generator team
  42.  * @link     https://openapi-generator.tech
  43.  */
  44. class AccountingApi
  45. {
  46.     /**
  47.      * @var ClientInterface
  48.      */
  49.     protected $client;
  50.     /**
  51.      * @var Configuration
  52.      */
  53.     protected $config;
  54.     /**
  55.      * @var HeaderSelector
  56.      */
  57.     protected $headerSelector;
  58.     /**
  59.      * @param ClientInterface $client
  60.      * @param Configuration   $config
  61.      * @param HeaderSelector  $selector
  62.      */
  63.     public function __construct(
  64.         ClientInterface $client null,
  65.         Configuration $config null,
  66.         HeaderSelector $selector null
  67.     ) {
  68.         $this->client $client ?: new Client();
  69.         $this->config $config ?: new Configuration();
  70.         $this->headerSelector $selector ?: new HeaderSelector();
  71.     }
  72.     /**
  73.      * @return Configuration
  74.      */
  75.     public function getConfig()
  76.     {
  77.         return $this->config;
  78.     }
  79.     /**
  80.      * Operation createAccount
  81.      * Creates a new chart of accounts
  82.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  83.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Account $account Account object in body of request (required)
  84.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  85.      * @throws \InvalidArgumentException
  86.      * @return \XeroAPI\XeroPHP\Models\Accounting\Accounts|\XeroAPI\XeroPHP\Models\Accounting\Error
  87.      */
  88.     public function createAccount($xero_tenant_id$account)
  89.     {
  90.         list($response) = $this->createAccountWithHttpInfo($xero_tenant_id$account);
  91.         return $response;
  92.     }
  93.     /**
  94.      * Operation createAccountWithHttpInfo
  95.      * Creates a new chart of accounts
  96.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  97.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Account $account Account object in body of request (required)
  98.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  99.      * @throws \InvalidArgumentException
  100.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Accounts|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  101.      */
  102.     public function createAccountWithHttpInfo($xero_tenant_id$account)
  103.     {
  104.         $request $this->createAccountRequest($xero_tenant_id$account);
  105.         try {
  106.             $options $this->createHttpClientOption();
  107.             try {
  108.                 $response $this->client->send($request$options);
  109.             } catch (RequestException $e) {
  110.                 throw new ApiException(
  111.                     "[{$e->getCode()}{$e->getMessage()}",
  112.                     $e->getCode(),
  113.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  114.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  115.                 );
  116.             }
  117.             $statusCode $response->getStatusCode();
  118.             if ($statusCode 200 || $statusCode 299) {
  119.                 throw new ApiException(
  120.                     sprintf(
  121.                         '[%d] Error connecting to the API (%s)',
  122.                         $statusCode,
  123.                         $request->getUri()
  124.                     ),
  125.                     $statusCode,
  126.                     $response->getHeaders(),
  127.                     $response->getBody()
  128.                 );
  129.             }
  130.             $responseBody $response->getBody();
  131.             switch($statusCode) {
  132.                 case 200:
  133.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Accounts' === '\SplFileObject') {
  134.                         $content $responseBody//stream goes to serializer
  135.                     } else {
  136.                         $content $responseBody->getContents();
  137.                     }
  138.                     return [
  139.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Accounts', []),
  140.                         $response->getStatusCode(),
  141.                         $response->getHeaders()
  142.                     ];
  143.                 case 400:
  144.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  145.                         $content $responseBody//stream goes to serializer
  146.                     } else {
  147.                         $content $responseBody->getContents();
  148.                     }
  149.                     return [
  150.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  151.                         $response->getStatusCode(),
  152.                         $response->getHeaders()
  153.                     ];
  154.             }
  155.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Accounts';
  156.             $responseBody $response->getBody();
  157.             if ($returnType === '\SplFileObject') {
  158.                 $content $responseBody//stream goes to serializer
  159.             } else {
  160.                 $content $responseBody->getContents();
  161.             }
  162.             return [
  163.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  164.                 $response->getStatusCode(),
  165.                 $response->getHeaders()
  166.             ];
  167.         } catch (ApiException $e) {
  168.             switch ($e->getCode()) {
  169.                 case 200:
  170.                     $data AccountingObjectSerializer::deserialize(
  171.                         $e->getResponseBody(),
  172.                         '\XeroAPI\XeroPHP\Models\Accounting\Accounts',
  173.                         $e->getResponseHeaders()
  174.                     );
  175.                     $e->setResponseObject($data);
  176.                     break;
  177.                 case 400:
  178.                     $data AccountingObjectSerializer::deserialize(
  179.                         $e->getResponseBody(),
  180.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  181.                         $e->getResponseHeaders()
  182.                     );
  183.                     $e->setResponseObject($data);
  184.                     break;
  185.             }
  186.             throw $e;
  187.         }
  188.     }
  189.     /**
  190.      * Operation createAccountAsync
  191.      * Creates a new chart of accounts
  192.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  193.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Account $account Account object in body of request (required)
  194.      * @throws \InvalidArgumentException
  195.      * @return \GuzzleHttp\Promise\PromiseInterface
  196.      */
  197.     public function createAccountAsync($xero_tenant_id$account)
  198.     {
  199.         return $this->createAccountAsyncWithHttpInfo($xero_tenant_id$account)
  200.             ->then(
  201.                 function ($response) {
  202.                     return $response[0];
  203.                 }
  204.             );
  205.     }
  206.     /**
  207.      * Operation createAccountAsyncWithHttpInfo
  208.      * Creates a new chart of accounts
  209.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  210.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Account $account Account object in body of request (required)
  211.      * @throws \InvalidArgumentException
  212.      * @return \GuzzleHttp\Promise\PromiseInterface */
  213.     public function createAccountAsyncWithHttpInfo($xero_tenant_id$account)
  214.     {
  215.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Accounts';
  216.         $request $this->createAccountRequest($xero_tenant_id$account);
  217.         return $this->client
  218.             ->sendAsync($request$this->createHttpClientOption())
  219.             ->then(
  220.                 function ($response) use ($returnType) {
  221.                     $responseBody $response->getBody();
  222.                     if ($returnType === '\SplFileObject') {
  223.                         $content $responseBody//stream goes to serializer
  224.                     } else {
  225.                         $content $responseBody->getContents();
  226.                     }
  227.                     return [
  228.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  229.                         $response->getStatusCode(),
  230.                         $response->getHeaders()
  231.                     ];
  232.                 },
  233.                 function ($exception) {
  234.                     $response $exception->getResponse();
  235.                     $statusCode $response->getStatusCode();
  236.                     throw new ApiException(
  237.                         sprintf(
  238.                             '[%d] Error connecting to the API (%s)',
  239.                             $statusCode,
  240.                             $exception->getRequest()->getUri()
  241.                         ),
  242.                         $statusCode,
  243.                         $response->getHeaders(),
  244.                         $response->getBody()
  245.                     );
  246.                 }
  247.             );
  248.     }
  249.     /**
  250.      * Create request for operation 'createAccount'
  251.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  252.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Account $account Account object in body of request (required)
  253.      * @throws \InvalidArgumentException
  254.      * @return \GuzzleHttp\Psr7\Request  */
  255.     protected function createAccountRequest($xero_tenant_id$account)
  256.     {
  257.         // verify the required parameter 'xero_tenant_id' is set
  258.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  259.             throw new \InvalidArgumentException(
  260.                 'Missing the required parameter $xero_tenant_id when calling createAccount'
  261.             );
  262.         }
  263.         // verify the required parameter 'account' is set
  264.         if ($account === null || (is_array($account) && count($account) === 0)) {
  265.             throw new \InvalidArgumentException(
  266.                 'Missing the required parameter $account when calling createAccount'
  267.             );
  268.         }
  269.         $resourcePath '/Accounts';
  270.         $formParams = [];
  271.         $queryParams = [];
  272.         $headerParams = [];
  273.         $httpBody '';
  274.         $multipart false;
  275.         // header params
  276.         if ($xero_tenant_id !== null) {
  277.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  278.         }
  279.         // body params
  280.         $_tempBody null;
  281.         if (isset($account)) {
  282.             $_tempBody $account;
  283.         }
  284.         if ($multipart) {
  285.             $headers $this->headerSelector->selectHeadersForMultipart(
  286.                 ['application/json']
  287.             );
  288.         } else {
  289.             $headers $this->headerSelector->selectHeaders(
  290.                 ['application/json'],
  291.                 ['application/json']
  292.             );
  293.         }
  294.         // for model (json/xml)
  295.         if (isset($_tempBody)) {
  296.             // $_tempBody is the method argument, if present
  297.             if ($headers['Content-Type'] === 'application/json') {
  298.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  299.             } else {
  300.                 $httpBody $_tempBody;
  301.             }
  302.         } elseif (count($formParams) > 0) {
  303.             if ($multipart) {
  304.                 $multipartContents = [
  305.                     [
  306.                         'Content-type' => 'multipart/form-data',
  307.                     ]
  308.                 ];
  309.                 
  310.                 // for HTTP post (form)
  311.                 $httpBody = new MultipartStream($multipartContents);
  312.             } elseif ($headers['Content-Type'] === 'application/json') {
  313.                 $httpBody \GuzzleHttp\json_encode($formParams);
  314.             } else {
  315.                 // for HTTP post (form)
  316.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  317.             }
  318.         }
  319.         // this endpoint requires OAuth (access token)
  320.         if ($this->config->getAccessToken() !== null) {
  321.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  322.         }
  323.         $defaultHeaders = [];
  324.         if ($this->config->getUserAgent()) {
  325.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  326.         }
  327.         $headers array_merge(
  328.             $defaultHeaders,
  329.             $headerParams,
  330.             $headers
  331.         );
  332.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  333.         return new Request(
  334.             'PUT',
  335.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  336.             $headers,
  337.             $httpBody
  338.         );
  339.     }
  340.     /**
  341.      * Operation createAccountAttachmentByFileName
  342.      * Creates an attachment on a specific account
  343.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  344.      * @param  string $account_id Unique identifier for Account object (required)
  345.      * @param  string $file_name Name of the attachment (required)
  346.      * @param  string $body Byte array of file in body of request (required)
  347.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  348.      * @throws \InvalidArgumentException
  349.      * @return \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error
  350.      */
  351.     public function createAccountAttachmentByFileName($xero_tenant_id$account_id$file_name$body)
  352.     {
  353.         list($response) = $this->createAccountAttachmentByFileNameWithHttpInfo($xero_tenant_id$account_id$file_name$body);
  354.         return $response;
  355.     }
  356.     /**
  357.      * Operation createAccountAttachmentByFileNameWithHttpInfo
  358.      * Creates an attachment on a specific account
  359.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  360.      * @param  string $account_id Unique identifier for Account object (required)
  361.      * @param  string $file_name Name of the attachment (required)
  362.      * @param  string $body Byte array of file in body of request (required)
  363.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  364.      * @throws \InvalidArgumentException
  365.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  366.      */
  367.     public function createAccountAttachmentByFileNameWithHttpInfo($xero_tenant_id$account_id$file_name$body)
  368.     {
  369.         $request $this->createAccountAttachmentByFileNameRequest($xero_tenant_id$account_id$file_name$body);
  370.         try {
  371.             $options $this->createHttpClientOption();
  372.             try {
  373.                 $response $this->client->send($request$options);
  374.             } catch (RequestException $e) {
  375.                 throw new ApiException(
  376.                     "[{$e->getCode()}{$e->getMessage()}",
  377.                     $e->getCode(),
  378.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  379.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  380.                 );
  381.             }
  382.             $statusCode $response->getStatusCode();
  383.             if ($statusCode 200 || $statusCode 299) {
  384.                 throw new ApiException(
  385.                     sprintf(
  386.                         '[%d] Error connecting to the API (%s)',
  387.                         $statusCode,
  388.                         $request->getUri()
  389.                     ),
  390.                     $statusCode,
  391.                     $response->getHeaders(),
  392.                     $response->getBody()
  393.                 );
  394.             }
  395.             $responseBody $response->getBody();
  396.             switch($statusCode) {
  397.                 case 200:
  398.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Attachments' === '\SplFileObject') {
  399.                         $content $responseBody//stream goes to serializer
  400.                     } else {
  401.                         $content $responseBody->getContents();
  402.                     }
  403.                     return [
  404.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Attachments', []),
  405.                         $response->getStatusCode(),
  406.                         $response->getHeaders()
  407.                     ];
  408.                 case 400:
  409.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  410.                         $content $responseBody//stream goes to serializer
  411.                     } else {
  412.                         $content $responseBody->getContents();
  413.                     }
  414.                     return [
  415.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  416.                         $response->getStatusCode(),
  417.                         $response->getHeaders()
  418.                     ];
  419.             }
  420.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  421.             $responseBody $response->getBody();
  422.             if ($returnType === '\SplFileObject') {
  423.                 $content $responseBody//stream goes to serializer
  424.             } else {
  425.                 $content $responseBody->getContents();
  426.             }
  427.             return [
  428.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  429.                 $response->getStatusCode(),
  430.                 $response->getHeaders()
  431.             ];
  432.         } catch (ApiException $e) {
  433.             switch ($e->getCode()) {
  434.                 case 200:
  435.                     $data AccountingObjectSerializer::deserialize(
  436.                         $e->getResponseBody(),
  437.                         '\XeroAPI\XeroPHP\Models\Accounting\Attachments',
  438.                         $e->getResponseHeaders()
  439.                     );
  440.                     $e->setResponseObject($data);
  441.                     break;
  442.                 case 400:
  443.                     $data AccountingObjectSerializer::deserialize(
  444.                         $e->getResponseBody(),
  445.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  446.                         $e->getResponseHeaders()
  447.                     );
  448.                     $e->setResponseObject($data);
  449.                     break;
  450.             }
  451.             throw $e;
  452.         }
  453.     }
  454.     /**
  455.      * Operation createAccountAttachmentByFileNameAsync
  456.      * Creates an attachment on a specific account
  457.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  458.      * @param  string $account_id Unique identifier for Account object (required)
  459.      * @param  string $file_name Name of the attachment (required)
  460.      * @param  string $body Byte array of file in body of request (required)
  461.      * @throws \InvalidArgumentException
  462.      * @return \GuzzleHttp\Promise\PromiseInterface
  463.      */
  464.     public function createAccountAttachmentByFileNameAsync($xero_tenant_id$account_id$file_name$body)
  465.     {
  466.         return $this->createAccountAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$account_id$file_name$body)
  467.             ->then(
  468.                 function ($response) {
  469.                     return $response[0];
  470.                 }
  471.             );
  472.     }
  473.     /**
  474.      * Operation createAccountAttachmentByFileNameAsyncWithHttpInfo
  475.      * Creates an attachment on a specific account
  476.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  477.      * @param  string $account_id Unique identifier for Account object (required)
  478.      * @param  string $file_name Name of the attachment (required)
  479.      * @param  string $body Byte array of file in body of request (required)
  480.      * @throws \InvalidArgumentException
  481.      * @return \GuzzleHttp\Promise\PromiseInterface */
  482.     public function createAccountAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$account_id$file_name$body)
  483.     {
  484.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  485.         $request $this->createAccountAttachmentByFileNameRequest($xero_tenant_id$account_id$file_name$body);
  486.         return $this->client
  487.             ->sendAsync($request$this->createHttpClientOption())
  488.             ->then(
  489.                 function ($response) use ($returnType) {
  490.                     $responseBody $response->getBody();
  491.                     if ($returnType === '\SplFileObject') {
  492.                         $content $responseBody//stream goes to serializer
  493.                     } else {
  494.                         $content $responseBody->getContents();
  495.                     }
  496.                     return [
  497.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  498.                         $response->getStatusCode(),
  499.                         $response->getHeaders()
  500.                     ];
  501.                 },
  502.                 function ($exception) {
  503.                     $response $exception->getResponse();
  504.                     $statusCode $response->getStatusCode();
  505.                     throw new ApiException(
  506.                         sprintf(
  507.                             '[%d] Error connecting to the API (%s)',
  508.                             $statusCode,
  509.                             $exception->getRequest()->getUri()
  510.                         ),
  511.                         $statusCode,
  512.                         $response->getHeaders(),
  513.                         $response->getBody()
  514.                     );
  515.                 }
  516.             );
  517.     }
  518.     /**
  519.      * Create request for operation 'createAccountAttachmentByFileName'
  520.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  521.      * @param  string $account_id Unique identifier for Account object (required)
  522.      * @param  string $file_name Name of the attachment (required)
  523.      * @param  string $body Byte array of file in body of request (required)
  524.      * @throws \InvalidArgumentException
  525.      * @return \GuzzleHttp\Psr7\Request  */
  526.     protected function createAccountAttachmentByFileNameRequest($xero_tenant_id$account_id$file_name$body)
  527.     {
  528.         // verify the required parameter 'xero_tenant_id' is set
  529.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  530.             throw new \InvalidArgumentException(
  531.                 'Missing the required parameter $xero_tenant_id when calling createAccountAttachmentByFileName'
  532.             );
  533.         }
  534.         // verify the required parameter 'account_id' is set
  535.         if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
  536.             throw new \InvalidArgumentException(
  537.                 'Missing the required parameter $account_id when calling createAccountAttachmentByFileName'
  538.             );
  539.         }
  540.         // verify the required parameter 'file_name' is set
  541.         if ($file_name === null || (is_array($file_name) && count($file_name) === 0)) {
  542.             throw new \InvalidArgumentException(
  543.                 'Missing the required parameter $file_name when calling createAccountAttachmentByFileName'
  544.             );
  545.         }
  546.         // verify the required parameter 'body' is set
  547.         if ($body === null || (is_array($body) && count($body) === 0)) {
  548.             throw new \InvalidArgumentException(
  549.                 'Missing the required parameter $body when calling createAccountAttachmentByFileName'
  550.             );
  551.         }
  552.         $resourcePath '/Accounts/{AccountID}/Attachments/{FileName}';
  553.         $formParams = [];
  554.         $queryParams = [];
  555.         $headerParams = [];
  556.         $httpBody '';
  557.         $multipart false;
  558.         // header params
  559.         if ($xero_tenant_id !== null) {
  560.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  561.         }
  562.         // path params
  563.         if ($account_id !== null) {
  564.             $resourcePath str_replace(
  565.                 '{' 'AccountID' '}',
  566.                 AccountingObjectSerializer::toPathValue($account_id),
  567.                 $resourcePath
  568.             );
  569.         }
  570.         // path params
  571.         if ($file_name !== null) {
  572.             $resourcePath str_replace(
  573.                 '{' 'FileName' '}',
  574.                 AccountingObjectSerializer::toPathValue($file_name),
  575.                 $resourcePath
  576.             );
  577.         }
  578.         // body params
  579.         $_tempBody null;
  580.         if (isset($body)) {
  581.             $_tempBody $body;
  582.         }
  583.         if ($multipart) {
  584.             $headers $this->headerSelector->selectHeadersForMultipart(
  585.                 ['application/json']
  586.             );
  587.         } else {
  588.             $headers $this->headerSelector->selectHeaders(
  589.                 ['application/json'],
  590.                 ['application/octet-stream']
  591.             );
  592.         }
  593.         // for model (json/xml)
  594.         if (isset($_tempBody)) {
  595.             // $_tempBody is the method argument, if present
  596.             if ($headers['Content-Type'] === 'application/json') {
  597.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  598.             } else {
  599.                 $httpBody $_tempBody;
  600.             }
  601.         } elseif (count($formParams) > 0) {
  602.             if ($multipart) {
  603.                 $multipartContents = [
  604.                     [
  605.                         'Content-type' => 'multipart/form-data',
  606.                     ]
  607.                 ];
  608.                 
  609.                 // for HTTP post (form)
  610.                 $httpBody = new MultipartStream($multipartContents);
  611.             } elseif ($headers['Content-Type'] === 'application/json') {
  612.                 $httpBody \GuzzleHttp\json_encode($formParams);
  613.             } else {
  614.                 // for HTTP post (form)
  615.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  616.             }
  617.         }
  618.         // this endpoint requires OAuth (access token)
  619.         if ($this->config->getAccessToken() !== null) {
  620.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  621.         }
  622.         $defaultHeaders = [];
  623.         if ($this->config->getUserAgent()) {
  624.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  625.         }
  626.         $headers array_merge(
  627.             $defaultHeaders,
  628.             $headerParams,
  629.             $headers
  630.         );
  631.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  632.         return new Request(
  633.             'PUT',
  634.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  635.             $headers,
  636.             $httpBody
  637.         );
  638.     }
  639.     /**
  640.      * Operation createBankTransactionAttachmentByFileName
  641.      * Creates an attachment for a specific bank transaction by filename
  642.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  643.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  644.      * @param  string $file_name Name of the attachment (required)
  645.      * @param  string $body Byte array of file in body of request (required)
  646.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  647.      * @throws \InvalidArgumentException
  648.      * @return \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error
  649.      */
  650.     public function createBankTransactionAttachmentByFileName($xero_tenant_id$bank_transaction_id$file_name$body)
  651.     {
  652.         list($response) = $this->createBankTransactionAttachmentByFileNameWithHttpInfo($xero_tenant_id$bank_transaction_id$file_name$body);
  653.         return $response;
  654.     }
  655.     /**
  656.      * Operation createBankTransactionAttachmentByFileNameWithHttpInfo
  657.      * Creates an attachment for a specific bank transaction by filename
  658.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  659.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  660.      * @param  string $file_name Name of the attachment (required)
  661.      * @param  string $body Byte array of file in body of request (required)
  662.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  663.      * @throws \InvalidArgumentException
  664.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  665.      */
  666.     public function createBankTransactionAttachmentByFileNameWithHttpInfo($xero_tenant_id$bank_transaction_id$file_name$body)
  667.     {
  668.         $request $this->createBankTransactionAttachmentByFileNameRequest($xero_tenant_id$bank_transaction_id$file_name$body);
  669.         try {
  670.             $options $this->createHttpClientOption();
  671.             try {
  672.                 $response $this->client->send($request$options);
  673.             } catch (RequestException $e) {
  674.                 throw new ApiException(
  675.                     "[{$e->getCode()}{$e->getMessage()}",
  676.                     $e->getCode(),
  677.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  678.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  679.                 );
  680.             }
  681.             $statusCode $response->getStatusCode();
  682.             if ($statusCode 200 || $statusCode 299) {
  683.                 throw new ApiException(
  684.                     sprintf(
  685.                         '[%d] Error connecting to the API (%s)',
  686.                         $statusCode,
  687.                         $request->getUri()
  688.                     ),
  689.                     $statusCode,
  690.                     $response->getHeaders(),
  691.                     $response->getBody()
  692.                 );
  693.             }
  694.             $responseBody $response->getBody();
  695.             switch($statusCode) {
  696.                 case 200:
  697.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Attachments' === '\SplFileObject') {
  698.                         $content $responseBody//stream goes to serializer
  699.                     } else {
  700.                         $content $responseBody->getContents();
  701.                     }
  702.                     return [
  703.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Attachments', []),
  704.                         $response->getStatusCode(),
  705.                         $response->getHeaders()
  706.                     ];
  707.                 case 400:
  708.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  709.                         $content $responseBody//stream goes to serializer
  710.                     } else {
  711.                         $content $responseBody->getContents();
  712.                     }
  713.                     return [
  714.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  715.                         $response->getStatusCode(),
  716.                         $response->getHeaders()
  717.                     ];
  718.             }
  719.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  720.             $responseBody $response->getBody();
  721.             if ($returnType === '\SplFileObject') {
  722.                 $content $responseBody//stream goes to serializer
  723.             } else {
  724.                 $content $responseBody->getContents();
  725.             }
  726.             return [
  727.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  728.                 $response->getStatusCode(),
  729.                 $response->getHeaders()
  730.             ];
  731.         } catch (ApiException $e) {
  732.             switch ($e->getCode()) {
  733.                 case 200:
  734.                     $data AccountingObjectSerializer::deserialize(
  735.                         $e->getResponseBody(),
  736.                         '\XeroAPI\XeroPHP\Models\Accounting\Attachments',
  737.                         $e->getResponseHeaders()
  738.                     );
  739.                     $e->setResponseObject($data);
  740.                     break;
  741.                 case 400:
  742.                     $data AccountingObjectSerializer::deserialize(
  743.                         $e->getResponseBody(),
  744.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  745.                         $e->getResponseHeaders()
  746.                     );
  747.                     $e->setResponseObject($data);
  748.                     break;
  749.             }
  750.             throw $e;
  751.         }
  752.     }
  753.     /**
  754.      * Operation createBankTransactionAttachmentByFileNameAsync
  755.      * Creates an attachment for a specific bank transaction by filename
  756.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  757.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  758.      * @param  string $file_name Name of the attachment (required)
  759.      * @param  string $body Byte array of file in body of request (required)
  760.      * @throws \InvalidArgumentException
  761.      * @return \GuzzleHttp\Promise\PromiseInterface
  762.      */
  763.     public function createBankTransactionAttachmentByFileNameAsync($xero_tenant_id$bank_transaction_id$file_name$body)
  764.     {
  765.         return $this->createBankTransactionAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$bank_transaction_id$file_name$body)
  766.             ->then(
  767.                 function ($response) {
  768.                     return $response[0];
  769.                 }
  770.             );
  771.     }
  772.     /**
  773.      * Operation createBankTransactionAttachmentByFileNameAsyncWithHttpInfo
  774.      * Creates an attachment for a specific bank transaction by filename
  775.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  776.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  777.      * @param  string $file_name Name of the attachment (required)
  778.      * @param  string $body Byte array of file in body of request (required)
  779.      * @throws \InvalidArgumentException
  780.      * @return \GuzzleHttp\Promise\PromiseInterface */
  781.     public function createBankTransactionAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$bank_transaction_id$file_name$body)
  782.     {
  783.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  784.         $request $this->createBankTransactionAttachmentByFileNameRequest($xero_tenant_id$bank_transaction_id$file_name$body);
  785.         return $this->client
  786.             ->sendAsync($request$this->createHttpClientOption())
  787.             ->then(
  788.                 function ($response) use ($returnType) {
  789.                     $responseBody $response->getBody();
  790.                     if ($returnType === '\SplFileObject') {
  791.                         $content $responseBody//stream goes to serializer
  792.                     } else {
  793.                         $content $responseBody->getContents();
  794.                     }
  795.                     return [
  796.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  797.                         $response->getStatusCode(),
  798.                         $response->getHeaders()
  799.                     ];
  800.                 },
  801.                 function ($exception) {
  802.                     $response $exception->getResponse();
  803.                     $statusCode $response->getStatusCode();
  804.                     throw new ApiException(
  805.                         sprintf(
  806.                             '[%d] Error connecting to the API (%s)',
  807.                             $statusCode,
  808.                             $exception->getRequest()->getUri()
  809.                         ),
  810.                         $statusCode,
  811.                         $response->getHeaders(),
  812.                         $response->getBody()
  813.                     );
  814.                 }
  815.             );
  816.     }
  817.     /**
  818.      * Create request for operation 'createBankTransactionAttachmentByFileName'
  819.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  820.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  821.      * @param  string $file_name Name of the attachment (required)
  822.      * @param  string $body Byte array of file in body of request (required)
  823.      * @throws \InvalidArgumentException
  824.      * @return \GuzzleHttp\Psr7\Request  */
  825.     protected function createBankTransactionAttachmentByFileNameRequest($xero_tenant_id$bank_transaction_id$file_name$body)
  826.     {
  827.         // verify the required parameter 'xero_tenant_id' is set
  828.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  829.             throw new \InvalidArgumentException(
  830.                 'Missing the required parameter $xero_tenant_id when calling createBankTransactionAttachmentByFileName'
  831.             );
  832.         }
  833.         // verify the required parameter 'bank_transaction_id' is set
  834.         if ($bank_transaction_id === null || (is_array($bank_transaction_id) && count($bank_transaction_id) === 0)) {
  835.             throw new \InvalidArgumentException(
  836.                 'Missing the required parameter $bank_transaction_id when calling createBankTransactionAttachmentByFileName'
  837.             );
  838.         }
  839.         // verify the required parameter 'file_name' is set
  840.         if ($file_name === null || (is_array($file_name) && count($file_name) === 0)) {
  841.             throw new \InvalidArgumentException(
  842.                 'Missing the required parameter $file_name when calling createBankTransactionAttachmentByFileName'
  843.             );
  844.         }
  845.         // verify the required parameter 'body' is set
  846.         if ($body === null || (is_array($body) && count($body) === 0)) {
  847.             throw new \InvalidArgumentException(
  848.                 'Missing the required parameter $body when calling createBankTransactionAttachmentByFileName'
  849.             );
  850.         }
  851.         $resourcePath '/BankTransactions/{BankTransactionID}/Attachments/{FileName}';
  852.         $formParams = [];
  853.         $queryParams = [];
  854.         $headerParams = [];
  855.         $httpBody '';
  856.         $multipart false;
  857.         // header params
  858.         if ($xero_tenant_id !== null) {
  859.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  860.         }
  861.         // path params
  862.         if ($bank_transaction_id !== null) {
  863.             $resourcePath str_replace(
  864.                 '{' 'BankTransactionID' '}',
  865.                 AccountingObjectSerializer::toPathValue($bank_transaction_id),
  866.                 $resourcePath
  867.             );
  868.         }
  869.         // path params
  870.         if ($file_name !== null) {
  871.             $resourcePath str_replace(
  872.                 '{' 'FileName' '}',
  873.                 AccountingObjectSerializer::toPathValue($file_name),
  874.                 $resourcePath
  875.             );
  876.         }
  877.         // body params
  878.         $_tempBody null;
  879.         if (isset($body)) {
  880.             $_tempBody $body;
  881.         }
  882.         if ($multipart) {
  883.             $headers $this->headerSelector->selectHeadersForMultipart(
  884.                 ['application/json']
  885.             );
  886.         } else {
  887.             $headers $this->headerSelector->selectHeaders(
  888.                 ['application/json'],
  889.                 ['application/octet-stream']
  890.             );
  891.         }
  892.         // for model (json/xml)
  893.         if (isset($_tempBody)) {
  894.             // $_tempBody is the method argument, if present
  895.             if ($headers['Content-Type'] === 'application/json') {
  896.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  897.             } else {
  898.                 $httpBody $_tempBody;
  899.             }
  900.         } elseif (count($formParams) > 0) {
  901.             if ($multipart) {
  902.                 $multipartContents = [
  903.                     [
  904.                         'Content-type' => 'multipart/form-data',
  905.                     ]
  906.                 ];
  907.                 
  908.                 // for HTTP post (form)
  909.                 $httpBody = new MultipartStream($multipartContents);
  910.             } elseif ($headers['Content-Type'] === 'application/json') {
  911.                 $httpBody \GuzzleHttp\json_encode($formParams);
  912.             } else {
  913.                 // for HTTP post (form)
  914.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  915.             }
  916.         }
  917.         // this endpoint requires OAuth (access token)
  918.         if ($this->config->getAccessToken() !== null) {
  919.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  920.         }
  921.         $defaultHeaders = [];
  922.         if ($this->config->getUserAgent()) {
  923.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  924.         }
  925.         $headers array_merge(
  926.             $defaultHeaders,
  927.             $headerParams,
  928.             $headers
  929.         );
  930.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  931.         return new Request(
  932.             'PUT',
  933.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  934.             $headers,
  935.             $httpBody
  936.         );
  937.     }
  938.     /**
  939.      * Operation createBankTransactionHistoryRecord
  940.      * Creates a history record for a specific bank transactions
  941.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  942.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  943.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  944.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  945.      * @throws \InvalidArgumentException
  946.      * @return \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords|\XeroAPI\XeroPHP\Models\Accounting\Error
  947.      */
  948.     public function createBankTransactionHistoryRecord($xero_tenant_id$bank_transaction_id$history_records)
  949.     {
  950.         list($response) = $this->createBankTransactionHistoryRecordWithHttpInfo($xero_tenant_id$bank_transaction_id$history_records);
  951.         return $response;
  952.     }
  953.     /**
  954.      * Operation createBankTransactionHistoryRecordWithHttpInfo
  955.      * Creates a history record for a specific bank transactions
  956.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  957.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  958.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  959.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  960.      * @throws \InvalidArgumentException
  961.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  962.      */
  963.     public function createBankTransactionHistoryRecordWithHttpInfo($xero_tenant_id$bank_transaction_id$history_records)
  964.     {
  965.         $request $this->createBankTransactionHistoryRecordRequest($xero_tenant_id$bank_transaction_id$history_records);
  966.         try {
  967.             $options $this->createHttpClientOption();
  968.             try {
  969.                 $response $this->client->send($request$options);
  970.             } catch (RequestException $e) {
  971.                 throw new ApiException(
  972.                     "[{$e->getCode()}{$e->getMessage()}",
  973.                     $e->getCode(),
  974.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  975.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  976.                 );
  977.             }
  978.             $statusCode $response->getStatusCode();
  979.             if ($statusCode 200 || $statusCode 299) {
  980.                 throw new ApiException(
  981.                     sprintf(
  982.                         '[%d] Error connecting to the API (%s)',
  983.                         $statusCode,
  984.                         $request->getUri()
  985.                     ),
  986.                     $statusCode,
  987.                     $response->getHeaders(),
  988.                     $response->getBody()
  989.                 );
  990.             }
  991.             $responseBody $response->getBody();
  992.             switch($statusCode) {
  993.                 case 200:
  994.                     if ('\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords' === '\SplFileObject') {
  995.                         $content $responseBody//stream goes to serializer
  996.                     } else {
  997.                         $content $responseBody->getContents();
  998.                     }
  999.                     return [
  1000.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords', []),
  1001.                         $response->getStatusCode(),
  1002.                         $response->getHeaders()
  1003.                     ];
  1004.                 case 400:
  1005.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  1006.                         $content $responseBody//stream goes to serializer
  1007.                     } else {
  1008.                         $content $responseBody->getContents();
  1009.                     }
  1010.                     return [
  1011.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  1012.                         $response->getStatusCode(),
  1013.                         $response->getHeaders()
  1014.                     ];
  1015.             }
  1016.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  1017.             $responseBody $response->getBody();
  1018.             if ($returnType === '\SplFileObject') {
  1019.                 $content $responseBody//stream goes to serializer
  1020.             } else {
  1021.                 $content $responseBody->getContents();
  1022.             }
  1023.             return [
  1024.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  1025.                 $response->getStatusCode(),
  1026.                 $response->getHeaders()
  1027.             ];
  1028.         } catch (ApiException $e) {
  1029.             switch ($e->getCode()) {
  1030.                 case 200:
  1031.                     $data AccountingObjectSerializer::deserialize(
  1032.                         $e->getResponseBody(),
  1033.                         '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords',
  1034.                         $e->getResponseHeaders()
  1035.                     );
  1036.                     $e->setResponseObject($data);
  1037.                     break;
  1038.                 case 400:
  1039.                     $data AccountingObjectSerializer::deserialize(
  1040.                         $e->getResponseBody(),
  1041.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  1042.                         $e->getResponseHeaders()
  1043.                     );
  1044.                     $e->setResponseObject($data);
  1045.                     break;
  1046.             }
  1047.             throw $e;
  1048.         }
  1049.     }
  1050.     /**
  1051.      * Operation createBankTransactionHistoryRecordAsync
  1052.      * Creates a history record for a specific bank transactions
  1053.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  1054.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  1055.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  1056.      * @throws \InvalidArgumentException
  1057.      * @return \GuzzleHttp\Promise\PromiseInterface
  1058.      */
  1059.     public function createBankTransactionHistoryRecordAsync($xero_tenant_id$bank_transaction_id$history_records)
  1060.     {
  1061.         return $this->createBankTransactionHistoryRecordAsyncWithHttpInfo($xero_tenant_id$bank_transaction_id$history_records)
  1062.             ->then(
  1063.                 function ($response) {
  1064.                     return $response[0];
  1065.                 }
  1066.             );
  1067.     }
  1068.     /**
  1069.      * Operation createBankTransactionHistoryRecordAsyncWithHttpInfo
  1070.      * Creates a history record for a specific bank transactions
  1071.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  1072.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  1073.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  1074.      * @throws \InvalidArgumentException
  1075.      * @return \GuzzleHttp\Promise\PromiseInterface */
  1076.     public function createBankTransactionHistoryRecordAsyncWithHttpInfo($xero_tenant_id$bank_transaction_id$history_records)
  1077.     {
  1078.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  1079.         $request $this->createBankTransactionHistoryRecordRequest($xero_tenant_id$bank_transaction_id$history_records);
  1080.         return $this->client
  1081.             ->sendAsync($request$this->createHttpClientOption())
  1082.             ->then(
  1083.                 function ($response) use ($returnType) {
  1084.                     $responseBody $response->getBody();
  1085.                     if ($returnType === '\SplFileObject') {
  1086.                         $content $responseBody//stream goes to serializer
  1087.                     } else {
  1088.                         $content $responseBody->getContents();
  1089.                     }
  1090.                     return [
  1091.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  1092.                         $response->getStatusCode(),
  1093.                         $response->getHeaders()
  1094.                     ];
  1095.                 },
  1096.                 function ($exception) {
  1097.                     $response $exception->getResponse();
  1098.                     $statusCode $response->getStatusCode();
  1099.                     throw new ApiException(
  1100.                         sprintf(
  1101.                             '[%d] Error connecting to the API (%s)',
  1102.                             $statusCode,
  1103.                             $exception->getRequest()->getUri()
  1104.                         ),
  1105.                         $statusCode,
  1106.                         $response->getHeaders(),
  1107.                         $response->getBody()
  1108.                     );
  1109.                 }
  1110.             );
  1111.     }
  1112.     /**
  1113.      * Create request for operation 'createBankTransactionHistoryRecord'
  1114.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  1115.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  1116.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  1117.      * @throws \InvalidArgumentException
  1118.      * @return \GuzzleHttp\Psr7\Request  */
  1119.     protected function createBankTransactionHistoryRecordRequest($xero_tenant_id$bank_transaction_id$history_records)
  1120.     {
  1121.         // verify the required parameter 'xero_tenant_id' is set
  1122.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  1123.             throw new \InvalidArgumentException(
  1124.                 'Missing the required parameter $xero_tenant_id when calling createBankTransactionHistoryRecord'
  1125.             );
  1126.         }
  1127.         // verify the required parameter 'bank_transaction_id' is set
  1128.         if ($bank_transaction_id === null || (is_array($bank_transaction_id) && count($bank_transaction_id) === 0)) {
  1129.             throw new \InvalidArgumentException(
  1130.                 'Missing the required parameter $bank_transaction_id when calling createBankTransactionHistoryRecord'
  1131.             );
  1132.         }
  1133.         // verify the required parameter 'history_records' is set
  1134.         if ($history_records === null || (is_array($history_records) && count($history_records) === 0)) {
  1135.             throw new \InvalidArgumentException(
  1136.                 'Missing the required parameter $history_records when calling createBankTransactionHistoryRecord'
  1137.             );
  1138.         }
  1139.         $resourcePath '/BankTransactions/{BankTransactionID}/History';
  1140.         $formParams = [];
  1141.         $queryParams = [];
  1142.         $headerParams = [];
  1143.         $httpBody '';
  1144.         $multipart false;
  1145.         // header params
  1146.         if ($xero_tenant_id !== null) {
  1147.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  1148.         }
  1149.         // path params
  1150.         if ($bank_transaction_id !== null) {
  1151.             $resourcePath str_replace(
  1152.                 '{' 'BankTransactionID' '}',
  1153.                 AccountingObjectSerializer::toPathValue($bank_transaction_id),
  1154.                 $resourcePath
  1155.             );
  1156.         }
  1157.         // body params
  1158.         $_tempBody null;
  1159.         if (isset($history_records)) {
  1160.             $_tempBody $history_records;
  1161.         }
  1162.         if ($multipart) {
  1163.             $headers $this->headerSelector->selectHeadersForMultipart(
  1164.                 ['application/json']
  1165.             );
  1166.         } else {
  1167.             $headers $this->headerSelector->selectHeaders(
  1168.                 ['application/json'],
  1169.                 ['application/json']
  1170.             );
  1171.         }
  1172.         // for model (json/xml)
  1173.         if (isset($_tempBody)) {
  1174.             // $_tempBody is the method argument, if present
  1175.             if ($headers['Content-Type'] === 'application/json') {
  1176.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  1177.             } else {
  1178.                 $httpBody $_tempBody;
  1179.             }
  1180.         } elseif (count($formParams) > 0) {
  1181.             if ($multipart) {
  1182.                 $multipartContents = [
  1183.                     [
  1184.                         'Content-type' => 'multipart/form-data',
  1185.                     ]
  1186.                 ];
  1187.                 
  1188.                 // for HTTP post (form)
  1189.                 $httpBody = new MultipartStream($multipartContents);
  1190.             } elseif ($headers['Content-Type'] === 'application/json') {
  1191.                 $httpBody \GuzzleHttp\json_encode($formParams);
  1192.             } else {
  1193.                 // for HTTP post (form)
  1194.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  1195.             }
  1196.         }
  1197.         // this endpoint requires OAuth (access token)
  1198.         if ($this->config->getAccessToken() !== null) {
  1199.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  1200.         }
  1201.         $defaultHeaders = [];
  1202.         if ($this->config->getUserAgent()) {
  1203.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  1204.         }
  1205.         $headers array_merge(
  1206.             $defaultHeaders,
  1207.             $headerParams,
  1208.             $headers
  1209.         );
  1210.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  1211.         return new Request(
  1212.             'PUT',
  1213.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  1214.             $headers,
  1215.             $httpBody
  1216.         );
  1217.     }
  1218.     /**
  1219.      * Operation createBankTransactions
  1220.      * Creates one or more spent or received money transaction
  1221.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  1222.      * @param  \XeroAPI\XeroPHP\Models\Accounting\BankTransactions $bank_transactions BankTransactions with an array of BankTransaction objects in body of request (required)
  1223.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  1224.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  1225.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  1226.      * @throws \InvalidArgumentException
  1227.      * @return \XeroAPI\XeroPHP\Models\Accounting\BankTransactions|\XeroAPI\XeroPHP\Models\Accounting\Error
  1228.      */
  1229.     public function createBankTransactions($xero_tenant_id$bank_transactions$summarize_errors false$unitdp null)
  1230.     {
  1231.         list($response) = $this->createBankTransactionsWithHttpInfo($xero_tenant_id$bank_transactions$summarize_errors$unitdp);
  1232.         return $response;
  1233.     }
  1234.     /**
  1235.      * Operation createBankTransactionsWithHttpInfo
  1236.      * Creates one or more spent or received money transaction
  1237.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  1238.      * @param  \XeroAPI\XeroPHP\Models\Accounting\BankTransactions $bank_transactions BankTransactions with an array of BankTransaction objects in body of request (required)
  1239.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  1240.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  1241.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  1242.      * @throws \InvalidArgumentException
  1243.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\BankTransactions|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  1244.      */
  1245.     public function createBankTransactionsWithHttpInfo($xero_tenant_id$bank_transactions$summarize_errors false$unitdp null)
  1246.     {
  1247.         $request $this->createBankTransactionsRequest($xero_tenant_id$bank_transactions$summarize_errors$unitdp);
  1248.         try {
  1249.             $options $this->createHttpClientOption();
  1250.             try {
  1251.                 $response $this->client->send($request$options);
  1252.             } catch (RequestException $e) {
  1253.                 throw new ApiException(
  1254.                     "[{$e->getCode()}{$e->getMessage()}",
  1255.                     $e->getCode(),
  1256.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  1257.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  1258.                 );
  1259.             }
  1260.             $statusCode $response->getStatusCode();
  1261.             if ($statusCode 200 || $statusCode 299) {
  1262.                 throw new ApiException(
  1263.                     sprintf(
  1264.                         '[%d] Error connecting to the API (%s)',
  1265.                         $statusCode,
  1266.                         $request->getUri()
  1267.                     ),
  1268.                     $statusCode,
  1269.                     $response->getHeaders(),
  1270.                     $response->getBody()
  1271.                 );
  1272.             }
  1273.             $responseBody $response->getBody();
  1274.             switch($statusCode) {
  1275.                 case 200:
  1276.                     if ('\XeroAPI\XeroPHP\Models\Accounting\BankTransactions' === '\SplFileObject') {
  1277.                         $content $responseBody//stream goes to serializer
  1278.                     } else {
  1279.                         $content $responseBody->getContents();
  1280.                     }
  1281.                     return [
  1282.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\BankTransactions', []),
  1283.                         $response->getStatusCode(),
  1284.                         $response->getHeaders()
  1285.                     ];
  1286.                 case 400:
  1287.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  1288.                         $content $responseBody//stream goes to serializer
  1289.                     } else {
  1290.                         $content $responseBody->getContents();
  1291.                     }
  1292.                     return [
  1293.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  1294.                         $response->getStatusCode(),
  1295.                         $response->getHeaders()
  1296.                     ];
  1297.             }
  1298.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\BankTransactions';
  1299.             $responseBody $response->getBody();
  1300.             if ($returnType === '\SplFileObject') {
  1301.                 $content $responseBody//stream goes to serializer
  1302.             } else {
  1303.                 $content $responseBody->getContents();
  1304.             }
  1305.             return [
  1306.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  1307.                 $response->getStatusCode(),
  1308.                 $response->getHeaders()
  1309.             ];
  1310.         } catch (ApiException $e) {
  1311.             switch ($e->getCode()) {
  1312.                 case 200:
  1313.                     $data AccountingObjectSerializer::deserialize(
  1314.                         $e->getResponseBody(),
  1315.                         '\XeroAPI\XeroPHP\Models\Accounting\BankTransactions',
  1316.                         $e->getResponseHeaders()
  1317.                     );
  1318.                     $e->setResponseObject($data);
  1319.                     break;
  1320.                 case 400:
  1321.                     $data AccountingObjectSerializer::deserialize(
  1322.                         $e->getResponseBody(),
  1323.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  1324.                         $e->getResponseHeaders()
  1325.                     );
  1326.                     $e->setResponseObject($data);
  1327.                     break;
  1328.             }
  1329.             throw $e;
  1330.         }
  1331.     }
  1332.     /**
  1333.      * Operation createBankTransactionsAsync
  1334.      * Creates one or more spent or received money transaction
  1335.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  1336.      * @param  \XeroAPI\XeroPHP\Models\Accounting\BankTransactions $bank_transactions BankTransactions with an array of BankTransaction objects in body of request (required)
  1337.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  1338.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  1339.      * @throws \InvalidArgumentException
  1340.      * @return \GuzzleHttp\Promise\PromiseInterface
  1341.      */
  1342.     public function createBankTransactionsAsync($xero_tenant_id$bank_transactions$summarize_errors false$unitdp null)
  1343.     {
  1344.         return $this->createBankTransactionsAsyncWithHttpInfo($xero_tenant_id$bank_transactions$summarize_errors$unitdp)
  1345.             ->then(
  1346.                 function ($response) {
  1347.                     return $response[0];
  1348.                 }
  1349.             );
  1350.     }
  1351.     /**
  1352.      * Operation createBankTransactionsAsyncWithHttpInfo
  1353.      * Creates one or more spent or received money transaction
  1354.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  1355.      * @param  \XeroAPI\XeroPHP\Models\Accounting\BankTransactions $bank_transactions BankTransactions with an array of BankTransaction objects in body of request (required)
  1356.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  1357.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  1358.      * @throws \InvalidArgumentException
  1359.      * @return \GuzzleHttp\Promise\PromiseInterface */
  1360.     public function createBankTransactionsAsyncWithHttpInfo($xero_tenant_id$bank_transactions$summarize_errors false$unitdp null)
  1361.     {
  1362.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\BankTransactions';
  1363.         $request $this->createBankTransactionsRequest($xero_tenant_id$bank_transactions$summarize_errors$unitdp);
  1364.         return $this->client
  1365.             ->sendAsync($request$this->createHttpClientOption())
  1366.             ->then(
  1367.                 function ($response) use ($returnType) {
  1368.                     $responseBody $response->getBody();
  1369.                     if ($returnType === '\SplFileObject') {
  1370.                         $content $responseBody//stream goes to serializer
  1371.                     } else {
  1372.                         $content $responseBody->getContents();
  1373.                     }
  1374.                     return [
  1375.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  1376.                         $response->getStatusCode(),
  1377.                         $response->getHeaders()
  1378.                     ];
  1379.                 },
  1380.                 function ($exception) {
  1381.                     $response $exception->getResponse();
  1382.                     $statusCode $response->getStatusCode();
  1383.                     throw new ApiException(
  1384.                         sprintf(
  1385.                             '[%d] Error connecting to the API (%s)',
  1386.                             $statusCode,
  1387.                             $exception->getRequest()->getUri()
  1388.                         ),
  1389.                         $statusCode,
  1390.                         $response->getHeaders(),
  1391.                         $response->getBody()
  1392.                     );
  1393.                 }
  1394.             );
  1395.     }
  1396.     /**
  1397.      * Create request for operation 'createBankTransactions'
  1398.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  1399.      * @param  \XeroAPI\XeroPHP\Models\Accounting\BankTransactions $bank_transactions BankTransactions with an array of BankTransaction objects in body of request (required)
  1400.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  1401.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  1402.      * @throws \InvalidArgumentException
  1403.      * @return \GuzzleHttp\Psr7\Request  */
  1404.     protected function createBankTransactionsRequest($xero_tenant_id$bank_transactions$summarize_errors false$unitdp null)
  1405.     {
  1406.         // verify the required parameter 'xero_tenant_id' is set
  1407.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  1408.             throw new \InvalidArgumentException(
  1409.                 'Missing the required parameter $xero_tenant_id when calling createBankTransactions'
  1410.             );
  1411.         }
  1412.         // verify the required parameter 'bank_transactions' is set
  1413.         if ($bank_transactions === null || (is_array($bank_transactions) && count($bank_transactions) === 0)) {
  1414.             throw new \InvalidArgumentException(
  1415.                 'Missing the required parameter $bank_transactions when calling createBankTransactions'
  1416.             );
  1417.         }
  1418.         $resourcePath '/BankTransactions';
  1419.         $formParams = [];
  1420.         $queryParams = [];
  1421.         $headerParams = [];
  1422.         $httpBody '';
  1423.         $multipart false;
  1424.         // query params
  1425.         if ($summarize_errors !== null) {
  1426.             $queryParams['summarizeErrors'] = $summarize_errors 'true' 'false';
  1427.         }
  1428.         // query params
  1429.         if ($unitdp !== null) {
  1430.             $queryParams['unitdp'] = AccountingObjectSerializer::toQueryValue($unitdp);
  1431.         }
  1432.         // header params
  1433.         if ($xero_tenant_id !== null) {
  1434.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  1435.         }
  1436.         // body params
  1437.         $_tempBody null;
  1438.         if (isset($bank_transactions)) {
  1439.             $_tempBody $bank_transactions;
  1440.         }
  1441.         if ($multipart) {
  1442.             $headers $this->headerSelector->selectHeadersForMultipart(
  1443.                 ['application/json']
  1444.             );
  1445.         } else {
  1446.             $headers $this->headerSelector->selectHeaders(
  1447.                 ['application/json'],
  1448.                 ['application/json']
  1449.             );
  1450.         }
  1451.         // for model (json/xml)
  1452.         if (isset($_tempBody)) {
  1453.             // $_tempBody is the method argument, if present
  1454.             if ($headers['Content-Type'] === 'application/json') {
  1455.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  1456.             } else {
  1457.                 $httpBody $_tempBody;
  1458.             }
  1459.         } elseif (count($formParams) > 0) {
  1460.             if ($multipart) {
  1461.                 $multipartContents = [
  1462.                     [
  1463.                         'Content-type' => 'multipart/form-data',
  1464.                     ]
  1465.                 ];
  1466.                 
  1467.                 // for HTTP post (form)
  1468.                 $httpBody = new MultipartStream($multipartContents);
  1469.             } elseif ($headers['Content-Type'] === 'application/json') {
  1470.                 $httpBody \GuzzleHttp\json_encode($formParams);
  1471.             } else {
  1472.                 // for HTTP post (form)
  1473.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  1474.             }
  1475.         }
  1476.         // this endpoint requires OAuth (access token)
  1477.         if ($this->config->getAccessToken() !== null) {
  1478.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  1479.         }
  1480.         $defaultHeaders = [];
  1481.         if ($this->config->getUserAgent()) {
  1482.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  1483.         }
  1484.         $headers array_merge(
  1485.             $defaultHeaders,
  1486.             $headerParams,
  1487.             $headers
  1488.         );
  1489.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  1490.         return new Request(
  1491.             'PUT',
  1492.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  1493.             $headers,
  1494.             $httpBody
  1495.         );
  1496.     }
  1497.     /**
  1498.      * Operation createBankTransfer
  1499.      * Creates a bank transfer
  1500.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  1501.      * @param  \XeroAPI\XeroPHP\Models\Accounting\BankTransfers $bank_transfers BankTransfers with array of BankTransfer objects in request body (required)
  1502.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  1503.      * @throws \InvalidArgumentException
  1504.      * @return \XeroAPI\XeroPHP\Models\Accounting\BankTransfers|\XeroAPI\XeroPHP\Models\Accounting\Error
  1505.      */
  1506.     public function createBankTransfer($xero_tenant_id$bank_transfers)
  1507.     {
  1508.         list($response) = $this->createBankTransferWithHttpInfo($xero_tenant_id$bank_transfers);
  1509.         return $response;
  1510.     }
  1511.     /**
  1512.      * Operation createBankTransferWithHttpInfo
  1513.      * Creates a bank transfer
  1514.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  1515.      * @param  \XeroAPI\XeroPHP\Models\Accounting\BankTransfers $bank_transfers BankTransfers with array of BankTransfer objects in request body (required)
  1516.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  1517.      * @throws \InvalidArgumentException
  1518.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\BankTransfers|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  1519.      */
  1520.     public function createBankTransferWithHttpInfo($xero_tenant_id$bank_transfers)
  1521.     {
  1522.         $request $this->createBankTransferRequest($xero_tenant_id$bank_transfers);
  1523.         try {
  1524.             $options $this->createHttpClientOption();
  1525.             try {
  1526.                 $response $this->client->send($request$options);
  1527.             } catch (RequestException $e) {
  1528.                 throw new ApiException(
  1529.                     "[{$e->getCode()}{$e->getMessage()}",
  1530.                     $e->getCode(),
  1531.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  1532.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  1533.                 );
  1534.             }
  1535.             $statusCode $response->getStatusCode();
  1536.             if ($statusCode 200 || $statusCode 299) {
  1537.                 throw new ApiException(
  1538.                     sprintf(
  1539.                         '[%d] Error connecting to the API (%s)',
  1540.                         $statusCode,
  1541.                         $request->getUri()
  1542.                     ),
  1543.                     $statusCode,
  1544.                     $response->getHeaders(),
  1545.                     $response->getBody()
  1546.                 );
  1547.             }
  1548.             $responseBody $response->getBody();
  1549.             switch($statusCode) {
  1550.                 case 200:
  1551.                     if ('\XeroAPI\XeroPHP\Models\Accounting\BankTransfers' === '\SplFileObject') {
  1552.                         $content $responseBody//stream goes to serializer
  1553.                     } else {
  1554.                         $content $responseBody->getContents();
  1555.                     }
  1556.                     return [
  1557.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\BankTransfers', []),
  1558.                         $response->getStatusCode(),
  1559.                         $response->getHeaders()
  1560.                     ];
  1561.                 case 400:
  1562.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  1563.                         $content $responseBody//stream goes to serializer
  1564.                     } else {
  1565.                         $content $responseBody->getContents();
  1566.                     }
  1567.                     return [
  1568.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  1569.                         $response->getStatusCode(),
  1570.                         $response->getHeaders()
  1571.                     ];
  1572.             }
  1573.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\BankTransfers';
  1574.             $responseBody $response->getBody();
  1575.             if ($returnType === '\SplFileObject') {
  1576.                 $content $responseBody//stream goes to serializer
  1577.             } else {
  1578.                 $content $responseBody->getContents();
  1579.             }
  1580.             return [
  1581.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  1582.                 $response->getStatusCode(),
  1583.                 $response->getHeaders()
  1584.             ];
  1585.         } catch (ApiException $e) {
  1586.             switch ($e->getCode()) {
  1587.                 case 200:
  1588.                     $data AccountingObjectSerializer::deserialize(
  1589.                         $e->getResponseBody(),
  1590.                         '\XeroAPI\XeroPHP\Models\Accounting\BankTransfers',
  1591.                         $e->getResponseHeaders()
  1592.                     );
  1593.                     $e->setResponseObject($data);
  1594.                     break;
  1595.                 case 400:
  1596.                     $data AccountingObjectSerializer::deserialize(
  1597.                         $e->getResponseBody(),
  1598.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  1599.                         $e->getResponseHeaders()
  1600.                     );
  1601.                     $e->setResponseObject($data);
  1602.                     break;
  1603.             }
  1604.             throw $e;
  1605.         }
  1606.     }
  1607.     /**
  1608.      * Operation createBankTransferAsync
  1609.      * Creates a bank transfer
  1610.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  1611.      * @param  \XeroAPI\XeroPHP\Models\Accounting\BankTransfers $bank_transfers BankTransfers with array of BankTransfer objects in request body (required)
  1612.      * @throws \InvalidArgumentException
  1613.      * @return \GuzzleHttp\Promise\PromiseInterface
  1614.      */
  1615.     public function createBankTransferAsync($xero_tenant_id$bank_transfers)
  1616.     {
  1617.         return $this->createBankTransferAsyncWithHttpInfo($xero_tenant_id$bank_transfers)
  1618.             ->then(
  1619.                 function ($response) {
  1620.                     return $response[0];
  1621.                 }
  1622.             );
  1623.     }
  1624.     /**
  1625.      * Operation createBankTransferAsyncWithHttpInfo
  1626.      * Creates a bank transfer
  1627.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  1628.      * @param  \XeroAPI\XeroPHP\Models\Accounting\BankTransfers $bank_transfers BankTransfers with array of BankTransfer objects in request body (required)
  1629.      * @throws \InvalidArgumentException
  1630.      * @return \GuzzleHttp\Promise\PromiseInterface */
  1631.     public function createBankTransferAsyncWithHttpInfo($xero_tenant_id$bank_transfers)
  1632.     {
  1633.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\BankTransfers';
  1634.         $request $this->createBankTransferRequest($xero_tenant_id$bank_transfers);
  1635.         return $this->client
  1636.             ->sendAsync($request$this->createHttpClientOption())
  1637.             ->then(
  1638.                 function ($response) use ($returnType) {
  1639.                     $responseBody $response->getBody();
  1640.                     if ($returnType === '\SplFileObject') {
  1641.                         $content $responseBody//stream goes to serializer
  1642.                     } else {
  1643.                         $content $responseBody->getContents();
  1644.                     }
  1645.                     return [
  1646.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  1647.                         $response->getStatusCode(),
  1648.                         $response->getHeaders()
  1649.                     ];
  1650.                 },
  1651.                 function ($exception) {
  1652.                     $response $exception->getResponse();
  1653.                     $statusCode $response->getStatusCode();
  1654.                     throw new ApiException(
  1655.                         sprintf(
  1656.                             '[%d] Error connecting to the API (%s)',
  1657.                             $statusCode,
  1658.                             $exception->getRequest()->getUri()
  1659.                         ),
  1660.                         $statusCode,
  1661.                         $response->getHeaders(),
  1662.                         $response->getBody()
  1663.                     );
  1664.                 }
  1665.             );
  1666.     }
  1667.     /**
  1668.      * Create request for operation 'createBankTransfer'
  1669.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  1670.      * @param  \XeroAPI\XeroPHP\Models\Accounting\BankTransfers $bank_transfers BankTransfers with array of BankTransfer objects in request body (required)
  1671.      * @throws \InvalidArgumentException
  1672.      * @return \GuzzleHttp\Psr7\Request  */
  1673.     protected function createBankTransferRequest($xero_tenant_id$bank_transfers)
  1674.     {
  1675.         // verify the required parameter 'xero_tenant_id' is set
  1676.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  1677.             throw new \InvalidArgumentException(
  1678.                 'Missing the required parameter $xero_tenant_id when calling createBankTransfer'
  1679.             );
  1680.         }
  1681.         // verify the required parameter 'bank_transfers' is set
  1682.         if ($bank_transfers === null || (is_array($bank_transfers) && count($bank_transfers) === 0)) {
  1683.             throw new \InvalidArgumentException(
  1684.                 'Missing the required parameter $bank_transfers when calling createBankTransfer'
  1685.             );
  1686.         }
  1687.         $resourcePath '/BankTransfers';
  1688.         $formParams = [];
  1689.         $queryParams = [];
  1690.         $headerParams = [];
  1691.         $httpBody '';
  1692.         $multipart false;
  1693.         // header params
  1694.         if ($xero_tenant_id !== null) {
  1695.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  1696.         }
  1697.         // body params
  1698.         $_tempBody null;
  1699.         if (isset($bank_transfers)) {
  1700.             $_tempBody $bank_transfers;
  1701.         }
  1702.         if ($multipart) {
  1703.             $headers $this->headerSelector->selectHeadersForMultipart(
  1704.                 ['application/json']
  1705.             );
  1706.         } else {
  1707.             $headers $this->headerSelector->selectHeaders(
  1708.                 ['application/json'],
  1709.                 ['application/json']
  1710.             );
  1711.         }
  1712.         // for model (json/xml)
  1713.         if (isset($_tempBody)) {
  1714.             // $_tempBody is the method argument, if present
  1715.             if ($headers['Content-Type'] === 'application/json') {
  1716.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  1717.             } else {
  1718.                 $httpBody $_tempBody;
  1719.             }
  1720.         } elseif (count($formParams) > 0) {
  1721.             if ($multipart) {
  1722.                 $multipartContents = [
  1723.                     [
  1724.                         'Content-type' => 'multipart/form-data',
  1725.                     ]
  1726.                 ];
  1727.                 
  1728.                 // for HTTP post (form)
  1729.                 $httpBody = new MultipartStream($multipartContents);
  1730.             } elseif ($headers['Content-Type'] === 'application/json') {
  1731.                 $httpBody \GuzzleHttp\json_encode($formParams);
  1732.             } else {
  1733.                 // for HTTP post (form)
  1734.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  1735.             }
  1736.         }
  1737.         // this endpoint requires OAuth (access token)
  1738.         if ($this->config->getAccessToken() !== null) {
  1739.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  1740.         }
  1741.         $defaultHeaders = [];
  1742.         if ($this->config->getUserAgent()) {
  1743.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  1744.         }
  1745.         $headers array_merge(
  1746.             $defaultHeaders,
  1747.             $headerParams,
  1748.             $headers
  1749.         );
  1750.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  1751.         return new Request(
  1752.             'PUT',
  1753.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  1754.             $headers,
  1755.             $httpBody
  1756.         );
  1757.     }
  1758.     /**
  1759.      * Operation createBankTransferAttachmentByFileName
  1760.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  1761.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  1762.      * @param  string $file_name Name of the attachment (required)
  1763.      * @param  string $body Byte array of file in body of request (required)
  1764.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  1765.      * @throws \InvalidArgumentException
  1766.      * @return \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error
  1767.      */
  1768.     public function createBankTransferAttachmentByFileName($xero_tenant_id$bank_transfer_id$file_name$body)
  1769.     {
  1770.         list($response) = $this->createBankTransferAttachmentByFileNameWithHttpInfo($xero_tenant_id$bank_transfer_id$file_name$body);
  1771.         return $response;
  1772.     }
  1773.     /**
  1774.      * Operation createBankTransferAttachmentByFileNameWithHttpInfo
  1775.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  1776.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  1777.      * @param  string $file_name Name of the attachment (required)
  1778.      * @param  string $body Byte array of file in body of request (required)
  1779.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  1780.      * @throws \InvalidArgumentException
  1781.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  1782.      */
  1783.     public function createBankTransferAttachmentByFileNameWithHttpInfo($xero_tenant_id$bank_transfer_id$file_name$body)
  1784.     {
  1785.         $request $this->createBankTransferAttachmentByFileNameRequest($xero_tenant_id$bank_transfer_id$file_name$body);
  1786.         try {
  1787.             $options $this->createHttpClientOption();
  1788.             try {
  1789.                 $response $this->client->send($request$options);
  1790.             } catch (RequestException $e) {
  1791.                 throw new ApiException(
  1792.                     "[{$e->getCode()}{$e->getMessage()}",
  1793.                     $e->getCode(),
  1794.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  1795.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  1796.                 );
  1797.             }
  1798.             $statusCode $response->getStatusCode();
  1799.             if ($statusCode 200 || $statusCode 299) {
  1800.                 throw new ApiException(
  1801.                     sprintf(
  1802.                         '[%d] Error connecting to the API (%s)',
  1803.                         $statusCode,
  1804.                         $request->getUri()
  1805.                     ),
  1806.                     $statusCode,
  1807.                     $response->getHeaders(),
  1808.                     $response->getBody()
  1809.                 );
  1810.             }
  1811.             $responseBody $response->getBody();
  1812.             switch($statusCode) {
  1813.                 case 200:
  1814.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Attachments' === '\SplFileObject') {
  1815.                         $content $responseBody//stream goes to serializer
  1816.                     } else {
  1817.                         $content $responseBody->getContents();
  1818.                     }
  1819.                     return [
  1820.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Attachments', []),
  1821.                         $response->getStatusCode(),
  1822.                         $response->getHeaders()
  1823.                     ];
  1824.                 case 400:
  1825.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  1826.                         $content $responseBody//stream goes to serializer
  1827.                     } else {
  1828.                         $content $responseBody->getContents();
  1829.                     }
  1830.                     return [
  1831.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  1832.                         $response->getStatusCode(),
  1833.                         $response->getHeaders()
  1834.                     ];
  1835.             }
  1836.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  1837.             $responseBody $response->getBody();
  1838.             if ($returnType === '\SplFileObject') {
  1839.                 $content $responseBody//stream goes to serializer
  1840.             } else {
  1841.                 $content $responseBody->getContents();
  1842.             }
  1843.             return [
  1844.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  1845.                 $response->getStatusCode(),
  1846.                 $response->getHeaders()
  1847.             ];
  1848.         } catch (ApiException $e) {
  1849.             switch ($e->getCode()) {
  1850.                 case 200:
  1851.                     $data AccountingObjectSerializer::deserialize(
  1852.                         $e->getResponseBody(),
  1853.                         '\XeroAPI\XeroPHP\Models\Accounting\Attachments',
  1854.                         $e->getResponseHeaders()
  1855.                     );
  1856.                     $e->setResponseObject($data);
  1857.                     break;
  1858.                 case 400:
  1859.                     $data AccountingObjectSerializer::deserialize(
  1860.                         $e->getResponseBody(),
  1861.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  1862.                         $e->getResponseHeaders()
  1863.                     );
  1864.                     $e->setResponseObject($data);
  1865.                     break;
  1866.             }
  1867.             throw $e;
  1868.         }
  1869.     }
  1870.     /**
  1871.      * Operation createBankTransferAttachmentByFileNameAsync
  1872.      * 
  1873.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  1874.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  1875.      * @param  string $file_name Name of the attachment (required)
  1876.      * @param  string $body Byte array of file in body of request (required)
  1877.      * @throws \InvalidArgumentException
  1878.      * @return \GuzzleHttp\Promise\PromiseInterface
  1879.      */
  1880.     public function createBankTransferAttachmentByFileNameAsync($xero_tenant_id$bank_transfer_id$file_name$body)
  1881.     {
  1882.         return $this->createBankTransferAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$bank_transfer_id$file_name$body)
  1883.             ->then(
  1884.                 function ($response) {
  1885.                     return $response[0];
  1886.                 }
  1887.             );
  1888.     }
  1889.     /**
  1890.      * Operation createBankTransferAttachmentByFileNameAsyncWithHttpInfo
  1891.      * 
  1892.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  1893.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  1894.      * @param  string $file_name Name of the attachment (required)
  1895.      * @param  string $body Byte array of file in body of request (required)
  1896.      * @throws \InvalidArgumentException
  1897.      * @return \GuzzleHttp\Promise\PromiseInterface */
  1898.     public function createBankTransferAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$bank_transfer_id$file_name$body)
  1899.     {
  1900.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  1901.         $request $this->createBankTransferAttachmentByFileNameRequest($xero_tenant_id$bank_transfer_id$file_name$body);
  1902.         return $this->client
  1903.             ->sendAsync($request$this->createHttpClientOption())
  1904.             ->then(
  1905.                 function ($response) use ($returnType) {
  1906.                     $responseBody $response->getBody();
  1907.                     if ($returnType === '\SplFileObject') {
  1908.                         $content $responseBody//stream goes to serializer
  1909.                     } else {
  1910.                         $content $responseBody->getContents();
  1911.                     }
  1912.                     return [
  1913.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  1914.                         $response->getStatusCode(),
  1915.                         $response->getHeaders()
  1916.                     ];
  1917.                 },
  1918.                 function ($exception) {
  1919.                     $response $exception->getResponse();
  1920.                     $statusCode $response->getStatusCode();
  1921.                     throw new ApiException(
  1922.                         sprintf(
  1923.                             '[%d] Error connecting to the API (%s)',
  1924.                             $statusCode,
  1925.                             $exception->getRequest()->getUri()
  1926.                         ),
  1927.                         $statusCode,
  1928.                         $response->getHeaders(),
  1929.                         $response->getBody()
  1930.                     );
  1931.                 }
  1932.             );
  1933.     }
  1934.     /**
  1935.      * Create request for operation 'createBankTransferAttachmentByFileName'
  1936.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  1937.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  1938.      * @param  string $file_name Name of the attachment (required)
  1939.      * @param  string $body Byte array of file in body of request (required)
  1940.      * @throws \InvalidArgumentException
  1941.      * @return \GuzzleHttp\Psr7\Request  */
  1942.     protected function createBankTransferAttachmentByFileNameRequest($xero_tenant_id$bank_transfer_id$file_name$body)
  1943.     {
  1944.         // verify the required parameter 'xero_tenant_id' is set
  1945.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  1946.             throw new \InvalidArgumentException(
  1947.                 'Missing the required parameter $xero_tenant_id when calling createBankTransferAttachmentByFileName'
  1948.             );
  1949.         }
  1950.         // verify the required parameter 'bank_transfer_id' is set
  1951.         if ($bank_transfer_id === null || (is_array($bank_transfer_id) && count($bank_transfer_id) === 0)) {
  1952.             throw new \InvalidArgumentException(
  1953.                 'Missing the required parameter $bank_transfer_id when calling createBankTransferAttachmentByFileName'
  1954.             );
  1955.         }
  1956.         // verify the required parameter 'file_name' is set
  1957.         if ($file_name === null || (is_array($file_name) && count($file_name) === 0)) {
  1958.             throw new \InvalidArgumentException(
  1959.                 'Missing the required parameter $file_name when calling createBankTransferAttachmentByFileName'
  1960.             );
  1961.         }
  1962.         // verify the required parameter 'body' is set
  1963.         if ($body === null || (is_array($body) && count($body) === 0)) {
  1964.             throw new \InvalidArgumentException(
  1965.                 'Missing the required parameter $body when calling createBankTransferAttachmentByFileName'
  1966.             );
  1967.         }
  1968.         $resourcePath '/BankTransfers/{BankTransferID}/Attachments/{FileName}';
  1969.         $formParams = [];
  1970.         $queryParams = [];
  1971.         $headerParams = [];
  1972.         $httpBody '';
  1973.         $multipart false;
  1974.         // header params
  1975.         if ($xero_tenant_id !== null) {
  1976.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  1977.         }
  1978.         // path params
  1979.         if ($bank_transfer_id !== null) {
  1980.             $resourcePath str_replace(
  1981.                 '{' 'BankTransferID' '}',
  1982.                 AccountingObjectSerializer::toPathValue($bank_transfer_id),
  1983.                 $resourcePath
  1984.             );
  1985.         }
  1986.         // path params
  1987.         if ($file_name !== null) {
  1988.             $resourcePath str_replace(
  1989.                 '{' 'FileName' '}',
  1990.                 AccountingObjectSerializer::toPathValue($file_name),
  1991.                 $resourcePath
  1992.             );
  1993.         }
  1994.         // body params
  1995.         $_tempBody null;
  1996.         if (isset($body)) {
  1997.             $_tempBody $body;
  1998.         }
  1999.         if ($multipart) {
  2000.             $headers $this->headerSelector->selectHeadersForMultipart(
  2001.                 ['application/json']
  2002.             );
  2003.         } else {
  2004.             $headers $this->headerSelector->selectHeaders(
  2005.                 ['application/json'],
  2006.                 ['application/octet-stream']
  2007.             );
  2008.         }
  2009.         // for model (json/xml)
  2010.         if (isset($_tempBody)) {
  2011.             // $_tempBody is the method argument, if present
  2012.             if ($headers['Content-Type'] === 'application/json') {
  2013.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  2014.             } else {
  2015.                 $httpBody $_tempBody;
  2016.             }
  2017.         } elseif (count($formParams) > 0) {
  2018.             if ($multipart) {
  2019.                 $multipartContents = [
  2020.                     [
  2021.                         'Content-type' => 'multipart/form-data',
  2022.                     ]
  2023.                 ];
  2024.                 
  2025.                 // for HTTP post (form)
  2026.                 $httpBody = new MultipartStream($multipartContents);
  2027.             } elseif ($headers['Content-Type'] === 'application/json') {
  2028.                 $httpBody \GuzzleHttp\json_encode($formParams);
  2029.             } else {
  2030.                 // for HTTP post (form)
  2031.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  2032.             }
  2033.         }
  2034.         // this endpoint requires OAuth (access token)
  2035.         if ($this->config->getAccessToken() !== null) {
  2036.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  2037.         }
  2038.         $defaultHeaders = [];
  2039.         if ($this->config->getUserAgent()) {
  2040.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  2041.         }
  2042.         $headers array_merge(
  2043.             $defaultHeaders,
  2044.             $headerParams,
  2045.             $headers
  2046.         );
  2047.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  2048.         return new Request(
  2049.             'PUT',
  2050.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  2051.             $headers,
  2052.             $httpBody
  2053.         );
  2054.     }
  2055.     /**
  2056.      * Operation createBankTransferHistoryRecord
  2057.      * Creates a history record for a specific bank transfer
  2058.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  2059.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  2060.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  2061.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  2062.      * @throws \InvalidArgumentException
  2063.      * @return \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords|\XeroAPI\XeroPHP\Models\Accounting\Error
  2064.      */
  2065.     public function createBankTransferHistoryRecord($xero_tenant_id$bank_transfer_id$history_records)
  2066.     {
  2067.         list($response) = $this->createBankTransferHistoryRecordWithHttpInfo($xero_tenant_id$bank_transfer_id$history_records);
  2068.         return $response;
  2069.     }
  2070.     /**
  2071.      * Operation createBankTransferHistoryRecordWithHttpInfo
  2072.      * Creates a history record for a specific bank transfer
  2073.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  2074.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  2075.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  2076.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  2077.      * @throws \InvalidArgumentException
  2078.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  2079.      */
  2080.     public function createBankTransferHistoryRecordWithHttpInfo($xero_tenant_id$bank_transfer_id$history_records)
  2081.     {
  2082.         $request $this->createBankTransferHistoryRecordRequest($xero_tenant_id$bank_transfer_id$history_records);
  2083.         try {
  2084.             $options $this->createHttpClientOption();
  2085.             try {
  2086.                 $response $this->client->send($request$options);
  2087.             } catch (RequestException $e) {
  2088.                 throw new ApiException(
  2089.                     "[{$e->getCode()}{$e->getMessage()}",
  2090.                     $e->getCode(),
  2091.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  2092.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  2093.                 );
  2094.             }
  2095.             $statusCode $response->getStatusCode();
  2096.             if ($statusCode 200 || $statusCode 299) {
  2097.                 throw new ApiException(
  2098.                     sprintf(
  2099.                         '[%d] Error connecting to the API (%s)',
  2100.                         $statusCode,
  2101.                         $request->getUri()
  2102.                     ),
  2103.                     $statusCode,
  2104.                     $response->getHeaders(),
  2105.                     $response->getBody()
  2106.                 );
  2107.             }
  2108.             $responseBody $response->getBody();
  2109.             switch($statusCode) {
  2110.                 case 200:
  2111.                     if ('\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords' === '\SplFileObject') {
  2112.                         $content $responseBody//stream goes to serializer
  2113.                     } else {
  2114.                         $content $responseBody->getContents();
  2115.                     }
  2116.                     return [
  2117.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords', []),
  2118.                         $response->getStatusCode(),
  2119.                         $response->getHeaders()
  2120.                     ];
  2121.                 case 400:
  2122.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  2123.                         $content $responseBody//stream goes to serializer
  2124.                     } else {
  2125.                         $content $responseBody->getContents();
  2126.                     }
  2127.                     return [
  2128.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  2129.                         $response->getStatusCode(),
  2130.                         $response->getHeaders()
  2131.                     ];
  2132.             }
  2133.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  2134.             $responseBody $response->getBody();
  2135.             if ($returnType === '\SplFileObject') {
  2136.                 $content $responseBody//stream goes to serializer
  2137.             } else {
  2138.                 $content $responseBody->getContents();
  2139.             }
  2140.             return [
  2141.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  2142.                 $response->getStatusCode(),
  2143.                 $response->getHeaders()
  2144.             ];
  2145.         } catch (ApiException $e) {
  2146.             switch ($e->getCode()) {
  2147.                 case 200:
  2148.                     $data AccountingObjectSerializer::deserialize(
  2149.                         $e->getResponseBody(),
  2150.                         '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords',
  2151.                         $e->getResponseHeaders()
  2152.                     );
  2153.                     $e->setResponseObject($data);
  2154.                     break;
  2155.                 case 400:
  2156.                     $data AccountingObjectSerializer::deserialize(
  2157.                         $e->getResponseBody(),
  2158.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  2159.                         $e->getResponseHeaders()
  2160.                     );
  2161.                     $e->setResponseObject($data);
  2162.                     break;
  2163.             }
  2164.             throw $e;
  2165.         }
  2166.     }
  2167.     /**
  2168.      * Operation createBankTransferHistoryRecordAsync
  2169.      * Creates a history record for a specific bank transfer
  2170.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  2171.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  2172.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  2173.      * @throws \InvalidArgumentException
  2174.      * @return \GuzzleHttp\Promise\PromiseInterface
  2175.      */
  2176.     public function createBankTransferHistoryRecordAsync($xero_tenant_id$bank_transfer_id$history_records)
  2177.     {
  2178.         return $this->createBankTransferHistoryRecordAsyncWithHttpInfo($xero_tenant_id$bank_transfer_id$history_records)
  2179.             ->then(
  2180.                 function ($response) {
  2181.                     return $response[0];
  2182.                 }
  2183.             );
  2184.     }
  2185.     /**
  2186.      * Operation createBankTransferHistoryRecordAsyncWithHttpInfo
  2187.      * Creates a history record for a specific bank transfer
  2188.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  2189.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  2190.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  2191.      * @throws \InvalidArgumentException
  2192.      * @return \GuzzleHttp\Promise\PromiseInterface */
  2193.     public function createBankTransferHistoryRecordAsyncWithHttpInfo($xero_tenant_id$bank_transfer_id$history_records)
  2194.     {
  2195.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  2196.         $request $this->createBankTransferHistoryRecordRequest($xero_tenant_id$bank_transfer_id$history_records);
  2197.         return $this->client
  2198.             ->sendAsync($request$this->createHttpClientOption())
  2199.             ->then(
  2200.                 function ($response) use ($returnType) {
  2201.                     $responseBody $response->getBody();
  2202.                     if ($returnType === '\SplFileObject') {
  2203.                         $content $responseBody//stream goes to serializer
  2204.                     } else {
  2205.                         $content $responseBody->getContents();
  2206.                     }
  2207.                     return [
  2208.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  2209.                         $response->getStatusCode(),
  2210.                         $response->getHeaders()
  2211.                     ];
  2212.                 },
  2213.                 function ($exception) {
  2214.                     $response $exception->getResponse();
  2215.                     $statusCode $response->getStatusCode();
  2216.                     throw new ApiException(
  2217.                         sprintf(
  2218.                             '[%d] Error connecting to the API (%s)',
  2219.                             $statusCode,
  2220.                             $exception->getRequest()->getUri()
  2221.                         ),
  2222.                         $statusCode,
  2223.                         $response->getHeaders(),
  2224.                         $response->getBody()
  2225.                     );
  2226.                 }
  2227.             );
  2228.     }
  2229.     /**
  2230.      * Create request for operation 'createBankTransferHistoryRecord'
  2231.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  2232.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  2233.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  2234.      * @throws \InvalidArgumentException
  2235.      * @return \GuzzleHttp\Psr7\Request  */
  2236.     protected function createBankTransferHistoryRecordRequest($xero_tenant_id$bank_transfer_id$history_records)
  2237.     {
  2238.         // verify the required parameter 'xero_tenant_id' is set
  2239.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  2240.             throw new \InvalidArgumentException(
  2241.                 'Missing the required parameter $xero_tenant_id when calling createBankTransferHistoryRecord'
  2242.             );
  2243.         }
  2244.         // verify the required parameter 'bank_transfer_id' is set
  2245.         if ($bank_transfer_id === null || (is_array($bank_transfer_id) && count($bank_transfer_id) === 0)) {
  2246.             throw new \InvalidArgumentException(
  2247.                 'Missing the required parameter $bank_transfer_id when calling createBankTransferHistoryRecord'
  2248.             );
  2249.         }
  2250.         // verify the required parameter 'history_records' is set
  2251.         if ($history_records === null || (is_array($history_records) && count($history_records) === 0)) {
  2252.             throw new \InvalidArgumentException(
  2253.                 'Missing the required parameter $history_records when calling createBankTransferHistoryRecord'
  2254.             );
  2255.         }
  2256.         $resourcePath '/BankTransfers/{BankTransferID}/History';
  2257.         $formParams = [];
  2258.         $queryParams = [];
  2259.         $headerParams = [];
  2260.         $httpBody '';
  2261.         $multipart false;
  2262.         // header params
  2263.         if ($xero_tenant_id !== null) {
  2264.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  2265.         }
  2266.         // path params
  2267.         if ($bank_transfer_id !== null) {
  2268.             $resourcePath str_replace(
  2269.                 '{' 'BankTransferID' '}',
  2270.                 AccountingObjectSerializer::toPathValue($bank_transfer_id),
  2271.                 $resourcePath
  2272.             );
  2273.         }
  2274.         // body params
  2275.         $_tempBody null;
  2276.         if (isset($history_records)) {
  2277.             $_tempBody $history_records;
  2278.         }
  2279.         if ($multipart) {
  2280.             $headers $this->headerSelector->selectHeadersForMultipart(
  2281.                 ['application/json']
  2282.             );
  2283.         } else {
  2284.             $headers $this->headerSelector->selectHeaders(
  2285.                 ['application/json'],
  2286.                 ['application/json']
  2287.             );
  2288.         }
  2289.         // for model (json/xml)
  2290.         if (isset($_tempBody)) {
  2291.             // $_tempBody is the method argument, if present
  2292.             if ($headers['Content-Type'] === 'application/json') {
  2293.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  2294.             } else {
  2295.                 $httpBody $_tempBody;
  2296.             }
  2297.         } elseif (count($formParams) > 0) {
  2298.             if ($multipart) {
  2299.                 $multipartContents = [
  2300.                     [
  2301.                         'Content-type' => 'multipart/form-data',
  2302.                     ]
  2303.                 ];
  2304.                 
  2305.                 // for HTTP post (form)
  2306.                 $httpBody = new MultipartStream($multipartContents);
  2307.             } elseif ($headers['Content-Type'] === 'application/json') {
  2308.                 $httpBody \GuzzleHttp\json_encode($formParams);
  2309.             } else {
  2310.                 // for HTTP post (form)
  2311.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  2312.             }
  2313.         }
  2314.         // this endpoint requires OAuth (access token)
  2315.         if ($this->config->getAccessToken() !== null) {
  2316.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  2317.         }
  2318.         $defaultHeaders = [];
  2319.         if ($this->config->getUserAgent()) {
  2320.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  2321.         }
  2322.         $headers array_merge(
  2323.             $defaultHeaders,
  2324.             $headerParams,
  2325.             $headers
  2326.         );
  2327.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  2328.         return new Request(
  2329.             'PUT',
  2330.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  2331.             $headers,
  2332.             $httpBody
  2333.         );
  2334.     }
  2335.     /**
  2336.      * Operation createBatchPayment
  2337.      * Creates one or many batch payments for invoices
  2338.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  2339.      * @param  \XeroAPI\XeroPHP\Models\Accounting\BatchPayments $batch_payments BatchPayments with an array of Payments in body of request (required)
  2340.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  2341.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  2342.      * @throws \InvalidArgumentException
  2343.      * @return \XeroAPI\XeroPHP\Models\Accounting\BatchPayments|\XeroAPI\XeroPHP\Models\Accounting\Error
  2344.      */
  2345.     public function createBatchPayment($xero_tenant_id$batch_payments$summarize_errors false)
  2346.     {
  2347.         list($response) = $this->createBatchPaymentWithHttpInfo($xero_tenant_id$batch_payments$summarize_errors);
  2348.         return $response;
  2349.     }
  2350.     /**
  2351.      * Operation createBatchPaymentWithHttpInfo
  2352.      * Creates one or many batch payments for invoices
  2353.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  2354.      * @param  \XeroAPI\XeroPHP\Models\Accounting\BatchPayments $batch_payments BatchPayments with an array of Payments in body of request (required)
  2355.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  2356.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  2357.      * @throws \InvalidArgumentException
  2358.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\BatchPayments|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  2359.      */
  2360.     public function createBatchPaymentWithHttpInfo($xero_tenant_id$batch_payments$summarize_errors false)
  2361.     {
  2362.         $request $this->createBatchPaymentRequest($xero_tenant_id$batch_payments$summarize_errors);
  2363.         try {
  2364.             $options $this->createHttpClientOption();
  2365.             try {
  2366.                 $response $this->client->send($request$options);
  2367.             } catch (RequestException $e) {
  2368.                 throw new ApiException(
  2369.                     "[{$e->getCode()}{$e->getMessage()}",
  2370.                     $e->getCode(),
  2371.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  2372.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  2373.                 );
  2374.             }
  2375.             $statusCode $response->getStatusCode();
  2376.             if ($statusCode 200 || $statusCode 299) {
  2377.                 throw new ApiException(
  2378.                     sprintf(
  2379.                         '[%d] Error connecting to the API (%s)',
  2380.                         $statusCode,
  2381.                         $request->getUri()
  2382.                     ),
  2383.                     $statusCode,
  2384.                     $response->getHeaders(),
  2385.                     $response->getBody()
  2386.                 );
  2387.             }
  2388.             $responseBody $response->getBody();
  2389.             switch($statusCode) {
  2390.                 case 200:
  2391.                     if ('\XeroAPI\XeroPHP\Models\Accounting\BatchPayments' === '\SplFileObject') {
  2392.                         $content $responseBody//stream goes to serializer
  2393.                     } else {
  2394.                         $content $responseBody->getContents();
  2395.                     }
  2396.                     return [
  2397.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\BatchPayments', []),
  2398.                         $response->getStatusCode(),
  2399.                         $response->getHeaders()
  2400.                     ];
  2401.                 case 400:
  2402.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  2403.                         $content $responseBody//stream goes to serializer
  2404.                     } else {
  2405.                         $content $responseBody->getContents();
  2406.                     }
  2407.                     return [
  2408.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  2409.                         $response->getStatusCode(),
  2410.                         $response->getHeaders()
  2411.                     ];
  2412.             }
  2413.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\BatchPayments';
  2414.             $responseBody $response->getBody();
  2415.             if ($returnType === '\SplFileObject') {
  2416.                 $content $responseBody//stream goes to serializer
  2417.             } else {
  2418.                 $content $responseBody->getContents();
  2419.             }
  2420.             return [
  2421.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  2422.                 $response->getStatusCode(),
  2423.                 $response->getHeaders()
  2424.             ];
  2425.         } catch (ApiException $e) {
  2426.             switch ($e->getCode()) {
  2427.                 case 200:
  2428.                     $data AccountingObjectSerializer::deserialize(
  2429.                         $e->getResponseBody(),
  2430.                         '\XeroAPI\XeroPHP\Models\Accounting\BatchPayments',
  2431.                         $e->getResponseHeaders()
  2432.                     );
  2433.                     $e->setResponseObject($data);
  2434.                     break;
  2435.                 case 400:
  2436.                     $data AccountingObjectSerializer::deserialize(
  2437.                         $e->getResponseBody(),
  2438.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  2439.                         $e->getResponseHeaders()
  2440.                     );
  2441.                     $e->setResponseObject($data);
  2442.                     break;
  2443.             }
  2444.             throw $e;
  2445.         }
  2446.     }
  2447.     /**
  2448.      * Operation createBatchPaymentAsync
  2449.      * Creates one or many batch payments for invoices
  2450.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  2451.      * @param  \XeroAPI\XeroPHP\Models\Accounting\BatchPayments $batch_payments BatchPayments with an array of Payments in body of request (required)
  2452.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  2453.      * @throws \InvalidArgumentException
  2454.      * @return \GuzzleHttp\Promise\PromiseInterface
  2455.      */
  2456.     public function createBatchPaymentAsync($xero_tenant_id$batch_payments$summarize_errors false)
  2457.     {
  2458.         return $this->createBatchPaymentAsyncWithHttpInfo($xero_tenant_id$batch_payments$summarize_errors)
  2459.             ->then(
  2460.                 function ($response) {
  2461.                     return $response[0];
  2462.                 }
  2463.             );
  2464.     }
  2465.     /**
  2466.      * Operation createBatchPaymentAsyncWithHttpInfo
  2467.      * Creates one or many batch payments for invoices
  2468.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  2469.      * @param  \XeroAPI\XeroPHP\Models\Accounting\BatchPayments $batch_payments BatchPayments with an array of Payments in body of request (required)
  2470.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  2471.      * @throws \InvalidArgumentException
  2472.      * @return \GuzzleHttp\Promise\PromiseInterface */
  2473.     public function createBatchPaymentAsyncWithHttpInfo($xero_tenant_id$batch_payments$summarize_errors false)
  2474.     {
  2475.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\BatchPayments';
  2476.         $request $this->createBatchPaymentRequest($xero_tenant_id$batch_payments$summarize_errors);
  2477.         return $this->client
  2478.             ->sendAsync($request$this->createHttpClientOption())
  2479.             ->then(
  2480.                 function ($response) use ($returnType) {
  2481.                     $responseBody $response->getBody();
  2482.                     if ($returnType === '\SplFileObject') {
  2483.                         $content $responseBody//stream goes to serializer
  2484.                     } else {
  2485.                         $content $responseBody->getContents();
  2486.                     }
  2487.                     return [
  2488.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  2489.                         $response->getStatusCode(),
  2490.                         $response->getHeaders()
  2491.                     ];
  2492.                 },
  2493.                 function ($exception) {
  2494.                     $response $exception->getResponse();
  2495.                     $statusCode $response->getStatusCode();
  2496.                     throw new ApiException(
  2497.                         sprintf(
  2498.                             '[%d] Error connecting to the API (%s)',
  2499.                             $statusCode,
  2500.                             $exception->getRequest()->getUri()
  2501.                         ),
  2502.                         $statusCode,
  2503.                         $response->getHeaders(),
  2504.                         $response->getBody()
  2505.                     );
  2506.                 }
  2507.             );
  2508.     }
  2509.     /**
  2510.      * Create request for operation 'createBatchPayment'
  2511.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  2512.      * @param  \XeroAPI\XeroPHP\Models\Accounting\BatchPayments $batch_payments BatchPayments with an array of Payments in body of request (required)
  2513.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  2514.      * @throws \InvalidArgumentException
  2515.      * @return \GuzzleHttp\Psr7\Request  */
  2516.     protected function createBatchPaymentRequest($xero_tenant_id$batch_payments$summarize_errors false)
  2517.     {
  2518.         // verify the required parameter 'xero_tenant_id' is set
  2519.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  2520.             throw new \InvalidArgumentException(
  2521.                 'Missing the required parameter $xero_tenant_id when calling createBatchPayment'
  2522.             );
  2523.         }
  2524.         // verify the required parameter 'batch_payments' is set
  2525.         if ($batch_payments === null || (is_array($batch_payments) && count($batch_payments) === 0)) {
  2526.             throw new \InvalidArgumentException(
  2527.                 'Missing the required parameter $batch_payments when calling createBatchPayment'
  2528.             );
  2529.         }
  2530.         $resourcePath '/BatchPayments';
  2531.         $formParams = [];
  2532.         $queryParams = [];
  2533.         $headerParams = [];
  2534.         $httpBody '';
  2535.         $multipart false;
  2536.         // query params
  2537.         if ($summarize_errors !== null) {
  2538.             $queryParams['summarizeErrors'] = $summarize_errors 'true' 'false';
  2539.         }
  2540.         // header params
  2541.         if ($xero_tenant_id !== null) {
  2542.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  2543.         }
  2544.         // body params
  2545.         $_tempBody null;
  2546.         if (isset($batch_payments)) {
  2547.             $_tempBody $batch_payments;
  2548.         }
  2549.         if ($multipart) {
  2550.             $headers $this->headerSelector->selectHeadersForMultipart(
  2551.                 ['application/json']
  2552.             );
  2553.         } else {
  2554.             $headers $this->headerSelector->selectHeaders(
  2555.                 ['application/json'],
  2556.                 ['application/json']
  2557.             );
  2558.         }
  2559.         // for model (json/xml)
  2560.         if (isset($_tempBody)) {
  2561.             // $_tempBody is the method argument, if present
  2562.             if ($headers['Content-Type'] === 'application/json') {
  2563.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  2564.             } else {
  2565.                 $httpBody $_tempBody;
  2566.             }
  2567.         } elseif (count($formParams) > 0) {
  2568.             if ($multipart) {
  2569.                 $multipartContents = [
  2570.                     [
  2571.                         'Content-type' => 'multipart/form-data',
  2572.                     ]
  2573.                 ];
  2574.                 
  2575.                 // for HTTP post (form)
  2576.                 $httpBody = new MultipartStream($multipartContents);
  2577.             } elseif ($headers['Content-Type'] === 'application/json') {
  2578.                 $httpBody \GuzzleHttp\json_encode($formParams);
  2579.             } else {
  2580.                 // for HTTP post (form)
  2581.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  2582.             }
  2583.         }
  2584.         // this endpoint requires OAuth (access token)
  2585.         if ($this->config->getAccessToken() !== null) {
  2586.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  2587.         }
  2588.         $defaultHeaders = [];
  2589.         if ($this->config->getUserAgent()) {
  2590.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  2591.         }
  2592.         $headers array_merge(
  2593.             $defaultHeaders,
  2594.             $headerParams,
  2595.             $headers
  2596.         );
  2597.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  2598.         return new Request(
  2599.             'PUT',
  2600.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  2601.             $headers,
  2602.             $httpBody
  2603.         );
  2604.     }
  2605.     /**
  2606.      * Operation createBatchPaymentHistoryRecord
  2607.      * Creates a history record for a specific batch payment
  2608.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  2609.      * @param  string $batch_payment_id Unique identifier for BatchPayment (required)
  2610.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  2611.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  2612.      * @throws \InvalidArgumentException
  2613.      * @return \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords|\XeroAPI\XeroPHP\Models\Accounting\Error
  2614.      */
  2615.     public function createBatchPaymentHistoryRecord($xero_tenant_id$batch_payment_id$history_records)
  2616.     {
  2617.         list($response) = $this->createBatchPaymentHistoryRecordWithHttpInfo($xero_tenant_id$batch_payment_id$history_records);
  2618.         return $response;
  2619.     }
  2620.     /**
  2621.      * Operation createBatchPaymentHistoryRecordWithHttpInfo
  2622.      * Creates a history record for a specific batch payment
  2623.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  2624.      * @param  string $batch_payment_id Unique identifier for BatchPayment (required)
  2625.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  2626.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  2627.      * @throws \InvalidArgumentException
  2628.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  2629.      */
  2630.     public function createBatchPaymentHistoryRecordWithHttpInfo($xero_tenant_id$batch_payment_id$history_records)
  2631.     {
  2632.         $request $this->createBatchPaymentHistoryRecordRequest($xero_tenant_id$batch_payment_id$history_records);
  2633.         try {
  2634.             $options $this->createHttpClientOption();
  2635.             try {
  2636.                 $response $this->client->send($request$options);
  2637.             } catch (RequestException $e) {
  2638.                 throw new ApiException(
  2639.                     "[{$e->getCode()}{$e->getMessage()}",
  2640.                     $e->getCode(),
  2641.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  2642.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  2643.                 );
  2644.             }
  2645.             $statusCode $response->getStatusCode();
  2646.             if ($statusCode 200 || $statusCode 299) {
  2647.                 throw new ApiException(
  2648.                     sprintf(
  2649.                         '[%d] Error connecting to the API (%s)',
  2650.                         $statusCode,
  2651.                         $request->getUri()
  2652.                     ),
  2653.                     $statusCode,
  2654.                     $response->getHeaders(),
  2655.                     $response->getBody()
  2656.                 );
  2657.             }
  2658.             $responseBody $response->getBody();
  2659.             switch($statusCode) {
  2660.                 case 200:
  2661.                     if ('\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords' === '\SplFileObject') {
  2662.                         $content $responseBody//stream goes to serializer
  2663.                     } else {
  2664.                         $content $responseBody->getContents();
  2665.                     }
  2666.                     return [
  2667.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords', []),
  2668.                         $response->getStatusCode(),
  2669.                         $response->getHeaders()
  2670.                     ];
  2671.                 case 400:
  2672.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  2673.                         $content $responseBody//stream goes to serializer
  2674.                     } else {
  2675.                         $content $responseBody->getContents();
  2676.                     }
  2677.                     return [
  2678.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  2679.                         $response->getStatusCode(),
  2680.                         $response->getHeaders()
  2681.                     ];
  2682.             }
  2683.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  2684.             $responseBody $response->getBody();
  2685.             if ($returnType === '\SplFileObject') {
  2686.                 $content $responseBody//stream goes to serializer
  2687.             } else {
  2688.                 $content $responseBody->getContents();
  2689.             }
  2690.             return [
  2691.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  2692.                 $response->getStatusCode(),
  2693.                 $response->getHeaders()
  2694.             ];
  2695.         } catch (ApiException $e) {
  2696.             switch ($e->getCode()) {
  2697.                 case 200:
  2698.                     $data AccountingObjectSerializer::deserialize(
  2699.                         $e->getResponseBody(),
  2700.                         '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords',
  2701.                         $e->getResponseHeaders()
  2702.                     );
  2703.                     $e->setResponseObject($data);
  2704.                     break;
  2705.                 case 400:
  2706.                     $data AccountingObjectSerializer::deserialize(
  2707.                         $e->getResponseBody(),
  2708.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  2709.                         $e->getResponseHeaders()
  2710.                     );
  2711.                     $e->setResponseObject($data);
  2712.                     break;
  2713.             }
  2714.             throw $e;
  2715.         }
  2716.     }
  2717.     /**
  2718.      * Operation createBatchPaymentHistoryRecordAsync
  2719.      * Creates a history record for a specific batch payment
  2720.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  2721.      * @param  string $batch_payment_id Unique identifier for BatchPayment (required)
  2722.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  2723.      * @throws \InvalidArgumentException
  2724.      * @return \GuzzleHttp\Promise\PromiseInterface
  2725.      */
  2726.     public function createBatchPaymentHistoryRecordAsync($xero_tenant_id$batch_payment_id$history_records)
  2727.     {
  2728.         return $this->createBatchPaymentHistoryRecordAsyncWithHttpInfo($xero_tenant_id$batch_payment_id$history_records)
  2729.             ->then(
  2730.                 function ($response) {
  2731.                     return $response[0];
  2732.                 }
  2733.             );
  2734.     }
  2735.     /**
  2736.      * Operation createBatchPaymentHistoryRecordAsyncWithHttpInfo
  2737.      * Creates a history record for a specific batch payment
  2738.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  2739.      * @param  string $batch_payment_id Unique identifier for BatchPayment (required)
  2740.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  2741.      * @throws \InvalidArgumentException
  2742.      * @return \GuzzleHttp\Promise\PromiseInterface */
  2743.     public function createBatchPaymentHistoryRecordAsyncWithHttpInfo($xero_tenant_id$batch_payment_id$history_records)
  2744.     {
  2745.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  2746.         $request $this->createBatchPaymentHistoryRecordRequest($xero_tenant_id$batch_payment_id$history_records);
  2747.         return $this->client
  2748.             ->sendAsync($request$this->createHttpClientOption())
  2749.             ->then(
  2750.                 function ($response) use ($returnType) {
  2751.                     $responseBody $response->getBody();
  2752.                     if ($returnType === '\SplFileObject') {
  2753.                         $content $responseBody//stream goes to serializer
  2754.                     } else {
  2755.                         $content $responseBody->getContents();
  2756.                     }
  2757.                     return [
  2758.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  2759.                         $response->getStatusCode(),
  2760.                         $response->getHeaders()
  2761.                     ];
  2762.                 },
  2763.                 function ($exception) {
  2764.                     $response $exception->getResponse();
  2765.                     $statusCode $response->getStatusCode();
  2766.                     throw new ApiException(
  2767.                         sprintf(
  2768.                             '[%d] Error connecting to the API (%s)',
  2769.                             $statusCode,
  2770.                             $exception->getRequest()->getUri()
  2771.                         ),
  2772.                         $statusCode,
  2773.                         $response->getHeaders(),
  2774.                         $response->getBody()
  2775.                     );
  2776.                 }
  2777.             );
  2778.     }
  2779.     /**
  2780.      * Create request for operation 'createBatchPaymentHistoryRecord'
  2781.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  2782.      * @param  string $batch_payment_id Unique identifier for BatchPayment (required)
  2783.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  2784.      * @throws \InvalidArgumentException
  2785.      * @return \GuzzleHttp\Psr7\Request  */
  2786.     protected function createBatchPaymentHistoryRecordRequest($xero_tenant_id$batch_payment_id$history_records)
  2787.     {
  2788.         // verify the required parameter 'xero_tenant_id' is set
  2789.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  2790.             throw new \InvalidArgumentException(
  2791.                 'Missing the required parameter $xero_tenant_id when calling createBatchPaymentHistoryRecord'
  2792.             );
  2793.         }
  2794.         // verify the required parameter 'batch_payment_id' is set
  2795.         if ($batch_payment_id === null || (is_array($batch_payment_id) && count($batch_payment_id) === 0)) {
  2796.             throw new \InvalidArgumentException(
  2797.                 'Missing the required parameter $batch_payment_id when calling createBatchPaymentHistoryRecord'
  2798.             );
  2799.         }
  2800.         // verify the required parameter 'history_records' is set
  2801.         if ($history_records === null || (is_array($history_records) && count($history_records) === 0)) {
  2802.             throw new \InvalidArgumentException(
  2803.                 'Missing the required parameter $history_records when calling createBatchPaymentHistoryRecord'
  2804.             );
  2805.         }
  2806.         $resourcePath '/BatchPayments/{BatchPaymentID}/History';
  2807.         $formParams = [];
  2808.         $queryParams = [];
  2809.         $headerParams = [];
  2810.         $httpBody '';
  2811.         $multipart false;
  2812.         // header params
  2813.         if ($xero_tenant_id !== null) {
  2814.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  2815.         }
  2816.         // path params
  2817.         if ($batch_payment_id !== null) {
  2818.             $resourcePath str_replace(
  2819.                 '{' 'BatchPaymentID' '}',
  2820.                 AccountingObjectSerializer::toPathValue($batch_payment_id),
  2821.                 $resourcePath
  2822.             );
  2823.         }
  2824.         // body params
  2825.         $_tempBody null;
  2826.         if (isset($history_records)) {
  2827.             $_tempBody $history_records;
  2828.         }
  2829.         if ($multipart) {
  2830.             $headers $this->headerSelector->selectHeadersForMultipart(
  2831.                 ['application/json']
  2832.             );
  2833.         } else {
  2834.             $headers $this->headerSelector->selectHeaders(
  2835.                 ['application/json'],
  2836.                 ['application/json']
  2837.             );
  2838.         }
  2839.         // for model (json/xml)
  2840.         if (isset($_tempBody)) {
  2841.             // $_tempBody is the method argument, if present
  2842.             if ($headers['Content-Type'] === 'application/json') {
  2843.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  2844.             } else {
  2845.                 $httpBody $_tempBody;
  2846.             }
  2847.         } elseif (count($formParams) > 0) {
  2848.             if ($multipart) {
  2849.                 $multipartContents = [
  2850.                     [
  2851.                         'Content-type' => 'multipart/form-data',
  2852.                     ]
  2853.                 ];
  2854.                 
  2855.                 // for HTTP post (form)
  2856.                 $httpBody = new MultipartStream($multipartContents);
  2857.             } elseif ($headers['Content-Type'] === 'application/json') {
  2858.                 $httpBody \GuzzleHttp\json_encode($formParams);
  2859.             } else {
  2860.                 // for HTTP post (form)
  2861.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  2862.             }
  2863.         }
  2864.         // this endpoint requires OAuth (access token)
  2865.         if ($this->config->getAccessToken() !== null) {
  2866.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  2867.         }
  2868.         $defaultHeaders = [];
  2869.         if ($this->config->getUserAgent()) {
  2870.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  2871.         }
  2872.         $headers array_merge(
  2873.             $defaultHeaders,
  2874.             $headerParams,
  2875.             $headers
  2876.         );
  2877.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  2878.         return new Request(
  2879.             'PUT',
  2880.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  2881.             $headers,
  2882.             $httpBody
  2883.         );
  2884.     }
  2885.     /**
  2886.      * Operation createBrandingThemePaymentServices
  2887.      * Creates a new custom payment service for a specific branding theme
  2888.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  2889.      * @param  string $branding_theme_id Unique identifier for a Branding Theme (required)
  2890.      * @param  \XeroAPI\XeroPHP\Models\Accounting\PaymentServices $payment_services PaymentServices array with PaymentService object in body of request (required)
  2891.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  2892.      * @throws \InvalidArgumentException
  2893.      * @return \XeroAPI\XeroPHP\Models\Accounting\PaymentServices|\XeroAPI\XeroPHP\Models\Accounting\Error
  2894.      */
  2895.     public function createBrandingThemePaymentServices($xero_tenant_id$branding_theme_id$payment_services)
  2896.     {
  2897.         list($response) = $this->createBrandingThemePaymentServicesWithHttpInfo($xero_tenant_id$branding_theme_id$payment_services);
  2898.         return $response;
  2899.     }
  2900.     /**
  2901.      * Operation createBrandingThemePaymentServicesWithHttpInfo
  2902.      * Creates a new custom payment service for a specific branding theme
  2903.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  2904.      * @param  string $branding_theme_id Unique identifier for a Branding Theme (required)
  2905.      * @param  \XeroAPI\XeroPHP\Models\Accounting\PaymentServices $payment_services PaymentServices array with PaymentService object in body of request (required)
  2906.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  2907.      * @throws \InvalidArgumentException
  2908.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\PaymentServices|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  2909.      */
  2910.     public function createBrandingThemePaymentServicesWithHttpInfo($xero_tenant_id$branding_theme_id$payment_services)
  2911.     {
  2912.         $request $this->createBrandingThemePaymentServicesRequest($xero_tenant_id$branding_theme_id$payment_services);
  2913.         try {
  2914.             $options $this->createHttpClientOption();
  2915.             try {
  2916.                 $response $this->client->send($request$options);
  2917.             } catch (RequestException $e) {
  2918.                 throw new ApiException(
  2919.                     "[{$e->getCode()}{$e->getMessage()}",
  2920.                     $e->getCode(),
  2921.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  2922.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  2923.                 );
  2924.             }
  2925.             $statusCode $response->getStatusCode();
  2926.             if ($statusCode 200 || $statusCode 299) {
  2927.                 throw new ApiException(
  2928.                     sprintf(
  2929.                         '[%d] Error connecting to the API (%s)',
  2930.                         $statusCode,
  2931.                         $request->getUri()
  2932.                     ),
  2933.                     $statusCode,
  2934.                     $response->getHeaders(),
  2935.                     $response->getBody()
  2936.                 );
  2937.             }
  2938.             $responseBody $response->getBody();
  2939.             switch($statusCode) {
  2940.                 case 200:
  2941.                     if ('\XeroAPI\XeroPHP\Models\Accounting\PaymentServices' === '\SplFileObject') {
  2942.                         $content $responseBody//stream goes to serializer
  2943.                     } else {
  2944.                         $content $responseBody->getContents();
  2945.                     }
  2946.                     return [
  2947.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\PaymentServices', []),
  2948.                         $response->getStatusCode(),
  2949.                         $response->getHeaders()
  2950.                     ];
  2951.                 case 400:
  2952.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  2953.                         $content $responseBody//stream goes to serializer
  2954.                     } else {
  2955.                         $content $responseBody->getContents();
  2956.                     }
  2957.                     return [
  2958.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  2959.                         $response->getStatusCode(),
  2960.                         $response->getHeaders()
  2961.                     ];
  2962.             }
  2963.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\PaymentServices';
  2964.             $responseBody $response->getBody();
  2965.             if ($returnType === '\SplFileObject') {
  2966.                 $content $responseBody//stream goes to serializer
  2967.             } else {
  2968.                 $content $responseBody->getContents();
  2969.             }
  2970.             return [
  2971.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  2972.                 $response->getStatusCode(),
  2973.                 $response->getHeaders()
  2974.             ];
  2975.         } catch (ApiException $e) {
  2976.             switch ($e->getCode()) {
  2977.                 case 200:
  2978.                     $data AccountingObjectSerializer::deserialize(
  2979.                         $e->getResponseBody(),
  2980.                         '\XeroAPI\XeroPHP\Models\Accounting\PaymentServices',
  2981.                         $e->getResponseHeaders()
  2982.                     );
  2983.                     $e->setResponseObject($data);
  2984.                     break;
  2985.                 case 400:
  2986.                     $data AccountingObjectSerializer::deserialize(
  2987.                         $e->getResponseBody(),
  2988.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  2989.                         $e->getResponseHeaders()
  2990.                     );
  2991.                     $e->setResponseObject($data);
  2992.                     break;
  2993.             }
  2994.             throw $e;
  2995.         }
  2996.     }
  2997.     /**
  2998.      * Operation createBrandingThemePaymentServicesAsync
  2999.      * Creates a new custom payment service for a specific branding theme
  3000.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  3001.      * @param  string $branding_theme_id Unique identifier for a Branding Theme (required)
  3002.      * @param  \XeroAPI\XeroPHP\Models\Accounting\PaymentServices $payment_services PaymentServices array with PaymentService object in body of request (required)
  3003.      * @throws \InvalidArgumentException
  3004.      * @return \GuzzleHttp\Promise\PromiseInterface
  3005.      */
  3006.     public function createBrandingThemePaymentServicesAsync($xero_tenant_id$branding_theme_id$payment_services)
  3007.     {
  3008.         return $this->createBrandingThemePaymentServicesAsyncWithHttpInfo($xero_tenant_id$branding_theme_id$payment_services)
  3009.             ->then(
  3010.                 function ($response) {
  3011.                     return $response[0];
  3012.                 }
  3013.             );
  3014.     }
  3015.     /**
  3016.      * Operation createBrandingThemePaymentServicesAsyncWithHttpInfo
  3017.      * Creates a new custom payment service for a specific branding theme
  3018.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  3019.      * @param  string $branding_theme_id Unique identifier for a Branding Theme (required)
  3020.      * @param  \XeroAPI\XeroPHP\Models\Accounting\PaymentServices $payment_services PaymentServices array with PaymentService object in body of request (required)
  3021.      * @throws \InvalidArgumentException
  3022.      * @return \GuzzleHttp\Promise\PromiseInterface */
  3023.     public function createBrandingThemePaymentServicesAsyncWithHttpInfo($xero_tenant_id$branding_theme_id$payment_services)
  3024.     {
  3025.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\PaymentServices';
  3026.         $request $this->createBrandingThemePaymentServicesRequest($xero_tenant_id$branding_theme_id$payment_services);
  3027.         return $this->client
  3028.             ->sendAsync($request$this->createHttpClientOption())
  3029.             ->then(
  3030.                 function ($response) use ($returnType) {
  3031.                     $responseBody $response->getBody();
  3032.                     if ($returnType === '\SplFileObject') {
  3033.                         $content $responseBody//stream goes to serializer
  3034.                     } else {
  3035.                         $content $responseBody->getContents();
  3036.                     }
  3037.                     return [
  3038.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  3039.                         $response->getStatusCode(),
  3040.                         $response->getHeaders()
  3041.                     ];
  3042.                 },
  3043.                 function ($exception) {
  3044.                     $response $exception->getResponse();
  3045.                     $statusCode $response->getStatusCode();
  3046.                     throw new ApiException(
  3047.                         sprintf(
  3048.                             '[%d] Error connecting to the API (%s)',
  3049.                             $statusCode,
  3050.                             $exception->getRequest()->getUri()
  3051.                         ),
  3052.                         $statusCode,
  3053.                         $response->getHeaders(),
  3054.                         $response->getBody()
  3055.                     );
  3056.                 }
  3057.             );
  3058.     }
  3059.     /**
  3060.      * Create request for operation 'createBrandingThemePaymentServices'
  3061.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  3062.      * @param  string $branding_theme_id Unique identifier for a Branding Theme (required)
  3063.      * @param  \XeroAPI\XeroPHP\Models\Accounting\PaymentServices $payment_services PaymentServices array with PaymentService object in body of request (required)
  3064.      * @throws \InvalidArgumentException
  3065.      * @return \GuzzleHttp\Psr7\Request  */
  3066.     protected function createBrandingThemePaymentServicesRequest($xero_tenant_id$branding_theme_id$payment_services)
  3067.     {
  3068.         // verify the required parameter 'xero_tenant_id' is set
  3069.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  3070.             throw new \InvalidArgumentException(
  3071.                 'Missing the required parameter $xero_tenant_id when calling createBrandingThemePaymentServices'
  3072.             );
  3073.         }
  3074.         // verify the required parameter 'branding_theme_id' is set
  3075.         if ($branding_theme_id === null || (is_array($branding_theme_id) && count($branding_theme_id) === 0)) {
  3076.             throw new \InvalidArgumentException(
  3077.                 'Missing the required parameter $branding_theme_id when calling createBrandingThemePaymentServices'
  3078.             );
  3079.         }
  3080.         // verify the required parameter 'payment_services' is set
  3081.         if ($payment_services === null || (is_array($payment_services) && count($payment_services) === 0)) {
  3082.             throw new \InvalidArgumentException(
  3083.                 'Missing the required parameter $payment_services when calling createBrandingThemePaymentServices'
  3084.             );
  3085.         }
  3086.         $resourcePath '/BrandingThemes/{BrandingThemeID}/PaymentServices';
  3087.         $formParams = [];
  3088.         $queryParams = [];
  3089.         $headerParams = [];
  3090.         $httpBody '';
  3091.         $multipart false;
  3092.         // header params
  3093.         if ($xero_tenant_id !== null) {
  3094.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  3095.         }
  3096.         // path params
  3097.         if ($branding_theme_id !== null) {
  3098.             $resourcePath str_replace(
  3099.                 '{' 'BrandingThemeID' '}',
  3100.                 AccountingObjectSerializer::toPathValue($branding_theme_id),
  3101.                 $resourcePath
  3102.             );
  3103.         }
  3104.         // body params
  3105.         $_tempBody null;
  3106.         if (isset($payment_services)) {
  3107.             $_tempBody $payment_services;
  3108.         }
  3109.         if ($multipart) {
  3110.             $headers $this->headerSelector->selectHeadersForMultipart(
  3111.                 ['application/json']
  3112.             );
  3113.         } else {
  3114.             $headers $this->headerSelector->selectHeaders(
  3115.                 ['application/json'],
  3116.                 ['application/json']
  3117.             );
  3118.         }
  3119.         // for model (json/xml)
  3120.         if (isset($_tempBody)) {
  3121.             // $_tempBody is the method argument, if present
  3122.             if ($headers['Content-Type'] === 'application/json') {
  3123.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  3124.             } else {
  3125.                 $httpBody $_tempBody;
  3126.             }
  3127.         } elseif (count($formParams) > 0) {
  3128.             if ($multipart) {
  3129.                 $multipartContents = [
  3130.                     [
  3131.                         'Content-type' => 'multipart/form-data',
  3132.                     ]
  3133.                 ];
  3134.                 
  3135.                 // for HTTP post (form)
  3136.                 $httpBody = new MultipartStream($multipartContents);
  3137.             } elseif ($headers['Content-Type'] === 'application/json') {
  3138.                 $httpBody \GuzzleHttp\json_encode($formParams);
  3139.             } else {
  3140.                 // for HTTP post (form)
  3141.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  3142.             }
  3143.         }
  3144.         // this endpoint requires OAuth (access token)
  3145.         if ($this->config->getAccessToken() !== null) {
  3146.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  3147.         }
  3148.         $defaultHeaders = [];
  3149.         if ($this->config->getUserAgent()) {
  3150.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  3151.         }
  3152.         $headers array_merge(
  3153.             $defaultHeaders,
  3154.             $headerParams,
  3155.             $headers
  3156.         );
  3157.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  3158.         return new Request(
  3159.             'POST',
  3160.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  3161.             $headers,
  3162.             $httpBody
  3163.         );
  3164.     }
  3165.     /**
  3166.      * Operation createContactAttachmentByFileName
  3167.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  3168.      * @param  string $contact_id Unique identifier for a Contact (required)
  3169.      * @param  string $file_name Name of the attachment (required)
  3170.      * @param  string $body Byte array of file in body of request (required)
  3171.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  3172.      * @throws \InvalidArgumentException
  3173.      * @return \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error
  3174.      */
  3175.     public function createContactAttachmentByFileName($xero_tenant_id$contact_id$file_name$body)
  3176.     {
  3177.         list($response) = $this->createContactAttachmentByFileNameWithHttpInfo($xero_tenant_id$contact_id$file_name$body);
  3178.         return $response;
  3179.     }
  3180.     /**
  3181.      * Operation createContactAttachmentByFileNameWithHttpInfo
  3182.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  3183.      * @param  string $contact_id Unique identifier for a Contact (required)
  3184.      * @param  string $file_name Name of the attachment (required)
  3185.      * @param  string $body Byte array of file in body of request (required)
  3186.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  3187.      * @throws \InvalidArgumentException
  3188.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  3189.      */
  3190.     public function createContactAttachmentByFileNameWithHttpInfo($xero_tenant_id$contact_id$file_name$body)
  3191.     {
  3192.         $request $this->createContactAttachmentByFileNameRequest($xero_tenant_id$contact_id$file_name$body);
  3193.         try {
  3194.             $options $this->createHttpClientOption();
  3195.             try {
  3196.                 $response $this->client->send($request$options);
  3197.             } catch (RequestException $e) {
  3198.                 throw new ApiException(
  3199.                     "[{$e->getCode()}{$e->getMessage()}",
  3200.                     $e->getCode(),
  3201.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  3202.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  3203.                 );
  3204.             }
  3205.             $statusCode $response->getStatusCode();
  3206.             if ($statusCode 200 || $statusCode 299) {
  3207.                 throw new ApiException(
  3208.                     sprintf(
  3209.                         '[%d] Error connecting to the API (%s)',
  3210.                         $statusCode,
  3211.                         $request->getUri()
  3212.                     ),
  3213.                     $statusCode,
  3214.                     $response->getHeaders(),
  3215.                     $response->getBody()
  3216.                 );
  3217.             }
  3218.             $responseBody $response->getBody();
  3219.             switch($statusCode) {
  3220.                 case 200:
  3221.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Attachments' === '\SplFileObject') {
  3222.                         $content $responseBody//stream goes to serializer
  3223.                     } else {
  3224.                         $content $responseBody->getContents();
  3225.                     }
  3226.                     return [
  3227.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Attachments', []),
  3228.                         $response->getStatusCode(),
  3229.                         $response->getHeaders()
  3230.                     ];
  3231.                 case 400:
  3232.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  3233.                         $content $responseBody//stream goes to serializer
  3234.                     } else {
  3235.                         $content $responseBody->getContents();
  3236.                     }
  3237.                     return [
  3238.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  3239.                         $response->getStatusCode(),
  3240.                         $response->getHeaders()
  3241.                     ];
  3242.             }
  3243.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  3244.             $responseBody $response->getBody();
  3245.             if ($returnType === '\SplFileObject') {
  3246.                 $content $responseBody//stream goes to serializer
  3247.             } else {
  3248.                 $content $responseBody->getContents();
  3249.             }
  3250.             return [
  3251.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  3252.                 $response->getStatusCode(),
  3253.                 $response->getHeaders()
  3254.             ];
  3255.         } catch (ApiException $e) {
  3256.             switch ($e->getCode()) {
  3257.                 case 200:
  3258.                     $data AccountingObjectSerializer::deserialize(
  3259.                         $e->getResponseBody(),
  3260.                         '\XeroAPI\XeroPHP\Models\Accounting\Attachments',
  3261.                         $e->getResponseHeaders()
  3262.                     );
  3263.                     $e->setResponseObject($data);
  3264.                     break;
  3265.                 case 400:
  3266.                     $data AccountingObjectSerializer::deserialize(
  3267.                         $e->getResponseBody(),
  3268.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  3269.                         $e->getResponseHeaders()
  3270.                     );
  3271.                     $e->setResponseObject($data);
  3272.                     break;
  3273.             }
  3274.             throw $e;
  3275.         }
  3276.     }
  3277.     /**
  3278.      * Operation createContactAttachmentByFileNameAsync
  3279.      * 
  3280.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  3281.      * @param  string $contact_id Unique identifier for a Contact (required)
  3282.      * @param  string $file_name Name of the attachment (required)
  3283.      * @param  string $body Byte array of file in body of request (required)
  3284.      * @throws \InvalidArgumentException
  3285.      * @return \GuzzleHttp\Promise\PromiseInterface
  3286.      */
  3287.     public function createContactAttachmentByFileNameAsync($xero_tenant_id$contact_id$file_name$body)
  3288.     {
  3289.         return $this->createContactAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$contact_id$file_name$body)
  3290.             ->then(
  3291.                 function ($response) {
  3292.                     return $response[0];
  3293.                 }
  3294.             );
  3295.     }
  3296.     /**
  3297.      * Operation createContactAttachmentByFileNameAsyncWithHttpInfo
  3298.      * 
  3299.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  3300.      * @param  string $contact_id Unique identifier for a Contact (required)
  3301.      * @param  string $file_name Name of the attachment (required)
  3302.      * @param  string $body Byte array of file in body of request (required)
  3303.      * @throws \InvalidArgumentException
  3304.      * @return \GuzzleHttp\Promise\PromiseInterface */
  3305.     public function createContactAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$contact_id$file_name$body)
  3306.     {
  3307.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  3308.         $request $this->createContactAttachmentByFileNameRequest($xero_tenant_id$contact_id$file_name$body);
  3309.         return $this->client
  3310.             ->sendAsync($request$this->createHttpClientOption())
  3311.             ->then(
  3312.                 function ($response) use ($returnType) {
  3313.                     $responseBody $response->getBody();
  3314.                     if ($returnType === '\SplFileObject') {
  3315.                         $content $responseBody//stream goes to serializer
  3316.                     } else {
  3317.                         $content $responseBody->getContents();
  3318.                     }
  3319.                     return [
  3320.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  3321.                         $response->getStatusCode(),
  3322.                         $response->getHeaders()
  3323.                     ];
  3324.                 },
  3325.                 function ($exception) {
  3326.                     $response $exception->getResponse();
  3327.                     $statusCode $response->getStatusCode();
  3328.                     throw new ApiException(
  3329.                         sprintf(
  3330.                             '[%d] Error connecting to the API (%s)',
  3331.                             $statusCode,
  3332.                             $exception->getRequest()->getUri()
  3333.                         ),
  3334.                         $statusCode,
  3335.                         $response->getHeaders(),
  3336.                         $response->getBody()
  3337.                     );
  3338.                 }
  3339.             );
  3340.     }
  3341.     /**
  3342.      * Create request for operation 'createContactAttachmentByFileName'
  3343.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  3344.      * @param  string $contact_id Unique identifier for a Contact (required)
  3345.      * @param  string $file_name Name of the attachment (required)
  3346.      * @param  string $body Byte array of file in body of request (required)
  3347.      * @throws \InvalidArgumentException
  3348.      * @return \GuzzleHttp\Psr7\Request  */
  3349.     protected function createContactAttachmentByFileNameRequest($xero_tenant_id$contact_id$file_name$body)
  3350.     {
  3351.         // verify the required parameter 'xero_tenant_id' is set
  3352.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  3353.             throw new \InvalidArgumentException(
  3354.                 'Missing the required parameter $xero_tenant_id when calling createContactAttachmentByFileName'
  3355.             );
  3356.         }
  3357.         // verify the required parameter 'contact_id' is set
  3358.         if ($contact_id === null || (is_array($contact_id) && count($contact_id) === 0)) {
  3359.             throw new \InvalidArgumentException(
  3360.                 'Missing the required parameter $contact_id when calling createContactAttachmentByFileName'
  3361.             );
  3362.         }
  3363.         // verify the required parameter 'file_name' is set
  3364.         if ($file_name === null || (is_array($file_name) && count($file_name) === 0)) {
  3365.             throw new \InvalidArgumentException(
  3366.                 'Missing the required parameter $file_name when calling createContactAttachmentByFileName'
  3367.             );
  3368.         }
  3369.         // verify the required parameter 'body' is set
  3370.         if ($body === null || (is_array($body) && count($body) === 0)) {
  3371.             throw new \InvalidArgumentException(
  3372.                 'Missing the required parameter $body when calling createContactAttachmentByFileName'
  3373.             );
  3374.         }
  3375.         $resourcePath '/Contacts/{ContactID}/Attachments/{FileName}';
  3376.         $formParams = [];
  3377.         $queryParams = [];
  3378.         $headerParams = [];
  3379.         $httpBody '';
  3380.         $multipart false;
  3381.         // header params
  3382.         if ($xero_tenant_id !== null) {
  3383.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  3384.         }
  3385.         // path params
  3386.         if ($contact_id !== null) {
  3387.             $resourcePath str_replace(
  3388.                 '{' 'ContactID' '}',
  3389.                 AccountingObjectSerializer::toPathValue($contact_id),
  3390.                 $resourcePath
  3391.             );
  3392.         }
  3393.         // path params
  3394.         if ($file_name !== null) {
  3395.             $resourcePath str_replace(
  3396.                 '{' 'FileName' '}',
  3397.                 AccountingObjectSerializer::toPathValue($file_name),
  3398.                 $resourcePath
  3399.             );
  3400.         }
  3401.         // body params
  3402.         $_tempBody null;
  3403.         if (isset($body)) {
  3404.             $_tempBody $body;
  3405.         }
  3406.         if ($multipart) {
  3407.             $headers $this->headerSelector->selectHeadersForMultipart(
  3408.                 ['application/json']
  3409.             );
  3410.         } else {
  3411.             $headers $this->headerSelector->selectHeaders(
  3412.                 ['application/json'],
  3413.                 ['application/octet-stream']
  3414.             );
  3415.         }
  3416.         // for model (json/xml)
  3417.         if (isset($_tempBody)) {
  3418.             // $_tempBody is the method argument, if present
  3419.             if ($headers['Content-Type'] === 'application/json') {
  3420.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  3421.             } else {
  3422.                 $httpBody $_tempBody;
  3423.             }
  3424.         } elseif (count($formParams) > 0) {
  3425.             if ($multipart) {
  3426.                 $multipartContents = [
  3427.                     [
  3428.                         'Content-type' => 'multipart/form-data',
  3429.                     ]
  3430.                 ];
  3431.                 
  3432.                 // for HTTP post (form)
  3433.                 $httpBody = new MultipartStream($multipartContents);
  3434.             } elseif ($headers['Content-Type'] === 'application/json') {
  3435.                 $httpBody \GuzzleHttp\json_encode($formParams);
  3436.             } else {
  3437.                 // for HTTP post (form)
  3438.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  3439.             }
  3440.         }
  3441.         // this endpoint requires OAuth (access token)
  3442.         if ($this->config->getAccessToken() !== null) {
  3443.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  3444.         }
  3445.         $defaultHeaders = [];
  3446.         if ($this->config->getUserAgent()) {
  3447.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  3448.         }
  3449.         $headers array_merge(
  3450.             $defaultHeaders,
  3451.             $headerParams,
  3452.             $headers
  3453.         );
  3454.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  3455.         return new Request(
  3456.             'PUT',
  3457.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  3458.             $headers,
  3459.             $httpBody
  3460.         );
  3461.     }
  3462.     /**
  3463.      * Operation createContactGroup
  3464.      * Creates a contact group
  3465.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  3466.      * @param  \XeroAPI\XeroPHP\Models\Accounting\ContactGroups $contact_groups ContactGroups with an array of names in request body (required)
  3467.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  3468.      * @throws \InvalidArgumentException
  3469.      * @return \XeroAPI\XeroPHP\Models\Accounting\ContactGroups|\XeroAPI\XeroPHP\Models\Accounting\Error
  3470.      */
  3471.     public function createContactGroup($xero_tenant_id$contact_groups)
  3472.     {
  3473.         list($response) = $this->createContactGroupWithHttpInfo($xero_tenant_id$contact_groups);
  3474.         return $response;
  3475.     }
  3476.     /**
  3477.      * Operation createContactGroupWithHttpInfo
  3478.      * Creates a contact group
  3479.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  3480.      * @param  \XeroAPI\XeroPHP\Models\Accounting\ContactGroups $contact_groups ContactGroups with an array of names in request body (required)
  3481.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  3482.      * @throws \InvalidArgumentException
  3483.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\ContactGroups|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  3484.      */
  3485.     public function createContactGroupWithHttpInfo($xero_tenant_id$contact_groups)
  3486.     {
  3487.         $request $this->createContactGroupRequest($xero_tenant_id$contact_groups);
  3488.         try {
  3489.             $options $this->createHttpClientOption();
  3490.             try {
  3491.                 $response $this->client->send($request$options);
  3492.             } catch (RequestException $e) {
  3493.                 throw new ApiException(
  3494.                     "[{$e->getCode()}{$e->getMessage()}",
  3495.                     $e->getCode(),
  3496.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  3497.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  3498.                 );
  3499.             }
  3500.             $statusCode $response->getStatusCode();
  3501.             if ($statusCode 200 || $statusCode 299) {
  3502.                 throw new ApiException(
  3503.                     sprintf(
  3504.                         '[%d] Error connecting to the API (%s)',
  3505.                         $statusCode,
  3506.                         $request->getUri()
  3507.                     ),
  3508.                     $statusCode,
  3509.                     $response->getHeaders(),
  3510.                     $response->getBody()
  3511.                 );
  3512.             }
  3513.             $responseBody $response->getBody();
  3514.             switch($statusCode) {
  3515.                 case 200:
  3516.                     if ('\XeroAPI\XeroPHP\Models\Accounting\ContactGroups' === '\SplFileObject') {
  3517.                         $content $responseBody//stream goes to serializer
  3518.                     } else {
  3519.                         $content $responseBody->getContents();
  3520.                     }
  3521.                     return [
  3522.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\ContactGroups', []),
  3523.                         $response->getStatusCode(),
  3524.                         $response->getHeaders()
  3525.                     ];
  3526.                 case 400:
  3527.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  3528.                         $content $responseBody//stream goes to serializer
  3529.                     } else {
  3530.                         $content $responseBody->getContents();
  3531.                     }
  3532.                     return [
  3533.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  3534.                         $response->getStatusCode(),
  3535.                         $response->getHeaders()
  3536.                     ];
  3537.             }
  3538.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\ContactGroups';
  3539.             $responseBody $response->getBody();
  3540.             if ($returnType === '\SplFileObject') {
  3541.                 $content $responseBody//stream goes to serializer
  3542.             } else {
  3543.                 $content $responseBody->getContents();
  3544.             }
  3545.             return [
  3546.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  3547.                 $response->getStatusCode(),
  3548.                 $response->getHeaders()
  3549.             ];
  3550.         } catch (ApiException $e) {
  3551.             switch ($e->getCode()) {
  3552.                 case 200:
  3553.                     $data AccountingObjectSerializer::deserialize(
  3554.                         $e->getResponseBody(),
  3555.                         '\XeroAPI\XeroPHP\Models\Accounting\ContactGroups',
  3556.                         $e->getResponseHeaders()
  3557.                     );
  3558.                     $e->setResponseObject($data);
  3559.                     break;
  3560.                 case 400:
  3561.                     $data AccountingObjectSerializer::deserialize(
  3562.                         $e->getResponseBody(),
  3563.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  3564.                         $e->getResponseHeaders()
  3565.                     );
  3566.                     $e->setResponseObject($data);
  3567.                     break;
  3568.             }
  3569.             throw $e;
  3570.         }
  3571.     }
  3572.     /**
  3573.      * Operation createContactGroupAsync
  3574.      * Creates a contact group
  3575.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  3576.      * @param  \XeroAPI\XeroPHP\Models\Accounting\ContactGroups $contact_groups ContactGroups with an array of names in request body (required)
  3577.      * @throws \InvalidArgumentException
  3578.      * @return \GuzzleHttp\Promise\PromiseInterface
  3579.      */
  3580.     public function createContactGroupAsync($xero_tenant_id$contact_groups)
  3581.     {
  3582.         return $this->createContactGroupAsyncWithHttpInfo($xero_tenant_id$contact_groups)
  3583.             ->then(
  3584.                 function ($response) {
  3585.                     return $response[0];
  3586.                 }
  3587.             );
  3588.     }
  3589.     /**
  3590.      * Operation createContactGroupAsyncWithHttpInfo
  3591.      * Creates a contact group
  3592.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  3593.      * @param  \XeroAPI\XeroPHP\Models\Accounting\ContactGroups $contact_groups ContactGroups with an array of names in request body (required)
  3594.      * @throws \InvalidArgumentException
  3595.      * @return \GuzzleHttp\Promise\PromiseInterface */
  3596.     public function createContactGroupAsyncWithHttpInfo($xero_tenant_id$contact_groups)
  3597.     {
  3598.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\ContactGroups';
  3599.         $request $this->createContactGroupRequest($xero_tenant_id$contact_groups);
  3600.         return $this->client
  3601.             ->sendAsync($request$this->createHttpClientOption())
  3602.             ->then(
  3603.                 function ($response) use ($returnType) {
  3604.                     $responseBody $response->getBody();
  3605.                     if ($returnType === '\SplFileObject') {
  3606.                         $content $responseBody//stream goes to serializer
  3607.                     } else {
  3608.                         $content $responseBody->getContents();
  3609.                     }
  3610.                     return [
  3611.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  3612.                         $response->getStatusCode(),
  3613.                         $response->getHeaders()
  3614.                     ];
  3615.                 },
  3616.                 function ($exception) {
  3617.                     $response $exception->getResponse();
  3618.                     $statusCode $response->getStatusCode();
  3619.                     throw new ApiException(
  3620.                         sprintf(
  3621.                             '[%d] Error connecting to the API (%s)',
  3622.                             $statusCode,
  3623.                             $exception->getRequest()->getUri()
  3624.                         ),
  3625.                         $statusCode,
  3626.                         $response->getHeaders(),
  3627.                         $response->getBody()
  3628.                     );
  3629.                 }
  3630.             );
  3631.     }
  3632.     /**
  3633.      * Create request for operation 'createContactGroup'
  3634.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  3635.      * @param  \XeroAPI\XeroPHP\Models\Accounting\ContactGroups $contact_groups ContactGroups with an array of names in request body (required)
  3636.      * @throws \InvalidArgumentException
  3637.      * @return \GuzzleHttp\Psr7\Request  */
  3638.     protected function createContactGroupRequest($xero_tenant_id$contact_groups)
  3639.     {
  3640.         // verify the required parameter 'xero_tenant_id' is set
  3641.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  3642.             throw new \InvalidArgumentException(
  3643.                 'Missing the required parameter $xero_tenant_id when calling createContactGroup'
  3644.             );
  3645.         }
  3646.         // verify the required parameter 'contact_groups' is set
  3647.         if ($contact_groups === null || (is_array($contact_groups) && count($contact_groups) === 0)) {
  3648.             throw new \InvalidArgumentException(
  3649.                 'Missing the required parameter $contact_groups when calling createContactGroup'
  3650.             );
  3651.         }
  3652.         $resourcePath '/ContactGroups';
  3653.         $formParams = [];
  3654.         $queryParams = [];
  3655.         $headerParams = [];
  3656.         $httpBody '';
  3657.         $multipart false;
  3658.         // header params
  3659.         if ($xero_tenant_id !== null) {
  3660.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  3661.         }
  3662.         // body params
  3663.         $_tempBody null;
  3664.         if (isset($contact_groups)) {
  3665.             $_tempBody $contact_groups;
  3666.         }
  3667.         if ($multipart) {
  3668.             $headers $this->headerSelector->selectHeadersForMultipart(
  3669.                 ['application/json']
  3670.             );
  3671.         } else {
  3672.             $headers $this->headerSelector->selectHeaders(
  3673.                 ['application/json'],
  3674.                 ['application/json']
  3675.             );
  3676.         }
  3677.         // for model (json/xml)
  3678.         if (isset($_tempBody)) {
  3679.             // $_tempBody is the method argument, if present
  3680.             if ($headers['Content-Type'] === 'application/json') {
  3681.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  3682.             } else {
  3683.                 $httpBody $_tempBody;
  3684.             }
  3685.         } elseif (count($formParams) > 0) {
  3686.             if ($multipart) {
  3687.                 $multipartContents = [
  3688.                     [
  3689.                         'Content-type' => 'multipart/form-data',
  3690.                     ]
  3691.                 ];
  3692.                 
  3693.                 // for HTTP post (form)
  3694.                 $httpBody = new MultipartStream($multipartContents);
  3695.             } elseif ($headers['Content-Type'] === 'application/json') {
  3696.                 $httpBody \GuzzleHttp\json_encode($formParams);
  3697.             } else {
  3698.                 // for HTTP post (form)
  3699.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  3700.             }
  3701.         }
  3702.         // this endpoint requires OAuth (access token)
  3703.         if ($this->config->getAccessToken() !== null) {
  3704.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  3705.         }
  3706.         $defaultHeaders = [];
  3707.         if ($this->config->getUserAgent()) {
  3708.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  3709.         }
  3710.         $headers array_merge(
  3711.             $defaultHeaders,
  3712.             $headerParams,
  3713.             $headers
  3714.         );
  3715.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  3716.         return new Request(
  3717.             'PUT',
  3718.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  3719.             $headers,
  3720.             $httpBody
  3721.         );
  3722.     }
  3723.     /**
  3724.      * Operation createContactGroupContacts
  3725.      * Creates contacts to a specific contact group
  3726.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  3727.      * @param  string $contact_group_id Unique identifier for a Contact Group (required)
  3728.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Contacts $contacts Contacts with array of contacts specifying the ContactID to be added to ContactGroup in body of request (required)
  3729.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  3730.      * @throws \InvalidArgumentException
  3731.      * @return \XeroAPI\XeroPHP\Models\Accounting\Contacts|\XeroAPI\XeroPHP\Models\Accounting\Error
  3732.      */
  3733.     public function createContactGroupContacts($xero_tenant_id$contact_group_id$contacts)
  3734.     {
  3735.         list($response) = $this->createContactGroupContactsWithHttpInfo($xero_tenant_id$contact_group_id$contacts);
  3736.         return $response;
  3737.     }
  3738.     /**
  3739.      * Operation createContactGroupContactsWithHttpInfo
  3740.      * Creates contacts to a specific contact group
  3741.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  3742.      * @param  string $contact_group_id Unique identifier for a Contact Group (required)
  3743.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Contacts $contacts Contacts with array of contacts specifying the ContactID to be added to ContactGroup in body of request (required)
  3744.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  3745.      * @throws \InvalidArgumentException
  3746.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Contacts|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  3747.      */
  3748.     public function createContactGroupContactsWithHttpInfo($xero_tenant_id$contact_group_id$contacts)
  3749.     {
  3750.         $request $this->createContactGroupContactsRequest($xero_tenant_id$contact_group_id$contacts);
  3751.         try {
  3752.             $options $this->createHttpClientOption();
  3753.             try {
  3754.                 $response $this->client->send($request$options);
  3755.             } catch (RequestException $e) {
  3756.                 throw new ApiException(
  3757.                     "[{$e->getCode()}{$e->getMessage()}",
  3758.                     $e->getCode(),
  3759.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  3760.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  3761.                 );
  3762.             }
  3763.             $statusCode $response->getStatusCode();
  3764.             if ($statusCode 200 || $statusCode 299) {
  3765.                 throw new ApiException(
  3766.                     sprintf(
  3767.                         '[%d] Error connecting to the API (%s)',
  3768.                         $statusCode,
  3769.                         $request->getUri()
  3770.                     ),
  3771.                     $statusCode,
  3772.                     $response->getHeaders(),
  3773.                     $response->getBody()
  3774.                 );
  3775.             }
  3776.             $responseBody $response->getBody();
  3777.             switch($statusCode) {
  3778.                 case 200:
  3779.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Contacts' === '\SplFileObject') {
  3780.                         $content $responseBody//stream goes to serializer
  3781.                     } else {
  3782.                         $content $responseBody->getContents();
  3783.                     }
  3784.                     return [
  3785.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Contacts', []),
  3786.                         $response->getStatusCode(),
  3787.                         $response->getHeaders()
  3788.                     ];
  3789.                 case 400:
  3790.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  3791.                         $content $responseBody//stream goes to serializer
  3792.                     } else {
  3793.                         $content $responseBody->getContents();
  3794.                     }
  3795.                     return [
  3796.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  3797.                         $response->getStatusCode(),
  3798.                         $response->getHeaders()
  3799.                     ];
  3800.             }
  3801.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Contacts';
  3802.             $responseBody $response->getBody();
  3803.             if ($returnType === '\SplFileObject') {
  3804.                 $content $responseBody//stream goes to serializer
  3805.             } else {
  3806.                 $content $responseBody->getContents();
  3807.             }
  3808.             return [
  3809.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  3810.                 $response->getStatusCode(),
  3811.                 $response->getHeaders()
  3812.             ];
  3813.         } catch (ApiException $e) {
  3814.             switch ($e->getCode()) {
  3815.                 case 200:
  3816.                     $data AccountingObjectSerializer::deserialize(
  3817.                         $e->getResponseBody(),
  3818.                         '\XeroAPI\XeroPHP\Models\Accounting\Contacts',
  3819.                         $e->getResponseHeaders()
  3820.                     );
  3821.                     $e->setResponseObject($data);
  3822.                     break;
  3823.                 case 400:
  3824.                     $data AccountingObjectSerializer::deserialize(
  3825.                         $e->getResponseBody(),
  3826.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  3827.                         $e->getResponseHeaders()
  3828.                     );
  3829.                     $e->setResponseObject($data);
  3830.                     break;
  3831.             }
  3832.             throw $e;
  3833.         }
  3834.     }
  3835.     /**
  3836.      * Operation createContactGroupContactsAsync
  3837.      * Creates contacts to a specific contact group
  3838.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  3839.      * @param  string $contact_group_id Unique identifier for a Contact Group (required)
  3840.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Contacts $contacts Contacts with array of contacts specifying the ContactID to be added to ContactGroup in body of request (required)
  3841.      * @throws \InvalidArgumentException
  3842.      * @return \GuzzleHttp\Promise\PromiseInterface
  3843.      */
  3844.     public function createContactGroupContactsAsync($xero_tenant_id$contact_group_id$contacts)
  3845.     {
  3846.         return $this->createContactGroupContactsAsyncWithHttpInfo($xero_tenant_id$contact_group_id$contacts)
  3847.             ->then(
  3848.                 function ($response) {
  3849.                     return $response[0];
  3850.                 }
  3851.             );
  3852.     }
  3853.     /**
  3854.      * Operation createContactGroupContactsAsyncWithHttpInfo
  3855.      * Creates contacts to a specific contact group
  3856.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  3857.      * @param  string $contact_group_id Unique identifier for a Contact Group (required)
  3858.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Contacts $contacts Contacts with array of contacts specifying the ContactID to be added to ContactGroup in body of request (required)
  3859.      * @throws \InvalidArgumentException
  3860.      * @return \GuzzleHttp\Promise\PromiseInterface */
  3861.     public function createContactGroupContactsAsyncWithHttpInfo($xero_tenant_id$contact_group_id$contacts)
  3862.     {
  3863.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Contacts';
  3864.         $request $this->createContactGroupContactsRequest($xero_tenant_id$contact_group_id$contacts);
  3865.         return $this->client
  3866.             ->sendAsync($request$this->createHttpClientOption())
  3867.             ->then(
  3868.                 function ($response) use ($returnType) {
  3869.                     $responseBody $response->getBody();
  3870.                     if ($returnType === '\SplFileObject') {
  3871.                         $content $responseBody//stream goes to serializer
  3872.                     } else {
  3873.                         $content $responseBody->getContents();
  3874.                     }
  3875.                     return [
  3876.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  3877.                         $response->getStatusCode(),
  3878.                         $response->getHeaders()
  3879.                     ];
  3880.                 },
  3881.                 function ($exception) {
  3882.                     $response $exception->getResponse();
  3883.                     $statusCode $response->getStatusCode();
  3884.                     throw new ApiException(
  3885.                         sprintf(
  3886.                             '[%d] Error connecting to the API (%s)',
  3887.                             $statusCode,
  3888.                             $exception->getRequest()->getUri()
  3889.                         ),
  3890.                         $statusCode,
  3891.                         $response->getHeaders(),
  3892.                         $response->getBody()
  3893.                     );
  3894.                 }
  3895.             );
  3896.     }
  3897.     /**
  3898.      * Create request for operation 'createContactGroupContacts'
  3899.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  3900.      * @param  string $contact_group_id Unique identifier for a Contact Group (required)
  3901.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Contacts $contacts Contacts with array of contacts specifying the ContactID to be added to ContactGroup in body of request (required)
  3902.      * @throws \InvalidArgumentException
  3903.      * @return \GuzzleHttp\Psr7\Request  */
  3904.     protected function createContactGroupContactsRequest($xero_tenant_id$contact_group_id$contacts)
  3905.     {
  3906.         // verify the required parameter 'xero_tenant_id' is set
  3907.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  3908.             throw new \InvalidArgumentException(
  3909.                 'Missing the required parameter $xero_tenant_id when calling createContactGroupContacts'
  3910.             );
  3911.         }
  3912.         // verify the required parameter 'contact_group_id' is set
  3913.         if ($contact_group_id === null || (is_array($contact_group_id) && count($contact_group_id) === 0)) {
  3914.             throw new \InvalidArgumentException(
  3915.                 'Missing the required parameter $contact_group_id when calling createContactGroupContacts'
  3916.             );
  3917.         }
  3918.         // verify the required parameter 'contacts' is set
  3919.         if ($contacts === null || (is_array($contacts) && count($contacts) === 0)) {
  3920.             throw new \InvalidArgumentException(
  3921.                 'Missing the required parameter $contacts when calling createContactGroupContacts'
  3922.             );
  3923.         }
  3924.         $resourcePath '/ContactGroups/{ContactGroupID}/Contacts';
  3925.         $formParams = [];
  3926.         $queryParams = [];
  3927.         $headerParams = [];
  3928.         $httpBody '';
  3929.         $multipart false;
  3930.         // header params
  3931.         if ($xero_tenant_id !== null) {
  3932.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  3933.         }
  3934.         // path params
  3935.         if ($contact_group_id !== null) {
  3936.             $resourcePath str_replace(
  3937.                 '{' 'ContactGroupID' '}',
  3938.                 AccountingObjectSerializer::toPathValue($contact_group_id),
  3939.                 $resourcePath
  3940.             );
  3941.         }
  3942.         // body params
  3943.         $_tempBody null;
  3944.         if (isset($contacts)) {
  3945.             $_tempBody $contacts;
  3946.         }
  3947.         if ($multipart) {
  3948.             $headers $this->headerSelector->selectHeadersForMultipart(
  3949.                 ['application/json']
  3950.             );
  3951.         } else {
  3952.             $headers $this->headerSelector->selectHeaders(
  3953.                 ['application/json'],
  3954.                 ['application/json']
  3955.             );
  3956.         }
  3957.         // for model (json/xml)
  3958.         if (isset($_tempBody)) {
  3959.             // $_tempBody is the method argument, if present
  3960.             if ($headers['Content-Type'] === 'application/json') {
  3961.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  3962.             } else {
  3963.                 $httpBody $_tempBody;
  3964.             }
  3965.         } elseif (count($formParams) > 0) {
  3966.             if ($multipart) {
  3967.                 $multipartContents = [
  3968.                     [
  3969.                         'Content-type' => 'multipart/form-data',
  3970.                     ]
  3971.                 ];
  3972.                 
  3973.                 // for HTTP post (form)
  3974.                 $httpBody = new MultipartStream($multipartContents);
  3975.             } elseif ($headers['Content-Type'] === 'application/json') {
  3976.                 $httpBody \GuzzleHttp\json_encode($formParams);
  3977.             } else {
  3978.                 // for HTTP post (form)
  3979.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  3980.             }
  3981.         }
  3982.         // this endpoint requires OAuth (access token)
  3983.         if ($this->config->getAccessToken() !== null) {
  3984.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  3985.         }
  3986.         $defaultHeaders = [];
  3987.         if ($this->config->getUserAgent()) {
  3988.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  3989.         }
  3990.         $headers array_merge(
  3991.             $defaultHeaders,
  3992.             $headerParams,
  3993.             $headers
  3994.         );
  3995.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  3996.         return new Request(
  3997.             'PUT',
  3998.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  3999.             $headers,
  4000.             $httpBody
  4001.         );
  4002.     }
  4003.     /**
  4004.      * Operation createContactHistory
  4005.      * Creates a new history record for a specific contact
  4006.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  4007.      * @param  string $contact_id Unique identifier for a Contact (required)
  4008.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  4009.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  4010.      * @throws \InvalidArgumentException
  4011.      * @return \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords|\XeroAPI\XeroPHP\Models\Accounting\Error
  4012.      */
  4013.     public function createContactHistory($xero_tenant_id$contact_id$history_records)
  4014.     {
  4015.         list($response) = $this->createContactHistoryWithHttpInfo($xero_tenant_id$contact_id$history_records);
  4016.         return $response;
  4017.     }
  4018.     /**
  4019.      * Operation createContactHistoryWithHttpInfo
  4020.      * Creates a new history record for a specific contact
  4021.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  4022.      * @param  string $contact_id Unique identifier for a Contact (required)
  4023.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  4024.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  4025.      * @throws \InvalidArgumentException
  4026.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  4027.      */
  4028.     public function createContactHistoryWithHttpInfo($xero_tenant_id$contact_id$history_records)
  4029.     {
  4030.         $request $this->createContactHistoryRequest($xero_tenant_id$contact_id$history_records);
  4031.         try {
  4032.             $options $this->createHttpClientOption();
  4033.             try {
  4034.                 $response $this->client->send($request$options);
  4035.             } catch (RequestException $e) {
  4036.                 throw new ApiException(
  4037.                     "[{$e->getCode()}{$e->getMessage()}",
  4038.                     $e->getCode(),
  4039.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  4040.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  4041.                 );
  4042.             }
  4043.             $statusCode $response->getStatusCode();
  4044.             if ($statusCode 200 || $statusCode 299) {
  4045.                 throw new ApiException(
  4046.                     sprintf(
  4047.                         '[%d] Error connecting to the API (%s)',
  4048.                         $statusCode,
  4049.                         $request->getUri()
  4050.                     ),
  4051.                     $statusCode,
  4052.                     $response->getHeaders(),
  4053.                     $response->getBody()
  4054.                 );
  4055.             }
  4056.             $responseBody $response->getBody();
  4057.             switch($statusCode) {
  4058.                 case 200:
  4059.                     if ('\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords' === '\SplFileObject') {
  4060.                         $content $responseBody//stream goes to serializer
  4061.                     } else {
  4062.                         $content $responseBody->getContents();
  4063.                     }
  4064.                     return [
  4065.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords', []),
  4066.                         $response->getStatusCode(),
  4067.                         $response->getHeaders()
  4068.                     ];
  4069.                 case 400:
  4070.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  4071.                         $content $responseBody//stream goes to serializer
  4072.                     } else {
  4073.                         $content $responseBody->getContents();
  4074.                     }
  4075.                     return [
  4076.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  4077.                         $response->getStatusCode(),
  4078.                         $response->getHeaders()
  4079.                     ];
  4080.             }
  4081.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  4082.             $responseBody $response->getBody();
  4083.             if ($returnType === '\SplFileObject') {
  4084.                 $content $responseBody//stream goes to serializer
  4085.             } else {
  4086.                 $content $responseBody->getContents();
  4087.             }
  4088.             return [
  4089.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  4090.                 $response->getStatusCode(),
  4091.                 $response->getHeaders()
  4092.             ];
  4093.         } catch (ApiException $e) {
  4094.             switch ($e->getCode()) {
  4095.                 case 200:
  4096.                     $data AccountingObjectSerializer::deserialize(
  4097.                         $e->getResponseBody(),
  4098.                         '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords',
  4099.                         $e->getResponseHeaders()
  4100.                     );
  4101.                     $e->setResponseObject($data);
  4102.                     break;
  4103.                 case 400:
  4104.                     $data AccountingObjectSerializer::deserialize(
  4105.                         $e->getResponseBody(),
  4106.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  4107.                         $e->getResponseHeaders()
  4108.                     );
  4109.                     $e->setResponseObject($data);
  4110.                     break;
  4111.             }
  4112.             throw $e;
  4113.         }
  4114.     }
  4115.     /**
  4116.      * Operation createContactHistoryAsync
  4117.      * Creates a new history record for a specific contact
  4118.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  4119.      * @param  string $contact_id Unique identifier for a Contact (required)
  4120.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  4121.      * @throws \InvalidArgumentException
  4122.      * @return \GuzzleHttp\Promise\PromiseInterface
  4123.      */
  4124.     public function createContactHistoryAsync($xero_tenant_id$contact_id$history_records)
  4125.     {
  4126.         return $this->createContactHistoryAsyncWithHttpInfo($xero_tenant_id$contact_id$history_records)
  4127.             ->then(
  4128.                 function ($response) {
  4129.                     return $response[0];
  4130.                 }
  4131.             );
  4132.     }
  4133.     /**
  4134.      * Operation createContactHistoryAsyncWithHttpInfo
  4135.      * Creates a new history record for a specific contact
  4136.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  4137.      * @param  string $contact_id Unique identifier for a Contact (required)
  4138.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  4139.      * @throws \InvalidArgumentException
  4140.      * @return \GuzzleHttp\Promise\PromiseInterface */
  4141.     public function createContactHistoryAsyncWithHttpInfo($xero_tenant_id$contact_id$history_records)
  4142.     {
  4143.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  4144.         $request $this->createContactHistoryRequest($xero_tenant_id$contact_id$history_records);
  4145.         return $this->client
  4146.             ->sendAsync($request$this->createHttpClientOption())
  4147.             ->then(
  4148.                 function ($response) use ($returnType) {
  4149.                     $responseBody $response->getBody();
  4150.                     if ($returnType === '\SplFileObject') {
  4151.                         $content $responseBody//stream goes to serializer
  4152.                     } else {
  4153.                         $content $responseBody->getContents();
  4154.                     }
  4155.                     return [
  4156.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  4157.                         $response->getStatusCode(),
  4158.                         $response->getHeaders()
  4159.                     ];
  4160.                 },
  4161.                 function ($exception) {
  4162.                     $response $exception->getResponse();
  4163.                     $statusCode $response->getStatusCode();
  4164.                     throw new ApiException(
  4165.                         sprintf(
  4166.                             '[%d] Error connecting to the API (%s)',
  4167.                             $statusCode,
  4168.                             $exception->getRequest()->getUri()
  4169.                         ),
  4170.                         $statusCode,
  4171.                         $response->getHeaders(),
  4172.                         $response->getBody()
  4173.                     );
  4174.                 }
  4175.             );
  4176.     }
  4177.     /**
  4178.      * Create request for operation 'createContactHistory'
  4179.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  4180.      * @param  string $contact_id Unique identifier for a Contact (required)
  4181.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  4182.      * @throws \InvalidArgumentException
  4183.      * @return \GuzzleHttp\Psr7\Request  */
  4184.     protected function createContactHistoryRequest($xero_tenant_id$contact_id$history_records)
  4185.     {
  4186.         // verify the required parameter 'xero_tenant_id' is set
  4187.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  4188.             throw new \InvalidArgumentException(
  4189.                 'Missing the required parameter $xero_tenant_id when calling createContactHistory'
  4190.             );
  4191.         }
  4192.         // verify the required parameter 'contact_id' is set
  4193.         if ($contact_id === null || (is_array($contact_id) && count($contact_id) === 0)) {
  4194.             throw new \InvalidArgumentException(
  4195.                 'Missing the required parameter $contact_id when calling createContactHistory'
  4196.             );
  4197.         }
  4198.         // verify the required parameter 'history_records' is set
  4199.         if ($history_records === null || (is_array($history_records) && count($history_records) === 0)) {
  4200.             throw new \InvalidArgumentException(
  4201.                 'Missing the required parameter $history_records when calling createContactHistory'
  4202.             );
  4203.         }
  4204.         $resourcePath '/Contacts/{ContactID}/History';
  4205.         $formParams = [];
  4206.         $queryParams = [];
  4207.         $headerParams = [];
  4208.         $httpBody '';
  4209.         $multipart false;
  4210.         // header params
  4211.         if ($xero_tenant_id !== null) {
  4212.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  4213.         }
  4214.         // path params
  4215.         if ($contact_id !== null) {
  4216.             $resourcePath str_replace(
  4217.                 '{' 'ContactID' '}',
  4218.                 AccountingObjectSerializer::toPathValue($contact_id),
  4219.                 $resourcePath
  4220.             );
  4221.         }
  4222.         // body params
  4223.         $_tempBody null;
  4224.         if (isset($history_records)) {
  4225.             $_tempBody $history_records;
  4226.         }
  4227.         if ($multipart) {
  4228.             $headers $this->headerSelector->selectHeadersForMultipart(
  4229.                 ['application/json']
  4230.             );
  4231.         } else {
  4232.             $headers $this->headerSelector->selectHeaders(
  4233.                 ['application/json'],
  4234.                 ['application/json']
  4235.             );
  4236.         }
  4237.         // for model (json/xml)
  4238.         if (isset($_tempBody)) {
  4239.             // $_tempBody is the method argument, if present
  4240.             if ($headers['Content-Type'] === 'application/json') {
  4241.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  4242.             } else {
  4243.                 $httpBody $_tempBody;
  4244.             }
  4245.         } elseif (count($formParams) > 0) {
  4246.             if ($multipart) {
  4247.                 $multipartContents = [
  4248.                     [
  4249.                         'Content-type' => 'multipart/form-data',
  4250.                     ]
  4251.                 ];
  4252.                 
  4253.                 // for HTTP post (form)
  4254.                 $httpBody = new MultipartStream($multipartContents);
  4255.             } elseif ($headers['Content-Type'] === 'application/json') {
  4256.                 $httpBody \GuzzleHttp\json_encode($formParams);
  4257.             } else {
  4258.                 // for HTTP post (form)
  4259.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  4260.             }
  4261.         }
  4262.         // this endpoint requires OAuth (access token)
  4263.         if ($this->config->getAccessToken() !== null) {
  4264.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  4265.         }
  4266.         $defaultHeaders = [];
  4267.         if ($this->config->getUserAgent()) {
  4268.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  4269.         }
  4270.         $headers array_merge(
  4271.             $defaultHeaders,
  4272.             $headerParams,
  4273.             $headers
  4274.         );
  4275.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  4276.         return new Request(
  4277.             'PUT',
  4278.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  4279.             $headers,
  4280.             $httpBody
  4281.         );
  4282.     }
  4283.     /**
  4284.      * Operation createContacts
  4285.      * Creates multiple contacts (bulk) in a Xero organisation
  4286.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  4287.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Contacts $contacts Contacts with an array of Contact objects to create in body of request (required)
  4288.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  4289.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  4290.      * @throws \InvalidArgumentException
  4291.      * @return \XeroAPI\XeroPHP\Models\Accounting\Contacts|\XeroAPI\XeroPHP\Models\Accounting\Error
  4292.      */
  4293.     public function createContacts($xero_tenant_id$contacts$summarize_errors false)
  4294.     {
  4295.         list($response) = $this->createContactsWithHttpInfo($xero_tenant_id$contacts$summarize_errors);
  4296.         return $response;
  4297.     }
  4298.     /**
  4299.      * Operation createContactsWithHttpInfo
  4300.      * Creates multiple contacts (bulk) in a Xero organisation
  4301.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  4302.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Contacts $contacts Contacts with an array of Contact objects to create in body of request (required)
  4303.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  4304.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  4305.      * @throws \InvalidArgumentException
  4306.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Contacts|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  4307.      */
  4308.     public function createContactsWithHttpInfo($xero_tenant_id$contacts$summarize_errors false)
  4309.     {
  4310.         $request $this->createContactsRequest($xero_tenant_id$contacts$summarize_errors);
  4311.         try {
  4312.             $options $this->createHttpClientOption();
  4313.             try {
  4314.                 $response $this->client->send($request$options);
  4315.             } catch (RequestException $e) {
  4316.                 throw new ApiException(
  4317.                     "[{$e->getCode()}{$e->getMessage()}",
  4318.                     $e->getCode(),
  4319.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  4320.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  4321.                 );
  4322.             }
  4323.             $statusCode $response->getStatusCode();
  4324.             if ($statusCode 200 || $statusCode 299) {
  4325.                 throw new ApiException(
  4326.                     sprintf(
  4327.                         '[%d] Error connecting to the API (%s)',
  4328.                         $statusCode,
  4329.                         $request->getUri()
  4330.                     ),
  4331.                     $statusCode,
  4332.                     $response->getHeaders(),
  4333.                     $response->getBody()
  4334.                 );
  4335.             }
  4336.             $responseBody $response->getBody();
  4337.             switch($statusCode) {
  4338.                 case 200:
  4339.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Contacts' === '\SplFileObject') {
  4340.                         $content $responseBody//stream goes to serializer
  4341.                     } else {
  4342.                         $content $responseBody->getContents();
  4343.                     }
  4344.                     return [
  4345.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Contacts', []),
  4346.                         $response->getStatusCode(),
  4347.                         $response->getHeaders()
  4348.                     ];
  4349.                 case 400:
  4350.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  4351.                         $content $responseBody//stream goes to serializer
  4352.                     } else {
  4353.                         $content $responseBody->getContents();
  4354.                     }
  4355.                     return [
  4356.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  4357.                         $response->getStatusCode(),
  4358.                         $response->getHeaders()
  4359.                     ];
  4360.             }
  4361.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Contacts';
  4362.             $responseBody $response->getBody();
  4363.             if ($returnType === '\SplFileObject') {
  4364.                 $content $responseBody//stream goes to serializer
  4365.             } else {
  4366.                 $content $responseBody->getContents();
  4367.             }
  4368.             return [
  4369.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  4370.                 $response->getStatusCode(),
  4371.                 $response->getHeaders()
  4372.             ];
  4373.         } catch (ApiException $e) {
  4374.             switch ($e->getCode()) {
  4375.                 case 200:
  4376.                     $data AccountingObjectSerializer::deserialize(
  4377.                         $e->getResponseBody(),
  4378.                         '\XeroAPI\XeroPHP\Models\Accounting\Contacts',
  4379.                         $e->getResponseHeaders()
  4380.                     );
  4381.                     $e->setResponseObject($data);
  4382.                     break;
  4383.                 case 400:
  4384.                     $data AccountingObjectSerializer::deserialize(
  4385.                         $e->getResponseBody(),
  4386.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  4387.                         $e->getResponseHeaders()
  4388.                     );
  4389.                     $e->setResponseObject($data);
  4390.                     break;
  4391.             }
  4392.             throw $e;
  4393.         }
  4394.     }
  4395.     /**
  4396.      * Operation createContactsAsync
  4397.      * Creates multiple contacts (bulk) in a Xero organisation
  4398.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  4399.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Contacts $contacts Contacts with an array of Contact objects to create in body of request (required)
  4400.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  4401.      * @throws \InvalidArgumentException
  4402.      * @return \GuzzleHttp\Promise\PromiseInterface
  4403.      */
  4404.     public function createContactsAsync($xero_tenant_id$contacts$summarize_errors false)
  4405.     {
  4406.         return $this->createContactsAsyncWithHttpInfo($xero_tenant_id$contacts$summarize_errors)
  4407.             ->then(
  4408.                 function ($response) {
  4409.                     return $response[0];
  4410.                 }
  4411.             );
  4412.     }
  4413.     /**
  4414.      * Operation createContactsAsyncWithHttpInfo
  4415.      * Creates multiple contacts (bulk) in a Xero organisation
  4416.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  4417.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Contacts $contacts Contacts with an array of Contact objects to create in body of request (required)
  4418.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  4419.      * @throws \InvalidArgumentException
  4420.      * @return \GuzzleHttp\Promise\PromiseInterface */
  4421.     public function createContactsAsyncWithHttpInfo($xero_tenant_id$contacts$summarize_errors false)
  4422.     {
  4423.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Contacts';
  4424.         $request $this->createContactsRequest($xero_tenant_id$contacts$summarize_errors);
  4425.         return $this->client
  4426.             ->sendAsync($request$this->createHttpClientOption())
  4427.             ->then(
  4428.                 function ($response) use ($returnType) {
  4429.                     $responseBody $response->getBody();
  4430.                     if ($returnType === '\SplFileObject') {
  4431.                         $content $responseBody//stream goes to serializer
  4432.                     } else {
  4433.                         $content $responseBody->getContents();
  4434.                     }
  4435.                     return [
  4436.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  4437.                         $response->getStatusCode(),
  4438.                         $response->getHeaders()
  4439.                     ];
  4440.                 },
  4441.                 function ($exception) {
  4442.                     $response $exception->getResponse();
  4443.                     $statusCode $response->getStatusCode();
  4444.                     throw new ApiException(
  4445.                         sprintf(
  4446.                             '[%d] Error connecting to the API (%s)',
  4447.                             $statusCode,
  4448.                             $exception->getRequest()->getUri()
  4449.                         ),
  4450.                         $statusCode,
  4451.                         $response->getHeaders(),
  4452.                         $response->getBody()
  4453.                     );
  4454.                 }
  4455.             );
  4456.     }
  4457.     /**
  4458.      * Create request for operation 'createContacts'
  4459.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  4460.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Contacts $contacts Contacts with an array of Contact objects to create in body of request (required)
  4461.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  4462.      * @throws \InvalidArgumentException
  4463.      * @return \GuzzleHttp\Psr7\Request  */
  4464.     protected function createContactsRequest($xero_tenant_id$contacts$summarize_errors false)
  4465.     {
  4466.         // verify the required parameter 'xero_tenant_id' is set
  4467.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  4468.             throw new \InvalidArgumentException(
  4469.                 'Missing the required parameter $xero_tenant_id when calling createContacts'
  4470.             );
  4471.         }
  4472.         // verify the required parameter 'contacts' is set
  4473.         if ($contacts === null || (is_array($contacts) && count($contacts) === 0)) {
  4474.             throw new \InvalidArgumentException(
  4475.                 'Missing the required parameter $contacts when calling createContacts'
  4476.             );
  4477.         }
  4478.         $resourcePath '/Contacts';
  4479.         $formParams = [];
  4480.         $queryParams = [];
  4481.         $headerParams = [];
  4482.         $httpBody '';
  4483.         $multipart false;
  4484.         // query params
  4485.         if ($summarize_errors !== null) {
  4486.             $queryParams['summarizeErrors'] = $summarize_errors 'true' 'false';
  4487.         }
  4488.         // header params
  4489.         if ($xero_tenant_id !== null) {
  4490.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  4491.         }
  4492.         // body params
  4493.         $_tempBody null;
  4494.         if (isset($contacts)) {
  4495.             $_tempBody $contacts;
  4496.         }
  4497.         if ($multipart) {
  4498.             $headers $this->headerSelector->selectHeadersForMultipart(
  4499.                 ['application/json']
  4500.             );
  4501.         } else {
  4502.             $headers $this->headerSelector->selectHeaders(
  4503.                 ['application/json'],
  4504.                 ['application/json']
  4505.             );
  4506.         }
  4507.         // for model (json/xml)
  4508.         if (isset($_tempBody)) {
  4509.             // $_tempBody is the method argument, if present
  4510.             if ($headers['Content-Type'] === 'application/json') {
  4511.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  4512.             } else {
  4513.                 $httpBody $_tempBody;
  4514.             }
  4515.         } elseif (count($formParams) > 0) {
  4516.             if ($multipart) {
  4517.                 $multipartContents = [
  4518.                     [
  4519.                         'Content-type' => 'multipart/form-data',
  4520.                     ]
  4521.                 ];
  4522.                 
  4523.                 // for HTTP post (form)
  4524.                 $httpBody = new MultipartStream($multipartContents);
  4525.             } elseif ($headers['Content-Type'] === 'application/json') {
  4526.                 $httpBody \GuzzleHttp\json_encode($formParams);
  4527.             } else {
  4528.                 // for HTTP post (form)
  4529.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  4530.             }
  4531.         }
  4532.         // this endpoint requires OAuth (access token)
  4533.         if ($this->config->getAccessToken() !== null) {
  4534.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  4535.         }
  4536.         $defaultHeaders = [];
  4537.         if ($this->config->getUserAgent()) {
  4538.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  4539.         }
  4540.         $headers array_merge(
  4541.             $defaultHeaders,
  4542.             $headerParams,
  4543.             $headers
  4544.         );
  4545.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  4546.         return new Request(
  4547.             'PUT',
  4548.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  4549.             $headers,
  4550.             $httpBody
  4551.         );
  4552.     }
  4553.     /**
  4554.      * Operation createCreditNoteAllocation
  4555.      * Creates allocation for a specific credit note
  4556.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  4557.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  4558.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Allocations $allocations Allocations with array of Allocation object in body of request. (required)
  4559.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  4560.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  4561.      * @throws \InvalidArgumentException
  4562.      * @return \XeroAPI\XeroPHP\Models\Accounting\Allocations|\XeroAPI\XeroPHP\Models\Accounting\Error
  4563.      */
  4564.     public function createCreditNoteAllocation($xero_tenant_id$credit_note_id$allocations$summarize_errors false)
  4565.     {
  4566.         list($response) = $this->createCreditNoteAllocationWithHttpInfo($xero_tenant_id$credit_note_id$allocations$summarize_errors);
  4567.         return $response;
  4568.     }
  4569.     /**
  4570.      * Operation createCreditNoteAllocationWithHttpInfo
  4571.      * Creates allocation for a specific credit note
  4572.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  4573.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  4574.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Allocations $allocations Allocations with array of Allocation object in body of request. (required)
  4575.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  4576.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  4577.      * @throws \InvalidArgumentException
  4578.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Allocations|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  4579.      */
  4580.     public function createCreditNoteAllocationWithHttpInfo($xero_tenant_id$credit_note_id$allocations$summarize_errors false)
  4581.     {
  4582.         $request $this->createCreditNoteAllocationRequest($xero_tenant_id$credit_note_id$allocations$summarize_errors);
  4583.         try {
  4584.             $options $this->createHttpClientOption();
  4585.             try {
  4586.                 $response $this->client->send($request$options);
  4587.             } catch (RequestException $e) {
  4588.                 throw new ApiException(
  4589.                     "[{$e->getCode()}{$e->getMessage()}",
  4590.                     $e->getCode(),
  4591.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  4592.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  4593.                 );
  4594.             }
  4595.             $statusCode $response->getStatusCode();
  4596.             if ($statusCode 200 || $statusCode 299) {
  4597.                 throw new ApiException(
  4598.                     sprintf(
  4599.                         '[%d] Error connecting to the API (%s)',
  4600.                         $statusCode,
  4601.                         $request->getUri()
  4602.                     ),
  4603.                     $statusCode,
  4604.                     $response->getHeaders(),
  4605.                     $response->getBody()
  4606.                 );
  4607.             }
  4608.             $responseBody $response->getBody();
  4609.             switch($statusCode) {
  4610.                 case 200:
  4611.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Allocations' === '\SplFileObject') {
  4612.                         $content $responseBody//stream goes to serializer
  4613.                     } else {
  4614.                         $content $responseBody->getContents();
  4615.                     }
  4616.                     return [
  4617.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Allocations', []),
  4618.                         $response->getStatusCode(),
  4619.                         $response->getHeaders()
  4620.                     ];
  4621.                 case 400:
  4622.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  4623.                         $content $responseBody//stream goes to serializer
  4624.                     } else {
  4625.                         $content $responseBody->getContents();
  4626.                     }
  4627.                     return [
  4628.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  4629.                         $response->getStatusCode(),
  4630.                         $response->getHeaders()
  4631.                     ];
  4632.             }
  4633.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Allocations';
  4634.             $responseBody $response->getBody();
  4635.             if ($returnType === '\SplFileObject') {
  4636.                 $content $responseBody//stream goes to serializer
  4637.             } else {
  4638.                 $content $responseBody->getContents();
  4639.             }
  4640.             return [
  4641.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  4642.                 $response->getStatusCode(),
  4643.                 $response->getHeaders()
  4644.             ];
  4645.         } catch (ApiException $e) {
  4646.             switch ($e->getCode()) {
  4647.                 case 200:
  4648.                     $data AccountingObjectSerializer::deserialize(
  4649.                         $e->getResponseBody(),
  4650.                         '\XeroAPI\XeroPHP\Models\Accounting\Allocations',
  4651.                         $e->getResponseHeaders()
  4652.                     );
  4653.                     $e->setResponseObject($data);
  4654.                     break;
  4655.                 case 400:
  4656.                     $data AccountingObjectSerializer::deserialize(
  4657.                         $e->getResponseBody(),
  4658.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  4659.                         $e->getResponseHeaders()
  4660.                     );
  4661.                     $e->setResponseObject($data);
  4662.                     break;
  4663.             }
  4664.             throw $e;
  4665.         }
  4666.     }
  4667.     /**
  4668.      * Operation createCreditNoteAllocationAsync
  4669.      * Creates allocation for a specific credit note
  4670.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  4671.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  4672.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Allocations $allocations Allocations with array of Allocation object in body of request. (required)
  4673.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  4674.      * @throws \InvalidArgumentException
  4675.      * @return \GuzzleHttp\Promise\PromiseInterface
  4676.      */
  4677.     public function createCreditNoteAllocationAsync($xero_tenant_id$credit_note_id$allocations$summarize_errors false)
  4678.     {
  4679.         return $this->createCreditNoteAllocationAsyncWithHttpInfo($xero_tenant_id$credit_note_id$allocations$summarize_errors)
  4680.             ->then(
  4681.                 function ($response) {
  4682.                     return $response[0];
  4683.                 }
  4684.             );
  4685.     }
  4686.     /**
  4687.      * Operation createCreditNoteAllocationAsyncWithHttpInfo
  4688.      * Creates allocation for a specific credit note
  4689.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  4690.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  4691.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Allocations $allocations Allocations with array of Allocation object in body of request. (required)
  4692.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  4693.      * @throws \InvalidArgumentException
  4694.      * @return \GuzzleHttp\Promise\PromiseInterface */
  4695.     public function createCreditNoteAllocationAsyncWithHttpInfo($xero_tenant_id$credit_note_id$allocations$summarize_errors false)
  4696.     {
  4697.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Allocations';
  4698.         $request $this->createCreditNoteAllocationRequest($xero_tenant_id$credit_note_id$allocations$summarize_errors);
  4699.         return $this->client
  4700.             ->sendAsync($request$this->createHttpClientOption())
  4701.             ->then(
  4702.                 function ($response) use ($returnType) {
  4703.                     $responseBody $response->getBody();
  4704.                     if ($returnType === '\SplFileObject') {
  4705.                         $content $responseBody//stream goes to serializer
  4706.                     } else {
  4707.                         $content $responseBody->getContents();
  4708.                     }
  4709.                     return [
  4710.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  4711.                         $response->getStatusCode(),
  4712.                         $response->getHeaders()
  4713.                     ];
  4714.                 },
  4715.                 function ($exception) {
  4716.                     $response $exception->getResponse();
  4717.                     $statusCode $response->getStatusCode();
  4718.                     throw new ApiException(
  4719.                         sprintf(
  4720.                             '[%d] Error connecting to the API (%s)',
  4721.                             $statusCode,
  4722.                             $exception->getRequest()->getUri()
  4723.                         ),
  4724.                         $statusCode,
  4725.                         $response->getHeaders(),
  4726.                         $response->getBody()
  4727.                     );
  4728.                 }
  4729.             );
  4730.     }
  4731.     /**
  4732.      * Create request for operation 'createCreditNoteAllocation'
  4733.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  4734.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  4735.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Allocations $allocations Allocations with array of Allocation object in body of request. (required)
  4736.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  4737.      * @throws \InvalidArgumentException
  4738.      * @return \GuzzleHttp\Psr7\Request  */
  4739.     protected function createCreditNoteAllocationRequest($xero_tenant_id$credit_note_id$allocations$summarize_errors false)
  4740.     {
  4741.         // verify the required parameter 'xero_tenant_id' is set
  4742.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  4743.             throw new \InvalidArgumentException(
  4744.                 'Missing the required parameter $xero_tenant_id when calling createCreditNoteAllocation'
  4745.             );
  4746.         }
  4747.         // verify the required parameter 'credit_note_id' is set
  4748.         if ($credit_note_id === null || (is_array($credit_note_id) && count($credit_note_id) === 0)) {
  4749.             throw new \InvalidArgumentException(
  4750.                 'Missing the required parameter $credit_note_id when calling createCreditNoteAllocation'
  4751.             );
  4752.         }
  4753.         // verify the required parameter 'allocations' is set
  4754.         if ($allocations === null || (is_array($allocations) && count($allocations) === 0)) {
  4755.             throw new \InvalidArgumentException(
  4756.                 'Missing the required parameter $allocations when calling createCreditNoteAllocation'
  4757.             );
  4758.         }
  4759.         $resourcePath '/CreditNotes/{CreditNoteID}/Allocations';
  4760.         $formParams = [];
  4761.         $queryParams = [];
  4762.         $headerParams = [];
  4763.         $httpBody '';
  4764.         $multipart false;
  4765.         // query params
  4766.         if ($summarize_errors !== null) {
  4767.             $queryParams['summarizeErrors'] = $summarize_errors 'true' 'false';
  4768.         }
  4769.         // header params
  4770.         if ($xero_tenant_id !== null) {
  4771.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  4772.         }
  4773.         // path params
  4774.         if ($credit_note_id !== null) {
  4775.             $resourcePath str_replace(
  4776.                 '{' 'CreditNoteID' '}',
  4777.                 AccountingObjectSerializer::toPathValue($credit_note_id),
  4778.                 $resourcePath
  4779.             );
  4780.         }
  4781.         // body params
  4782.         $_tempBody null;
  4783.         if (isset($allocations)) {
  4784.             $_tempBody $allocations;
  4785.         }
  4786.         if ($multipart) {
  4787.             $headers $this->headerSelector->selectHeadersForMultipart(
  4788.                 ['application/json']
  4789.             );
  4790.         } else {
  4791.             $headers $this->headerSelector->selectHeaders(
  4792.                 ['application/json'],
  4793.                 ['application/json']
  4794.             );
  4795.         }
  4796.         // for model (json/xml)
  4797.         if (isset($_tempBody)) {
  4798.             // $_tempBody is the method argument, if present
  4799.             if ($headers['Content-Type'] === 'application/json') {
  4800.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  4801.             } else {
  4802.                 $httpBody $_tempBody;
  4803.             }
  4804.         } elseif (count($formParams) > 0) {
  4805.             if ($multipart) {
  4806.                 $multipartContents = [
  4807.                     [
  4808.                         'Content-type' => 'multipart/form-data',
  4809.                     ]
  4810.                 ];
  4811.                 
  4812.                 // for HTTP post (form)
  4813.                 $httpBody = new MultipartStream($multipartContents);
  4814.             } elseif ($headers['Content-Type'] === 'application/json') {
  4815.                 $httpBody \GuzzleHttp\json_encode($formParams);
  4816.             } else {
  4817.                 // for HTTP post (form)
  4818.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  4819.             }
  4820.         }
  4821.         // this endpoint requires OAuth (access token)
  4822.         if ($this->config->getAccessToken() !== null) {
  4823.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  4824.         }
  4825.         $defaultHeaders = [];
  4826.         if ($this->config->getUserAgent()) {
  4827.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  4828.         }
  4829.         $headers array_merge(
  4830.             $defaultHeaders,
  4831.             $headerParams,
  4832.             $headers
  4833.         );
  4834.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  4835.         return new Request(
  4836.             'PUT',
  4837.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  4838.             $headers,
  4839.             $httpBody
  4840.         );
  4841.     }
  4842.     /**
  4843.      * Operation createCreditNoteAttachmentByFileName
  4844.      * Creates an attachment for a specific credit note
  4845.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  4846.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  4847.      * @param  string $file_name Name of the attachment (required)
  4848.      * @param  string $body Byte array of file in body of request (required)
  4849.      * @param  bool $include_online Allows an attachment to be seen by the end customer within their online invoice (optional, default to false)
  4850.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  4851.      * @throws \InvalidArgumentException
  4852.      * @return \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error
  4853.      */
  4854.     public function createCreditNoteAttachmentByFileName($xero_tenant_id$credit_note_id$file_name$body$include_online false)
  4855.     {
  4856.         list($response) = $this->createCreditNoteAttachmentByFileNameWithHttpInfo($xero_tenant_id$credit_note_id$file_name$body$include_online);
  4857.         return $response;
  4858.     }
  4859.     /**
  4860.      * Operation createCreditNoteAttachmentByFileNameWithHttpInfo
  4861.      * Creates an attachment for a specific credit note
  4862.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  4863.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  4864.      * @param  string $file_name Name of the attachment (required)
  4865.      * @param  string $body Byte array of file in body of request (required)
  4866.      * @param  bool $include_online Allows an attachment to be seen by the end customer within their online invoice (optional, default to false)
  4867.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  4868.      * @throws \InvalidArgumentException
  4869.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  4870.      */
  4871.     public function createCreditNoteAttachmentByFileNameWithHttpInfo($xero_tenant_id$credit_note_id$file_name$body$include_online false)
  4872.     {
  4873.         $request $this->createCreditNoteAttachmentByFileNameRequest($xero_tenant_id$credit_note_id$file_name$body$include_online);
  4874.         try {
  4875.             $options $this->createHttpClientOption();
  4876.             try {
  4877.                 $response $this->client->send($request$options);
  4878.             } catch (RequestException $e) {
  4879.                 throw new ApiException(
  4880.                     "[{$e->getCode()}{$e->getMessage()}",
  4881.                     $e->getCode(),
  4882.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  4883.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  4884.                 );
  4885.             }
  4886.             $statusCode $response->getStatusCode();
  4887.             if ($statusCode 200 || $statusCode 299) {
  4888.                 throw new ApiException(
  4889.                     sprintf(
  4890.                         '[%d] Error connecting to the API (%s)',
  4891.                         $statusCode,
  4892.                         $request->getUri()
  4893.                     ),
  4894.                     $statusCode,
  4895.                     $response->getHeaders(),
  4896.                     $response->getBody()
  4897.                 );
  4898.             }
  4899.             $responseBody $response->getBody();
  4900.             switch($statusCode) {
  4901.                 case 200:
  4902.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Attachments' === '\SplFileObject') {
  4903.                         $content $responseBody//stream goes to serializer
  4904.                     } else {
  4905.                         $content $responseBody->getContents();
  4906.                     }
  4907.                     return [
  4908.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Attachments', []),
  4909.                         $response->getStatusCode(),
  4910.                         $response->getHeaders()
  4911.                     ];
  4912.                 case 400:
  4913.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  4914.                         $content $responseBody//stream goes to serializer
  4915.                     } else {
  4916.                         $content $responseBody->getContents();
  4917.                     }
  4918.                     return [
  4919.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  4920.                         $response->getStatusCode(),
  4921.                         $response->getHeaders()
  4922.                     ];
  4923.             }
  4924.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  4925.             $responseBody $response->getBody();
  4926.             if ($returnType === '\SplFileObject') {
  4927.                 $content $responseBody//stream goes to serializer
  4928.             } else {
  4929.                 $content $responseBody->getContents();
  4930.             }
  4931.             return [
  4932.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  4933.                 $response->getStatusCode(),
  4934.                 $response->getHeaders()
  4935.             ];
  4936.         } catch (ApiException $e) {
  4937.             switch ($e->getCode()) {
  4938.                 case 200:
  4939.                     $data AccountingObjectSerializer::deserialize(
  4940.                         $e->getResponseBody(),
  4941.                         '\XeroAPI\XeroPHP\Models\Accounting\Attachments',
  4942.                         $e->getResponseHeaders()
  4943.                     );
  4944.                     $e->setResponseObject($data);
  4945.                     break;
  4946.                 case 400:
  4947.                     $data AccountingObjectSerializer::deserialize(
  4948.                         $e->getResponseBody(),
  4949.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  4950.                         $e->getResponseHeaders()
  4951.                     );
  4952.                     $e->setResponseObject($data);
  4953.                     break;
  4954.             }
  4955.             throw $e;
  4956.         }
  4957.     }
  4958.     /**
  4959.      * Operation createCreditNoteAttachmentByFileNameAsync
  4960.      * Creates an attachment for a specific credit note
  4961.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  4962.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  4963.      * @param  string $file_name Name of the attachment (required)
  4964.      * @param  string $body Byte array of file in body of request (required)
  4965.      * @param  bool $include_online Allows an attachment to be seen by the end customer within their online invoice (optional, default to false)
  4966.      * @throws \InvalidArgumentException
  4967.      * @return \GuzzleHttp\Promise\PromiseInterface
  4968.      */
  4969.     public function createCreditNoteAttachmentByFileNameAsync($xero_tenant_id$credit_note_id$file_name$body$include_online false)
  4970.     {
  4971.         return $this->createCreditNoteAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$credit_note_id$file_name$body$include_online)
  4972.             ->then(
  4973.                 function ($response) {
  4974.                     return $response[0];
  4975.                 }
  4976.             );
  4977.     }
  4978.     /**
  4979.      * Operation createCreditNoteAttachmentByFileNameAsyncWithHttpInfo
  4980.      * Creates an attachment for a specific credit note
  4981.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  4982.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  4983.      * @param  string $file_name Name of the attachment (required)
  4984.      * @param  string $body Byte array of file in body of request (required)
  4985.      * @param  bool $include_online Allows an attachment to be seen by the end customer within their online invoice (optional, default to false)
  4986.      * @throws \InvalidArgumentException
  4987.      * @return \GuzzleHttp\Promise\PromiseInterface */
  4988.     public function createCreditNoteAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$credit_note_id$file_name$body$include_online false)
  4989.     {
  4990.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  4991.         $request $this->createCreditNoteAttachmentByFileNameRequest($xero_tenant_id$credit_note_id$file_name$body$include_online);
  4992.         return $this->client
  4993.             ->sendAsync($request$this->createHttpClientOption())
  4994.             ->then(
  4995.                 function ($response) use ($returnType) {
  4996.                     $responseBody $response->getBody();
  4997.                     if ($returnType === '\SplFileObject') {
  4998.                         $content $responseBody//stream goes to serializer
  4999.                     } else {
  5000.                         $content $responseBody->getContents();
  5001.                     }
  5002.                     return [
  5003.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  5004.                         $response->getStatusCode(),
  5005.                         $response->getHeaders()
  5006.                     ];
  5007.                 },
  5008.                 function ($exception) {
  5009.                     $response $exception->getResponse();
  5010.                     $statusCode $response->getStatusCode();
  5011.                     throw new ApiException(
  5012.                         sprintf(
  5013.                             '[%d] Error connecting to the API (%s)',
  5014.                             $statusCode,
  5015.                             $exception->getRequest()->getUri()
  5016.                         ),
  5017.                         $statusCode,
  5018.                         $response->getHeaders(),
  5019.                         $response->getBody()
  5020.                     );
  5021.                 }
  5022.             );
  5023.     }
  5024.     /**
  5025.      * Create request for operation 'createCreditNoteAttachmentByFileName'
  5026.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  5027.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  5028.      * @param  string $file_name Name of the attachment (required)
  5029.      * @param  string $body Byte array of file in body of request (required)
  5030.      * @param  bool $include_online Allows an attachment to be seen by the end customer within their online invoice (optional, default to false)
  5031.      * @throws \InvalidArgumentException
  5032.      * @return \GuzzleHttp\Psr7\Request  */
  5033.     protected function createCreditNoteAttachmentByFileNameRequest($xero_tenant_id$credit_note_id$file_name$body$include_online false)
  5034.     {
  5035.         // verify the required parameter 'xero_tenant_id' is set
  5036.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  5037.             throw new \InvalidArgumentException(
  5038.                 'Missing the required parameter $xero_tenant_id when calling createCreditNoteAttachmentByFileName'
  5039.             );
  5040.         }
  5041.         // verify the required parameter 'credit_note_id' is set
  5042.         if ($credit_note_id === null || (is_array($credit_note_id) && count($credit_note_id) === 0)) {
  5043.             throw new \InvalidArgumentException(
  5044.                 'Missing the required parameter $credit_note_id when calling createCreditNoteAttachmentByFileName'
  5045.             );
  5046.         }
  5047.         // verify the required parameter 'file_name' is set
  5048.         if ($file_name === null || (is_array($file_name) && count($file_name) === 0)) {
  5049.             throw new \InvalidArgumentException(
  5050.                 'Missing the required parameter $file_name when calling createCreditNoteAttachmentByFileName'
  5051.             );
  5052.         }
  5053.         // verify the required parameter 'body' is set
  5054.         if ($body === null || (is_array($body) && count($body) === 0)) {
  5055.             throw new \InvalidArgumentException(
  5056.                 'Missing the required parameter $body when calling createCreditNoteAttachmentByFileName'
  5057.             );
  5058.         }
  5059.         $resourcePath '/CreditNotes/{CreditNoteID}/Attachments/{FileName}';
  5060.         $formParams = [];
  5061.         $queryParams = [];
  5062.         $headerParams = [];
  5063.         $httpBody '';
  5064.         $multipart false;
  5065.         // query params
  5066.         if ($include_online !== null) {
  5067.             $queryParams['IncludeOnline'] = $include_online 'true' 'false';
  5068.         }
  5069.         // header params
  5070.         if ($xero_tenant_id !== null) {
  5071.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  5072.         }
  5073.         // path params
  5074.         if ($credit_note_id !== null) {
  5075.             $resourcePath str_replace(
  5076.                 '{' 'CreditNoteID' '}',
  5077.                 AccountingObjectSerializer::toPathValue($credit_note_id),
  5078.                 $resourcePath
  5079.             );
  5080.         }
  5081.         // path params
  5082.         if ($file_name !== null) {
  5083.             $resourcePath str_replace(
  5084.                 '{' 'FileName' '}',
  5085.                 AccountingObjectSerializer::toPathValue($file_name),
  5086.                 $resourcePath
  5087.             );
  5088.         }
  5089.         // body params
  5090.         $_tempBody null;
  5091.         if (isset($body)) {
  5092.             $_tempBody $body;
  5093.         }
  5094.         if ($multipart) {
  5095.             $headers $this->headerSelector->selectHeadersForMultipart(
  5096.                 ['application/json']
  5097.             );
  5098.         } else {
  5099.             $headers $this->headerSelector->selectHeaders(
  5100.                 ['application/json'],
  5101.                 ['application/octet-stream']
  5102.             );
  5103.         }
  5104.         // for model (json/xml)
  5105.         if (isset($_tempBody)) {
  5106.             // $_tempBody is the method argument, if present
  5107.             if ($headers['Content-Type'] === 'application/json') {
  5108.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  5109.             } else {
  5110.                 $httpBody $_tempBody;
  5111.             }
  5112.         } elseif (count($formParams) > 0) {
  5113.             if ($multipart) {
  5114.                 $multipartContents = [
  5115.                     [
  5116.                         'Content-type' => 'multipart/form-data',
  5117.                     ]
  5118.                 ];
  5119.                 
  5120.                 // for HTTP post (form)
  5121.                 $httpBody = new MultipartStream($multipartContents);
  5122.             } elseif ($headers['Content-Type'] === 'application/json') {
  5123.                 $httpBody \GuzzleHttp\json_encode($formParams);
  5124.             } else {
  5125.                 // for HTTP post (form)
  5126.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  5127.             }
  5128.         }
  5129.         // this endpoint requires OAuth (access token)
  5130.         if ($this->config->getAccessToken() !== null) {
  5131.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  5132.         }
  5133.         $defaultHeaders = [];
  5134.         if ($this->config->getUserAgent()) {
  5135.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  5136.         }
  5137.         $headers array_merge(
  5138.             $defaultHeaders,
  5139.             $headerParams,
  5140.             $headers
  5141.         );
  5142.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  5143.         return new Request(
  5144.             'PUT',
  5145.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  5146.             $headers,
  5147.             $httpBody
  5148.         );
  5149.     }
  5150.     /**
  5151.      * Operation createCreditNoteHistory
  5152.      * Retrieves history records of a specific credit note
  5153.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  5154.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  5155.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  5156.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  5157.      * @throws \InvalidArgumentException
  5158.      * @return \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords|\XeroAPI\XeroPHP\Models\Accounting\Error
  5159.      */
  5160.     public function createCreditNoteHistory($xero_tenant_id$credit_note_id$history_records)
  5161.     {
  5162.         list($response) = $this->createCreditNoteHistoryWithHttpInfo($xero_tenant_id$credit_note_id$history_records);
  5163.         return $response;
  5164.     }
  5165.     /**
  5166.      * Operation createCreditNoteHistoryWithHttpInfo
  5167.      * Retrieves history records of a specific credit note
  5168.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  5169.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  5170.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  5171.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  5172.      * @throws \InvalidArgumentException
  5173.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  5174.      */
  5175.     public function createCreditNoteHistoryWithHttpInfo($xero_tenant_id$credit_note_id$history_records)
  5176.     {
  5177.         $request $this->createCreditNoteHistoryRequest($xero_tenant_id$credit_note_id$history_records);
  5178.         try {
  5179.             $options $this->createHttpClientOption();
  5180.             try {
  5181.                 $response $this->client->send($request$options);
  5182.             } catch (RequestException $e) {
  5183.                 throw new ApiException(
  5184.                     "[{$e->getCode()}{$e->getMessage()}",
  5185.                     $e->getCode(),
  5186.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  5187.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  5188.                 );
  5189.             }
  5190.             $statusCode $response->getStatusCode();
  5191.             if ($statusCode 200 || $statusCode 299) {
  5192.                 throw new ApiException(
  5193.                     sprintf(
  5194.                         '[%d] Error connecting to the API (%s)',
  5195.                         $statusCode,
  5196.                         $request->getUri()
  5197.                     ),
  5198.                     $statusCode,
  5199.                     $response->getHeaders(),
  5200.                     $response->getBody()
  5201.                 );
  5202.             }
  5203.             $responseBody $response->getBody();
  5204.             switch($statusCode) {
  5205.                 case 200:
  5206.                     if ('\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords' === '\SplFileObject') {
  5207.                         $content $responseBody//stream goes to serializer
  5208.                     } else {
  5209.                         $content $responseBody->getContents();
  5210.                     }
  5211.                     return [
  5212.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords', []),
  5213.                         $response->getStatusCode(),
  5214.                         $response->getHeaders()
  5215.                     ];
  5216.                 case 400:
  5217.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  5218.                         $content $responseBody//stream goes to serializer
  5219.                     } else {
  5220.                         $content $responseBody->getContents();
  5221.                     }
  5222.                     return [
  5223.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  5224.                         $response->getStatusCode(),
  5225.                         $response->getHeaders()
  5226.                     ];
  5227.             }
  5228.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  5229.             $responseBody $response->getBody();
  5230.             if ($returnType === '\SplFileObject') {
  5231.                 $content $responseBody//stream goes to serializer
  5232.             } else {
  5233.                 $content $responseBody->getContents();
  5234.             }
  5235.             return [
  5236.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  5237.                 $response->getStatusCode(),
  5238.                 $response->getHeaders()
  5239.             ];
  5240.         } catch (ApiException $e) {
  5241.             switch ($e->getCode()) {
  5242.                 case 200:
  5243.                     $data AccountingObjectSerializer::deserialize(
  5244.                         $e->getResponseBody(),
  5245.                         '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords',
  5246.                         $e->getResponseHeaders()
  5247.                     );
  5248.                     $e->setResponseObject($data);
  5249.                     break;
  5250.                 case 400:
  5251.                     $data AccountingObjectSerializer::deserialize(
  5252.                         $e->getResponseBody(),
  5253.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  5254.                         $e->getResponseHeaders()
  5255.                     );
  5256.                     $e->setResponseObject($data);
  5257.                     break;
  5258.             }
  5259.             throw $e;
  5260.         }
  5261.     }
  5262.     /**
  5263.      * Operation createCreditNoteHistoryAsync
  5264.      * Retrieves history records of a specific credit note
  5265.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  5266.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  5267.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  5268.      * @throws \InvalidArgumentException
  5269.      * @return \GuzzleHttp\Promise\PromiseInterface
  5270.      */
  5271.     public function createCreditNoteHistoryAsync($xero_tenant_id$credit_note_id$history_records)
  5272.     {
  5273.         return $this->createCreditNoteHistoryAsyncWithHttpInfo($xero_tenant_id$credit_note_id$history_records)
  5274.             ->then(
  5275.                 function ($response) {
  5276.                     return $response[0];
  5277.                 }
  5278.             );
  5279.     }
  5280.     /**
  5281.      * Operation createCreditNoteHistoryAsyncWithHttpInfo
  5282.      * Retrieves history records of a specific credit note
  5283.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  5284.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  5285.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  5286.      * @throws \InvalidArgumentException
  5287.      * @return \GuzzleHttp\Promise\PromiseInterface */
  5288.     public function createCreditNoteHistoryAsyncWithHttpInfo($xero_tenant_id$credit_note_id$history_records)
  5289.     {
  5290.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  5291.         $request $this->createCreditNoteHistoryRequest($xero_tenant_id$credit_note_id$history_records);
  5292.         return $this->client
  5293.             ->sendAsync($request$this->createHttpClientOption())
  5294.             ->then(
  5295.                 function ($response) use ($returnType) {
  5296.                     $responseBody $response->getBody();
  5297.                     if ($returnType === '\SplFileObject') {
  5298.                         $content $responseBody//stream goes to serializer
  5299.                     } else {
  5300.                         $content $responseBody->getContents();
  5301.                     }
  5302.                     return [
  5303.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  5304.                         $response->getStatusCode(),
  5305.                         $response->getHeaders()
  5306.                     ];
  5307.                 },
  5308.                 function ($exception) {
  5309.                     $response $exception->getResponse();
  5310.                     $statusCode $response->getStatusCode();
  5311.                     throw new ApiException(
  5312.                         sprintf(
  5313.                             '[%d] Error connecting to the API (%s)',
  5314.                             $statusCode,
  5315.                             $exception->getRequest()->getUri()
  5316.                         ),
  5317.                         $statusCode,
  5318.                         $response->getHeaders(),
  5319.                         $response->getBody()
  5320.                     );
  5321.                 }
  5322.             );
  5323.     }
  5324.     /**
  5325.      * Create request for operation 'createCreditNoteHistory'
  5326.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  5327.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  5328.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  5329.      * @throws \InvalidArgumentException
  5330.      * @return \GuzzleHttp\Psr7\Request  */
  5331.     protected function createCreditNoteHistoryRequest($xero_tenant_id$credit_note_id$history_records)
  5332.     {
  5333.         // verify the required parameter 'xero_tenant_id' is set
  5334.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  5335.             throw new \InvalidArgumentException(
  5336.                 'Missing the required parameter $xero_tenant_id when calling createCreditNoteHistory'
  5337.             );
  5338.         }
  5339.         // verify the required parameter 'credit_note_id' is set
  5340.         if ($credit_note_id === null || (is_array($credit_note_id) && count($credit_note_id) === 0)) {
  5341.             throw new \InvalidArgumentException(
  5342.                 'Missing the required parameter $credit_note_id when calling createCreditNoteHistory'
  5343.             );
  5344.         }
  5345.         // verify the required parameter 'history_records' is set
  5346.         if ($history_records === null || (is_array($history_records) && count($history_records) === 0)) {
  5347.             throw new \InvalidArgumentException(
  5348.                 'Missing the required parameter $history_records when calling createCreditNoteHistory'
  5349.             );
  5350.         }
  5351.         $resourcePath '/CreditNotes/{CreditNoteID}/History';
  5352.         $formParams = [];
  5353.         $queryParams = [];
  5354.         $headerParams = [];
  5355.         $httpBody '';
  5356.         $multipart false;
  5357.         // header params
  5358.         if ($xero_tenant_id !== null) {
  5359.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  5360.         }
  5361.         // path params
  5362.         if ($credit_note_id !== null) {
  5363.             $resourcePath str_replace(
  5364.                 '{' 'CreditNoteID' '}',
  5365.                 AccountingObjectSerializer::toPathValue($credit_note_id),
  5366.                 $resourcePath
  5367.             );
  5368.         }
  5369.         // body params
  5370.         $_tempBody null;
  5371.         if (isset($history_records)) {
  5372.             $_tempBody $history_records;
  5373.         }
  5374.         if ($multipart) {
  5375.             $headers $this->headerSelector->selectHeadersForMultipart(
  5376.                 ['application/json']
  5377.             );
  5378.         } else {
  5379.             $headers $this->headerSelector->selectHeaders(
  5380.                 ['application/json'],
  5381.                 ['application/json']
  5382.             );
  5383.         }
  5384.         // for model (json/xml)
  5385.         if (isset($_tempBody)) {
  5386.             // $_tempBody is the method argument, if present
  5387.             if ($headers['Content-Type'] === 'application/json') {
  5388.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  5389.             } else {
  5390.                 $httpBody $_tempBody;
  5391.             }
  5392.         } elseif (count($formParams) > 0) {
  5393.             if ($multipart) {
  5394.                 $multipartContents = [
  5395.                     [
  5396.                         'Content-type' => 'multipart/form-data',
  5397.                     ]
  5398.                 ];
  5399.                 
  5400.                 // for HTTP post (form)
  5401.                 $httpBody = new MultipartStream($multipartContents);
  5402.             } elseif ($headers['Content-Type'] === 'application/json') {
  5403.                 $httpBody \GuzzleHttp\json_encode($formParams);
  5404.             } else {
  5405.                 // for HTTP post (form)
  5406.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  5407.             }
  5408.         }
  5409.         // this endpoint requires OAuth (access token)
  5410.         if ($this->config->getAccessToken() !== null) {
  5411.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  5412.         }
  5413.         $defaultHeaders = [];
  5414.         if ($this->config->getUserAgent()) {
  5415.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  5416.         }
  5417.         $headers array_merge(
  5418.             $defaultHeaders,
  5419.             $headerParams,
  5420.             $headers
  5421.         );
  5422.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  5423.         return new Request(
  5424.             'PUT',
  5425.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  5426.             $headers,
  5427.             $httpBody
  5428.         );
  5429.     }
  5430.     /**
  5431.      * Operation createCreditNotes
  5432.      * Creates a new credit note
  5433.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  5434.      * @param  \XeroAPI\XeroPHP\Models\Accounting\CreditNotes $credit_notes Credit Notes with array of CreditNote object in body of request (required)
  5435.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  5436.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  5437.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  5438.      * @throws \InvalidArgumentException
  5439.      * @return \XeroAPI\XeroPHP\Models\Accounting\CreditNotes|\XeroAPI\XeroPHP\Models\Accounting\Error
  5440.      */
  5441.     public function createCreditNotes($xero_tenant_id$credit_notes$summarize_errors false$unitdp null)
  5442.     {
  5443.         list($response) = $this->createCreditNotesWithHttpInfo($xero_tenant_id$credit_notes$summarize_errors$unitdp);
  5444.         return $response;
  5445.     }
  5446.     /**
  5447.      * Operation createCreditNotesWithHttpInfo
  5448.      * Creates a new credit note
  5449.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  5450.      * @param  \XeroAPI\XeroPHP\Models\Accounting\CreditNotes $credit_notes Credit Notes with array of CreditNote object in body of request (required)
  5451.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  5452.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  5453.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  5454.      * @throws \InvalidArgumentException
  5455.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\CreditNotes|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  5456.      */
  5457.     public function createCreditNotesWithHttpInfo($xero_tenant_id$credit_notes$summarize_errors false$unitdp null)
  5458.     {
  5459.         $request $this->createCreditNotesRequest($xero_tenant_id$credit_notes$summarize_errors$unitdp);
  5460.         try {
  5461.             $options $this->createHttpClientOption();
  5462.             try {
  5463.                 $response $this->client->send($request$options);
  5464.             } catch (RequestException $e) {
  5465.                 throw new ApiException(
  5466.                     "[{$e->getCode()}{$e->getMessage()}",
  5467.                     $e->getCode(),
  5468.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  5469.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  5470.                 );
  5471.             }
  5472.             $statusCode $response->getStatusCode();
  5473.             if ($statusCode 200 || $statusCode 299) {
  5474.                 throw new ApiException(
  5475.                     sprintf(
  5476.                         '[%d] Error connecting to the API (%s)',
  5477.                         $statusCode,
  5478.                         $request->getUri()
  5479.                     ),
  5480.                     $statusCode,
  5481.                     $response->getHeaders(),
  5482.                     $response->getBody()
  5483.                 );
  5484.             }
  5485.             $responseBody $response->getBody();
  5486.             switch($statusCode) {
  5487.                 case 200:
  5488.                     if ('\XeroAPI\XeroPHP\Models\Accounting\CreditNotes' === '\SplFileObject') {
  5489.                         $content $responseBody//stream goes to serializer
  5490.                     } else {
  5491.                         $content $responseBody->getContents();
  5492.                     }
  5493.                     return [
  5494.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\CreditNotes', []),
  5495.                         $response->getStatusCode(),
  5496.                         $response->getHeaders()
  5497.                     ];
  5498.                 case 400:
  5499.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  5500.                         $content $responseBody//stream goes to serializer
  5501.                     } else {
  5502.                         $content $responseBody->getContents();
  5503.                     }
  5504.                     return [
  5505.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  5506.                         $response->getStatusCode(),
  5507.                         $response->getHeaders()
  5508.                     ];
  5509.             }
  5510.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\CreditNotes';
  5511.             $responseBody $response->getBody();
  5512.             if ($returnType === '\SplFileObject') {
  5513.                 $content $responseBody//stream goes to serializer
  5514.             } else {
  5515.                 $content $responseBody->getContents();
  5516.             }
  5517.             return [
  5518.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  5519.                 $response->getStatusCode(),
  5520.                 $response->getHeaders()
  5521.             ];
  5522.         } catch (ApiException $e) {
  5523.             switch ($e->getCode()) {
  5524.                 case 200:
  5525.                     $data AccountingObjectSerializer::deserialize(
  5526.                         $e->getResponseBody(),
  5527.                         '\XeroAPI\XeroPHP\Models\Accounting\CreditNotes',
  5528.                         $e->getResponseHeaders()
  5529.                     );
  5530.                     $e->setResponseObject($data);
  5531.                     break;
  5532.                 case 400:
  5533.                     $data AccountingObjectSerializer::deserialize(
  5534.                         $e->getResponseBody(),
  5535.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  5536.                         $e->getResponseHeaders()
  5537.                     );
  5538.                     $e->setResponseObject($data);
  5539.                     break;
  5540.             }
  5541.             throw $e;
  5542.         }
  5543.     }
  5544.     /**
  5545.      * Operation createCreditNotesAsync
  5546.      * Creates a new credit note
  5547.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  5548.      * @param  \XeroAPI\XeroPHP\Models\Accounting\CreditNotes $credit_notes Credit Notes with array of CreditNote object in body of request (required)
  5549.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  5550.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  5551.      * @throws \InvalidArgumentException
  5552.      * @return \GuzzleHttp\Promise\PromiseInterface
  5553.      */
  5554.     public function createCreditNotesAsync($xero_tenant_id$credit_notes$summarize_errors false$unitdp null)
  5555.     {
  5556.         return $this->createCreditNotesAsyncWithHttpInfo($xero_tenant_id$credit_notes$summarize_errors$unitdp)
  5557.             ->then(
  5558.                 function ($response) {
  5559.                     return $response[0];
  5560.                 }
  5561.             );
  5562.     }
  5563.     /**
  5564.      * Operation createCreditNotesAsyncWithHttpInfo
  5565.      * Creates a new credit note
  5566.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  5567.      * @param  \XeroAPI\XeroPHP\Models\Accounting\CreditNotes $credit_notes Credit Notes with array of CreditNote object in body of request (required)
  5568.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  5569.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  5570.      * @throws \InvalidArgumentException
  5571.      * @return \GuzzleHttp\Promise\PromiseInterface */
  5572.     public function createCreditNotesAsyncWithHttpInfo($xero_tenant_id$credit_notes$summarize_errors false$unitdp null)
  5573.     {
  5574.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\CreditNotes';
  5575.         $request $this->createCreditNotesRequest($xero_tenant_id$credit_notes$summarize_errors$unitdp);
  5576.         return $this->client
  5577.             ->sendAsync($request$this->createHttpClientOption())
  5578.             ->then(
  5579.                 function ($response) use ($returnType) {
  5580.                     $responseBody $response->getBody();
  5581.                     if ($returnType === '\SplFileObject') {
  5582.                         $content $responseBody//stream goes to serializer
  5583.                     } else {
  5584.                         $content $responseBody->getContents();
  5585.                     }
  5586.                     return [
  5587.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  5588.                         $response->getStatusCode(),
  5589.                         $response->getHeaders()
  5590.                     ];
  5591.                 },
  5592.                 function ($exception) {
  5593.                     $response $exception->getResponse();
  5594.                     $statusCode $response->getStatusCode();
  5595.                     throw new ApiException(
  5596.                         sprintf(
  5597.                             '[%d] Error connecting to the API (%s)',
  5598.                             $statusCode,
  5599.                             $exception->getRequest()->getUri()
  5600.                         ),
  5601.                         $statusCode,
  5602.                         $response->getHeaders(),
  5603.                         $response->getBody()
  5604.                     );
  5605.                 }
  5606.             );
  5607.     }
  5608.     /**
  5609.      * Create request for operation 'createCreditNotes'
  5610.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  5611.      * @param  \XeroAPI\XeroPHP\Models\Accounting\CreditNotes $credit_notes Credit Notes with array of CreditNote object in body of request (required)
  5612.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  5613.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  5614.      * @throws \InvalidArgumentException
  5615.      * @return \GuzzleHttp\Psr7\Request  */
  5616.     protected function createCreditNotesRequest($xero_tenant_id$credit_notes$summarize_errors false$unitdp null)
  5617.     {
  5618.         // verify the required parameter 'xero_tenant_id' is set
  5619.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  5620.             throw new \InvalidArgumentException(
  5621.                 'Missing the required parameter $xero_tenant_id when calling createCreditNotes'
  5622.             );
  5623.         }
  5624.         // verify the required parameter 'credit_notes' is set
  5625.         if ($credit_notes === null || (is_array($credit_notes) && count($credit_notes) === 0)) {
  5626.             throw new \InvalidArgumentException(
  5627.                 'Missing the required parameter $credit_notes when calling createCreditNotes'
  5628.             );
  5629.         }
  5630.         $resourcePath '/CreditNotes';
  5631.         $formParams = [];
  5632.         $queryParams = [];
  5633.         $headerParams = [];
  5634.         $httpBody '';
  5635.         $multipart false;
  5636.         // query params
  5637.         if ($summarize_errors !== null) {
  5638.             $queryParams['summarizeErrors'] = $summarize_errors 'true' 'false';
  5639.         }
  5640.         // query params
  5641.         if ($unitdp !== null) {
  5642.             $queryParams['unitdp'] = AccountingObjectSerializer::toQueryValue($unitdp);
  5643.         }
  5644.         // header params
  5645.         if ($xero_tenant_id !== null) {
  5646.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  5647.         }
  5648.         // body params
  5649.         $_tempBody null;
  5650.         if (isset($credit_notes)) {
  5651.             $_tempBody $credit_notes;
  5652.         }
  5653.         if ($multipart) {
  5654.             $headers $this->headerSelector->selectHeadersForMultipart(
  5655.                 ['application/json']
  5656.             );
  5657.         } else {
  5658.             $headers $this->headerSelector->selectHeaders(
  5659.                 ['application/json'],
  5660.                 ['application/json']
  5661.             );
  5662.         }
  5663.         // for model (json/xml)
  5664.         if (isset($_tempBody)) {
  5665.             // $_tempBody is the method argument, if present
  5666.             if ($headers['Content-Type'] === 'application/json') {
  5667.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  5668.             } else {
  5669.                 $httpBody $_tempBody;
  5670.             }
  5671.         } elseif (count($formParams) > 0) {
  5672.             if ($multipart) {
  5673.                 $multipartContents = [
  5674.                     [
  5675.                         'Content-type' => 'multipart/form-data',
  5676.                     ]
  5677.                 ];
  5678.                 
  5679.                 // for HTTP post (form)
  5680.                 $httpBody = new MultipartStream($multipartContents);
  5681.             } elseif ($headers['Content-Type'] === 'application/json') {
  5682.                 $httpBody \GuzzleHttp\json_encode($formParams);
  5683.             } else {
  5684.                 // for HTTP post (form)
  5685.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  5686.             }
  5687.         }
  5688.         // this endpoint requires OAuth (access token)
  5689.         if ($this->config->getAccessToken() !== null) {
  5690.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  5691.         }
  5692.         $defaultHeaders = [];
  5693.         if ($this->config->getUserAgent()) {
  5694.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  5695.         }
  5696.         $headers array_merge(
  5697.             $defaultHeaders,
  5698.             $headerParams,
  5699.             $headers
  5700.         );
  5701.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  5702.         return new Request(
  5703.             'PUT',
  5704.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  5705.             $headers,
  5706.             $httpBody
  5707.         );
  5708.     }
  5709.     /**
  5710.      * Operation createCurrency
  5711.      * Create a new currency for a Xero organisation
  5712.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  5713.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Currency $currency Currency object in the body of request (required)
  5714.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  5715.      * @throws \InvalidArgumentException
  5716.      * @return \XeroAPI\XeroPHP\Models\Accounting\Currencies
  5717.      */
  5718.     public function createCurrency($xero_tenant_id$currency)
  5719.     {
  5720.         list($response) = $this->createCurrencyWithHttpInfo($xero_tenant_id$currency);
  5721.         return $response;
  5722.     }
  5723.     /**
  5724.      * Operation createCurrencyWithHttpInfo
  5725.      * Create a new currency for a Xero organisation
  5726.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  5727.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Currency $currency Currency object in the body of request (required)
  5728.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  5729.      * @throws \InvalidArgumentException
  5730.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Currencies, HTTP status code, HTTP response headers (array of strings)
  5731.      */
  5732.     public function createCurrencyWithHttpInfo($xero_tenant_id$currency)
  5733.     {
  5734.         $request $this->createCurrencyRequest($xero_tenant_id$currency);
  5735.         try {
  5736.             $options $this->createHttpClientOption();
  5737.             try {
  5738.                 $response $this->client->send($request$options);
  5739.             } catch (RequestException $e) {
  5740.                 throw new ApiException(
  5741.                     "[{$e->getCode()}{$e->getMessage()}",
  5742.                     $e->getCode(),
  5743.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  5744.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  5745.                 );
  5746.             }
  5747.             $statusCode $response->getStatusCode();
  5748.             if ($statusCode 200 || $statusCode 299) {
  5749.                 throw new ApiException(
  5750.                     sprintf(
  5751.                         '[%d] Error connecting to the API (%s)',
  5752.                         $statusCode,
  5753.                         $request->getUri()
  5754.                     ),
  5755.                     $statusCode,
  5756.                     $response->getHeaders(),
  5757.                     $response->getBody()
  5758.                 );
  5759.             }
  5760.             $responseBody $response->getBody();
  5761.             switch($statusCode) {
  5762.                 case 200:
  5763.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Currencies' === '\SplFileObject') {
  5764.                         $content $responseBody//stream goes to serializer
  5765.                     } else {
  5766.                         $content $responseBody->getContents();
  5767.                     }
  5768.                     return [
  5769.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Currencies', []),
  5770.                         $response->getStatusCode(),
  5771.                         $response->getHeaders()
  5772.                     ];
  5773.             }
  5774.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Currencies';
  5775.             $responseBody $response->getBody();
  5776.             if ($returnType === '\SplFileObject') {
  5777.                 $content $responseBody//stream goes to serializer
  5778.             } else {
  5779.                 $content $responseBody->getContents();
  5780.             }
  5781.             return [
  5782.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  5783.                 $response->getStatusCode(),
  5784.                 $response->getHeaders()
  5785.             ];
  5786.         } catch (ApiException $e) {
  5787.             switch ($e->getCode()) {
  5788.                 case 200:
  5789.                     $data AccountingObjectSerializer::deserialize(
  5790.                         $e->getResponseBody(),
  5791.                         '\XeroAPI\XeroPHP\Models\Accounting\Currencies',
  5792.                         $e->getResponseHeaders()
  5793.                     );
  5794.                     $e->setResponseObject($data);
  5795.                     break;
  5796.             }
  5797.             throw $e;
  5798.         }
  5799.     }
  5800.     /**
  5801.      * Operation createCurrencyAsync
  5802.      * Create a new currency for a Xero organisation
  5803.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  5804.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Currency $currency Currency object in the body of request (required)
  5805.      * @throws \InvalidArgumentException
  5806.      * @return \GuzzleHttp\Promise\PromiseInterface
  5807.      */
  5808.     public function createCurrencyAsync($xero_tenant_id$currency)
  5809.     {
  5810.         return $this->createCurrencyAsyncWithHttpInfo($xero_tenant_id$currency)
  5811.             ->then(
  5812.                 function ($response) {
  5813.                     return $response[0];
  5814.                 }
  5815.             );
  5816.     }
  5817.     /**
  5818.      * Operation createCurrencyAsyncWithHttpInfo
  5819.      * Create a new currency for a Xero organisation
  5820.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  5821.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Currency $currency Currency object in the body of request (required)
  5822.      * @throws \InvalidArgumentException
  5823.      * @return \GuzzleHttp\Promise\PromiseInterface */
  5824.     public function createCurrencyAsyncWithHttpInfo($xero_tenant_id$currency)
  5825.     {
  5826.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Currencies';
  5827.         $request $this->createCurrencyRequest($xero_tenant_id$currency);
  5828.         return $this->client
  5829.             ->sendAsync($request$this->createHttpClientOption())
  5830.             ->then(
  5831.                 function ($response) use ($returnType) {
  5832.                     $responseBody $response->getBody();
  5833.                     if ($returnType === '\SplFileObject') {
  5834.                         $content $responseBody//stream goes to serializer
  5835.                     } else {
  5836.                         $content $responseBody->getContents();
  5837.                     }
  5838.                     return [
  5839.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  5840.                         $response->getStatusCode(),
  5841.                         $response->getHeaders()
  5842.                     ];
  5843.                 },
  5844.                 function ($exception) {
  5845.                     $response $exception->getResponse();
  5846.                     $statusCode $response->getStatusCode();
  5847.                     throw new ApiException(
  5848.                         sprintf(
  5849.                             '[%d] Error connecting to the API (%s)',
  5850.                             $statusCode,
  5851.                             $exception->getRequest()->getUri()
  5852.                         ),
  5853.                         $statusCode,
  5854.                         $response->getHeaders(),
  5855.                         $response->getBody()
  5856.                     );
  5857.                 }
  5858.             );
  5859.     }
  5860.     /**
  5861.      * Create request for operation 'createCurrency'
  5862.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  5863.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Currency $currency Currency object in the body of request (required)
  5864.      * @throws \InvalidArgumentException
  5865.      * @return \GuzzleHttp\Psr7\Request  */
  5866.     protected function createCurrencyRequest($xero_tenant_id$currency)
  5867.     {
  5868.         // verify the required parameter 'xero_tenant_id' is set
  5869.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  5870.             throw new \InvalidArgumentException(
  5871.                 'Missing the required parameter $xero_tenant_id when calling createCurrency'
  5872.             );
  5873.         }
  5874.         // verify the required parameter 'currency' is set
  5875.         if ($currency === null || (is_array($currency) && count($currency) === 0)) {
  5876.             throw new \InvalidArgumentException(
  5877.                 'Missing the required parameter $currency when calling createCurrency'
  5878.             );
  5879.         }
  5880.         $resourcePath '/Currencies';
  5881.         $formParams = [];
  5882.         $queryParams = [];
  5883.         $headerParams = [];
  5884.         $httpBody '';
  5885.         $multipart false;
  5886.         // header params
  5887.         if ($xero_tenant_id !== null) {
  5888.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  5889.         }
  5890.         // body params
  5891.         $_tempBody null;
  5892.         if (isset($currency)) {
  5893.             $_tempBody $currency;
  5894.         }
  5895.         if ($multipart) {
  5896.             $headers $this->headerSelector->selectHeadersForMultipart(
  5897.                 ['application/json']
  5898.             );
  5899.         } else {
  5900.             $headers $this->headerSelector->selectHeaders(
  5901.                 ['application/json'],
  5902.                 ['application/json']
  5903.             );
  5904.         }
  5905.         // for model (json/xml)
  5906.         if (isset($_tempBody)) {
  5907.             // $_tempBody is the method argument, if present
  5908.             if ($headers['Content-Type'] === 'application/json') {
  5909.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  5910.             } else {
  5911.                 $httpBody $_tempBody;
  5912.             }
  5913.         } elseif (count($formParams) > 0) {
  5914.             if ($multipart) {
  5915.                 $multipartContents = [
  5916.                     [
  5917.                         'Content-type' => 'multipart/form-data',
  5918.                     ]
  5919.                 ];
  5920.                 
  5921.                 // for HTTP post (form)
  5922.                 $httpBody = new MultipartStream($multipartContents);
  5923.             } elseif ($headers['Content-Type'] === 'application/json') {
  5924.                 $httpBody \GuzzleHttp\json_encode($formParams);
  5925.             } else {
  5926.                 // for HTTP post (form)
  5927.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  5928.             }
  5929.         }
  5930.         // this endpoint requires OAuth (access token)
  5931.         if ($this->config->getAccessToken() !== null) {
  5932.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  5933.         }
  5934.         $defaultHeaders = [];
  5935.         if ($this->config->getUserAgent()) {
  5936.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  5937.         }
  5938.         $headers array_merge(
  5939.             $defaultHeaders,
  5940.             $headerParams,
  5941.             $headers
  5942.         );
  5943.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  5944.         return new Request(
  5945.             'PUT',
  5946.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  5947.             $headers,
  5948.             $httpBody
  5949.         );
  5950.     }
  5951.     /**
  5952.      * Operation createEmployees
  5953.      * Creates new employees used in Xero payrun
  5954.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  5955.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Employees $employees Employees with array of Employee object in body of request (required)
  5956.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  5957.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  5958.      * @throws \InvalidArgumentException
  5959.      * @return \XeroAPI\XeroPHP\Models\Accounting\Employees|\XeroAPI\XeroPHP\Models\Accounting\Error
  5960.      */
  5961.     public function createEmployees($xero_tenant_id$employees$summarize_errors false)
  5962.     {
  5963.         list($response) = $this->createEmployeesWithHttpInfo($xero_tenant_id$employees$summarize_errors);
  5964.         return $response;
  5965.     }
  5966.     /**
  5967.      * Operation createEmployeesWithHttpInfo
  5968.      * Creates new employees used in Xero payrun
  5969.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  5970.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Employees $employees Employees with array of Employee object in body of request (required)
  5971.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  5972.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  5973.      * @throws \InvalidArgumentException
  5974.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Employees|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  5975.      */
  5976.     public function createEmployeesWithHttpInfo($xero_tenant_id$employees$summarize_errors false)
  5977.     {
  5978.         $request $this->createEmployeesRequest($xero_tenant_id$employees$summarize_errors);
  5979.         try {
  5980.             $options $this->createHttpClientOption();
  5981.             try {
  5982.                 $response $this->client->send($request$options);
  5983.             } catch (RequestException $e) {
  5984.                 throw new ApiException(
  5985.                     "[{$e->getCode()}{$e->getMessage()}",
  5986.                     $e->getCode(),
  5987.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  5988.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  5989.                 );
  5990.             }
  5991.             $statusCode $response->getStatusCode();
  5992.             if ($statusCode 200 || $statusCode 299) {
  5993.                 throw new ApiException(
  5994.                     sprintf(
  5995.                         '[%d] Error connecting to the API (%s)',
  5996.                         $statusCode,
  5997.                         $request->getUri()
  5998.                     ),
  5999.                     $statusCode,
  6000.                     $response->getHeaders(),
  6001.                     $response->getBody()
  6002.                 );
  6003.             }
  6004.             $responseBody $response->getBody();
  6005.             switch($statusCode) {
  6006.                 case 200:
  6007.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Employees' === '\SplFileObject') {
  6008.                         $content $responseBody//stream goes to serializer
  6009.                     } else {
  6010.                         $content $responseBody->getContents();
  6011.                     }
  6012.                     return [
  6013.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Employees', []),
  6014.                         $response->getStatusCode(),
  6015.                         $response->getHeaders()
  6016.                     ];
  6017.                 case 400:
  6018.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  6019.                         $content $responseBody//stream goes to serializer
  6020.                     } else {
  6021.                         $content $responseBody->getContents();
  6022.                     }
  6023.                     return [
  6024.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  6025.                         $response->getStatusCode(),
  6026.                         $response->getHeaders()
  6027.                     ];
  6028.             }
  6029.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Employees';
  6030.             $responseBody $response->getBody();
  6031.             if ($returnType === '\SplFileObject') {
  6032.                 $content $responseBody//stream goes to serializer
  6033.             } else {
  6034.                 $content $responseBody->getContents();
  6035.             }
  6036.             return [
  6037.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  6038.                 $response->getStatusCode(),
  6039.                 $response->getHeaders()
  6040.             ];
  6041.         } catch (ApiException $e) {
  6042.             switch ($e->getCode()) {
  6043.                 case 200:
  6044.                     $data AccountingObjectSerializer::deserialize(
  6045.                         $e->getResponseBody(),
  6046.                         '\XeroAPI\XeroPHP\Models\Accounting\Employees',
  6047.                         $e->getResponseHeaders()
  6048.                     );
  6049.                     $e->setResponseObject($data);
  6050.                     break;
  6051.                 case 400:
  6052.                     $data AccountingObjectSerializer::deserialize(
  6053.                         $e->getResponseBody(),
  6054.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  6055.                         $e->getResponseHeaders()
  6056.                     );
  6057.                     $e->setResponseObject($data);
  6058.                     break;
  6059.             }
  6060.             throw $e;
  6061.         }
  6062.     }
  6063.     /**
  6064.      * Operation createEmployeesAsync
  6065.      * Creates new employees used in Xero payrun
  6066.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  6067.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Employees $employees Employees with array of Employee object in body of request (required)
  6068.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  6069.      * @throws \InvalidArgumentException
  6070.      * @return \GuzzleHttp\Promise\PromiseInterface
  6071.      */
  6072.     public function createEmployeesAsync($xero_tenant_id$employees$summarize_errors false)
  6073.     {
  6074.         return $this->createEmployeesAsyncWithHttpInfo($xero_tenant_id$employees$summarize_errors)
  6075.             ->then(
  6076.                 function ($response) {
  6077.                     return $response[0];
  6078.                 }
  6079.             );
  6080.     }
  6081.     /**
  6082.      * Operation createEmployeesAsyncWithHttpInfo
  6083.      * Creates new employees used in Xero payrun
  6084.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  6085.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Employees $employees Employees with array of Employee object in body of request (required)
  6086.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  6087.      * @throws \InvalidArgumentException
  6088.      * @return \GuzzleHttp\Promise\PromiseInterface */
  6089.     public function createEmployeesAsyncWithHttpInfo($xero_tenant_id$employees$summarize_errors false)
  6090.     {
  6091.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Employees';
  6092.         $request $this->createEmployeesRequest($xero_tenant_id$employees$summarize_errors);
  6093.         return $this->client
  6094.             ->sendAsync($request$this->createHttpClientOption())
  6095.             ->then(
  6096.                 function ($response) use ($returnType) {
  6097.                     $responseBody $response->getBody();
  6098.                     if ($returnType === '\SplFileObject') {
  6099.                         $content $responseBody//stream goes to serializer
  6100.                     } else {
  6101.                         $content $responseBody->getContents();
  6102.                     }
  6103.                     return [
  6104.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  6105.                         $response->getStatusCode(),
  6106.                         $response->getHeaders()
  6107.                     ];
  6108.                 },
  6109.                 function ($exception) {
  6110.                     $response $exception->getResponse();
  6111.                     $statusCode $response->getStatusCode();
  6112.                     throw new ApiException(
  6113.                         sprintf(
  6114.                             '[%d] Error connecting to the API (%s)',
  6115.                             $statusCode,
  6116.                             $exception->getRequest()->getUri()
  6117.                         ),
  6118.                         $statusCode,
  6119.                         $response->getHeaders(),
  6120.                         $response->getBody()
  6121.                     );
  6122.                 }
  6123.             );
  6124.     }
  6125.     /**
  6126.      * Create request for operation 'createEmployees'
  6127.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  6128.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Employees $employees Employees with array of Employee object in body of request (required)
  6129.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  6130.      * @throws \InvalidArgumentException
  6131.      * @return \GuzzleHttp\Psr7\Request  */
  6132.     protected function createEmployeesRequest($xero_tenant_id$employees$summarize_errors false)
  6133.     {
  6134.         // verify the required parameter 'xero_tenant_id' is set
  6135.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  6136.             throw new \InvalidArgumentException(
  6137.                 'Missing the required parameter $xero_tenant_id when calling createEmployees'
  6138.             );
  6139.         }
  6140.         // verify the required parameter 'employees' is set
  6141.         if ($employees === null || (is_array($employees) && count($employees) === 0)) {
  6142.             throw new \InvalidArgumentException(
  6143.                 'Missing the required parameter $employees when calling createEmployees'
  6144.             );
  6145.         }
  6146.         $resourcePath '/Employees';
  6147.         $formParams = [];
  6148.         $queryParams = [];
  6149.         $headerParams = [];
  6150.         $httpBody '';
  6151.         $multipart false;
  6152.         // query params
  6153.         if ($summarize_errors !== null) {
  6154.             $queryParams['summarizeErrors'] = $summarize_errors 'true' 'false';
  6155.         }
  6156.         // header params
  6157.         if ($xero_tenant_id !== null) {
  6158.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  6159.         }
  6160.         // body params
  6161.         $_tempBody null;
  6162.         if (isset($employees)) {
  6163.             $_tempBody $employees;
  6164.         }
  6165.         if ($multipart) {
  6166.             $headers $this->headerSelector->selectHeadersForMultipart(
  6167.                 ['application/json']
  6168.             );
  6169.         } else {
  6170.             $headers $this->headerSelector->selectHeaders(
  6171.                 ['application/json'],
  6172.                 ['application/json']
  6173.             );
  6174.         }
  6175.         // for model (json/xml)
  6176.         if (isset($_tempBody)) {
  6177.             // $_tempBody is the method argument, if present
  6178.             if ($headers['Content-Type'] === 'application/json') {
  6179.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  6180.             } else {
  6181.                 $httpBody $_tempBody;
  6182.             }
  6183.         } elseif (count($formParams) > 0) {
  6184.             if ($multipart) {
  6185.                 $multipartContents = [
  6186.                     [
  6187.                         'Content-type' => 'multipart/form-data',
  6188.                     ]
  6189.                 ];
  6190.                 
  6191.                 // for HTTP post (form)
  6192.                 $httpBody = new MultipartStream($multipartContents);
  6193.             } elseif ($headers['Content-Type'] === 'application/json') {
  6194.                 $httpBody \GuzzleHttp\json_encode($formParams);
  6195.             } else {
  6196.                 // for HTTP post (form)
  6197.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  6198.             }
  6199.         }
  6200.         // this endpoint requires OAuth (access token)
  6201.         if ($this->config->getAccessToken() !== null) {
  6202.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  6203.         }
  6204.         $defaultHeaders = [];
  6205.         if ($this->config->getUserAgent()) {
  6206.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  6207.         }
  6208.         $headers array_merge(
  6209.             $defaultHeaders,
  6210.             $headerParams,
  6211.             $headers
  6212.         );
  6213.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  6214.         return new Request(
  6215.             'PUT',
  6216.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  6217.             $headers,
  6218.             $httpBody
  6219.         );
  6220.     }
  6221.     /**
  6222.      * Operation createExpenseClaimHistory
  6223.      * Creates a history record for a specific expense claim
  6224.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  6225.      * @param  string $expense_claim_id Unique identifier for a ExpenseClaim (required)
  6226.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  6227.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  6228.      * @throws \InvalidArgumentException
  6229.      * @return \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords
  6230.      */
  6231.     public function createExpenseClaimHistory($xero_tenant_id$expense_claim_id$history_records)
  6232.     {
  6233.         list($response) = $this->createExpenseClaimHistoryWithHttpInfo($xero_tenant_id$expense_claim_id$history_records);
  6234.         return $response;
  6235.     }
  6236.     /**
  6237.      * Operation createExpenseClaimHistoryWithHttpInfo
  6238.      * Creates a history record for a specific expense claim
  6239.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  6240.      * @param  string $expense_claim_id Unique identifier for a ExpenseClaim (required)
  6241.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  6242.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  6243.      * @throws \InvalidArgumentException
  6244.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords, HTTP status code, HTTP response headers (array of strings)
  6245.      */
  6246.     public function createExpenseClaimHistoryWithHttpInfo($xero_tenant_id$expense_claim_id$history_records)
  6247.     {
  6248.         $request $this->createExpenseClaimHistoryRequest($xero_tenant_id$expense_claim_id$history_records);
  6249.         try {
  6250.             $options $this->createHttpClientOption();
  6251.             try {
  6252.                 $response $this->client->send($request$options);
  6253.             } catch (RequestException $e) {
  6254.                 throw new ApiException(
  6255.                     "[{$e->getCode()}{$e->getMessage()}",
  6256.                     $e->getCode(),
  6257.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  6258.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  6259.                 );
  6260.             }
  6261.             $statusCode $response->getStatusCode();
  6262.             if ($statusCode 200 || $statusCode 299) {
  6263.                 throw new ApiException(
  6264.                     sprintf(
  6265.                         '[%d] Error connecting to the API (%s)',
  6266.                         $statusCode,
  6267.                         $request->getUri()
  6268.                     ),
  6269.                     $statusCode,
  6270.                     $response->getHeaders(),
  6271.                     $response->getBody()
  6272.                 );
  6273.             }
  6274.             $responseBody $response->getBody();
  6275.             switch($statusCode) {
  6276.                 case 200:
  6277.                     if ('\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords' === '\SplFileObject') {
  6278.                         $content $responseBody//stream goes to serializer
  6279.                     } else {
  6280.                         $content $responseBody->getContents();
  6281.                     }
  6282.                     return [
  6283.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords', []),
  6284.                         $response->getStatusCode(),
  6285.                         $response->getHeaders()
  6286.                     ];
  6287.             }
  6288.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  6289.             $responseBody $response->getBody();
  6290.             if ($returnType === '\SplFileObject') {
  6291.                 $content $responseBody//stream goes to serializer
  6292.             } else {
  6293.                 $content $responseBody->getContents();
  6294.             }
  6295.             return [
  6296.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  6297.                 $response->getStatusCode(),
  6298.                 $response->getHeaders()
  6299.             ];
  6300.         } catch (ApiException $e) {
  6301.             switch ($e->getCode()) {
  6302.                 case 200:
  6303.                     $data AccountingObjectSerializer::deserialize(
  6304.                         $e->getResponseBody(),
  6305.                         '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords',
  6306.                         $e->getResponseHeaders()
  6307.                     );
  6308.                     $e->setResponseObject($data);
  6309.                     break;
  6310.             }
  6311.             throw $e;
  6312.         }
  6313.     }
  6314.     /**
  6315.      * Operation createExpenseClaimHistoryAsync
  6316.      * Creates a history record for a specific expense claim
  6317.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  6318.      * @param  string $expense_claim_id Unique identifier for a ExpenseClaim (required)
  6319.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  6320.      * @throws \InvalidArgumentException
  6321.      * @return \GuzzleHttp\Promise\PromiseInterface
  6322.      */
  6323.     public function createExpenseClaimHistoryAsync($xero_tenant_id$expense_claim_id$history_records)
  6324.     {
  6325.         return $this->createExpenseClaimHistoryAsyncWithHttpInfo($xero_tenant_id$expense_claim_id$history_records)
  6326.             ->then(
  6327.                 function ($response) {
  6328.                     return $response[0];
  6329.                 }
  6330.             );
  6331.     }
  6332.     /**
  6333.      * Operation createExpenseClaimHistoryAsyncWithHttpInfo
  6334.      * Creates a history record for a specific expense claim
  6335.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  6336.      * @param  string $expense_claim_id Unique identifier for a ExpenseClaim (required)
  6337.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  6338.      * @throws \InvalidArgumentException
  6339.      * @return \GuzzleHttp\Promise\PromiseInterface */
  6340.     public function createExpenseClaimHistoryAsyncWithHttpInfo($xero_tenant_id$expense_claim_id$history_records)
  6341.     {
  6342.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  6343.         $request $this->createExpenseClaimHistoryRequest($xero_tenant_id$expense_claim_id$history_records);
  6344.         return $this->client
  6345.             ->sendAsync($request$this->createHttpClientOption())
  6346.             ->then(
  6347.                 function ($response) use ($returnType) {
  6348.                     $responseBody $response->getBody();
  6349.                     if ($returnType === '\SplFileObject') {
  6350.                         $content $responseBody//stream goes to serializer
  6351.                     } else {
  6352.                         $content $responseBody->getContents();
  6353.                     }
  6354.                     return [
  6355.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  6356.                         $response->getStatusCode(),
  6357.                         $response->getHeaders()
  6358.                     ];
  6359.                 },
  6360.                 function ($exception) {
  6361.                     $response $exception->getResponse();
  6362.                     $statusCode $response->getStatusCode();
  6363.                     throw new ApiException(
  6364.                         sprintf(
  6365.                             '[%d] Error connecting to the API (%s)',
  6366.                             $statusCode,
  6367.                             $exception->getRequest()->getUri()
  6368.                         ),
  6369.                         $statusCode,
  6370.                         $response->getHeaders(),
  6371.                         $response->getBody()
  6372.                     );
  6373.                 }
  6374.             );
  6375.     }
  6376.     /**
  6377.      * Create request for operation 'createExpenseClaimHistory'
  6378.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  6379.      * @param  string $expense_claim_id Unique identifier for a ExpenseClaim (required)
  6380.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  6381.      * @throws \InvalidArgumentException
  6382.      * @return \GuzzleHttp\Psr7\Request  */
  6383.     protected function createExpenseClaimHistoryRequest($xero_tenant_id$expense_claim_id$history_records)
  6384.     {
  6385.         // verify the required parameter 'xero_tenant_id' is set
  6386.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  6387.             throw new \InvalidArgumentException(
  6388.                 'Missing the required parameter $xero_tenant_id when calling createExpenseClaimHistory'
  6389.             );
  6390.         }
  6391.         // verify the required parameter 'expense_claim_id' is set
  6392.         if ($expense_claim_id === null || (is_array($expense_claim_id) && count($expense_claim_id) === 0)) {
  6393.             throw new \InvalidArgumentException(
  6394.                 'Missing the required parameter $expense_claim_id when calling createExpenseClaimHistory'
  6395.             );
  6396.         }
  6397.         // verify the required parameter 'history_records' is set
  6398.         if ($history_records === null || (is_array($history_records) && count($history_records) === 0)) {
  6399.             throw new \InvalidArgumentException(
  6400.                 'Missing the required parameter $history_records when calling createExpenseClaimHistory'
  6401.             );
  6402.         }
  6403.         $resourcePath '/ExpenseClaims/{ExpenseClaimID}/History';
  6404.         $formParams = [];
  6405.         $queryParams = [];
  6406.         $headerParams = [];
  6407.         $httpBody '';
  6408.         $multipart false;
  6409.         // header params
  6410.         if ($xero_tenant_id !== null) {
  6411.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  6412.         }
  6413.         // path params
  6414.         if ($expense_claim_id !== null) {
  6415.             $resourcePath str_replace(
  6416.                 '{' 'ExpenseClaimID' '}',
  6417.                 AccountingObjectSerializer::toPathValue($expense_claim_id),
  6418.                 $resourcePath
  6419.             );
  6420.         }
  6421.         // body params
  6422.         $_tempBody null;
  6423.         if (isset($history_records)) {
  6424.             $_tempBody $history_records;
  6425.         }
  6426.         if ($multipart) {
  6427.             $headers $this->headerSelector->selectHeadersForMultipart(
  6428.                 ['application/json']
  6429.             );
  6430.         } else {
  6431.             $headers $this->headerSelector->selectHeaders(
  6432.                 ['application/json'],
  6433.                 ['application/json']
  6434.             );
  6435.         }
  6436.         // for model (json/xml)
  6437.         if (isset($_tempBody)) {
  6438.             // $_tempBody is the method argument, if present
  6439.             if ($headers['Content-Type'] === 'application/json') {
  6440.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  6441.             } else {
  6442.                 $httpBody $_tempBody;
  6443.             }
  6444.         } elseif (count($formParams) > 0) {
  6445.             if ($multipart) {
  6446.                 $multipartContents = [
  6447.                     [
  6448.                         'Content-type' => 'multipart/form-data',
  6449.                     ]
  6450.                 ];
  6451.                 
  6452.                 // for HTTP post (form)
  6453.                 $httpBody = new MultipartStream($multipartContents);
  6454.             } elseif ($headers['Content-Type'] === 'application/json') {
  6455.                 $httpBody \GuzzleHttp\json_encode($formParams);
  6456.             } else {
  6457.                 // for HTTP post (form)
  6458.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  6459.             }
  6460.         }
  6461.         // this endpoint requires OAuth (access token)
  6462.         if ($this->config->getAccessToken() !== null) {
  6463.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  6464.         }
  6465.         $defaultHeaders = [];
  6466.         if ($this->config->getUserAgent()) {
  6467.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  6468.         }
  6469.         $headers array_merge(
  6470.             $defaultHeaders,
  6471.             $headerParams,
  6472.             $headers
  6473.         );
  6474.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  6475.         return new Request(
  6476.             'PUT',
  6477.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  6478.             $headers,
  6479.             $httpBody
  6480.         );
  6481.     }
  6482.     /**
  6483.      * Operation createExpenseClaims
  6484.      * Creates expense claims
  6485.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  6486.      * @param  \XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims $expense_claims ExpenseClaims with array of ExpenseClaim object in body of request (required)
  6487.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  6488.      * @throws \InvalidArgumentException
  6489.      * @return \XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims|\XeroAPI\XeroPHP\Models\Accounting\Error
  6490.      */
  6491.     public function createExpenseClaims($xero_tenant_id$expense_claims)
  6492.     {
  6493.         list($response) = $this->createExpenseClaimsWithHttpInfo($xero_tenant_id$expense_claims);
  6494.         return $response;
  6495.     }
  6496.     /**
  6497.      * Operation createExpenseClaimsWithHttpInfo
  6498.      * Creates expense claims
  6499.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  6500.      * @param  \XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims $expense_claims ExpenseClaims with array of ExpenseClaim object in body of request (required)
  6501.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  6502.      * @throws \InvalidArgumentException
  6503.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  6504.      */
  6505.     public function createExpenseClaimsWithHttpInfo($xero_tenant_id$expense_claims)
  6506.     {
  6507.         $request $this->createExpenseClaimsRequest($xero_tenant_id$expense_claims);
  6508.         try {
  6509.             $options $this->createHttpClientOption();
  6510.             try {
  6511.                 $response $this->client->send($request$options);
  6512.             } catch (RequestException $e) {
  6513.                 throw new ApiException(
  6514.                     "[{$e->getCode()}{$e->getMessage()}",
  6515.                     $e->getCode(),
  6516.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  6517.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  6518.                 );
  6519.             }
  6520.             $statusCode $response->getStatusCode();
  6521.             if ($statusCode 200 || $statusCode 299) {
  6522.                 throw new ApiException(
  6523.                     sprintf(
  6524.                         '[%d] Error connecting to the API (%s)',
  6525.                         $statusCode,
  6526.                         $request->getUri()
  6527.                     ),
  6528.                     $statusCode,
  6529.                     $response->getHeaders(),
  6530.                     $response->getBody()
  6531.                 );
  6532.             }
  6533.             $responseBody $response->getBody();
  6534.             switch($statusCode) {
  6535.                 case 200:
  6536.                     if ('\XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims' === '\SplFileObject') {
  6537.                         $content $responseBody//stream goes to serializer
  6538.                     } else {
  6539.                         $content $responseBody->getContents();
  6540.                     }
  6541.                     return [
  6542.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims', []),
  6543.                         $response->getStatusCode(),
  6544.                         $response->getHeaders()
  6545.                     ];
  6546.                 case 400:
  6547.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  6548.                         $content $responseBody//stream goes to serializer
  6549.                     } else {
  6550.                         $content $responseBody->getContents();
  6551.                     }
  6552.                     return [
  6553.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  6554.                         $response->getStatusCode(),
  6555.                         $response->getHeaders()
  6556.                     ];
  6557.             }
  6558.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims';
  6559.             $responseBody $response->getBody();
  6560.             if ($returnType === '\SplFileObject') {
  6561.                 $content $responseBody//stream goes to serializer
  6562.             } else {
  6563.                 $content $responseBody->getContents();
  6564.             }
  6565.             return [
  6566.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  6567.                 $response->getStatusCode(),
  6568.                 $response->getHeaders()
  6569.             ];
  6570.         } catch (ApiException $e) {
  6571.             switch ($e->getCode()) {
  6572.                 case 200:
  6573.                     $data AccountingObjectSerializer::deserialize(
  6574.                         $e->getResponseBody(),
  6575.                         '\XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims',
  6576.                         $e->getResponseHeaders()
  6577.                     );
  6578.                     $e->setResponseObject($data);
  6579.                     break;
  6580.                 case 400:
  6581.                     $data AccountingObjectSerializer::deserialize(
  6582.                         $e->getResponseBody(),
  6583.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  6584.                         $e->getResponseHeaders()
  6585.                     );
  6586.                     $e->setResponseObject($data);
  6587.                     break;
  6588.             }
  6589.             throw $e;
  6590.         }
  6591.     }
  6592.     /**
  6593.      * Operation createExpenseClaimsAsync
  6594.      * Creates expense claims
  6595.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  6596.      * @param  \XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims $expense_claims ExpenseClaims with array of ExpenseClaim object in body of request (required)
  6597.      * @throws \InvalidArgumentException
  6598.      * @return \GuzzleHttp\Promise\PromiseInterface
  6599.      */
  6600.     public function createExpenseClaimsAsync($xero_tenant_id$expense_claims)
  6601.     {
  6602.         return $this->createExpenseClaimsAsyncWithHttpInfo($xero_tenant_id$expense_claims)
  6603.             ->then(
  6604.                 function ($response) {
  6605.                     return $response[0];
  6606.                 }
  6607.             );
  6608.     }
  6609.     /**
  6610.      * Operation createExpenseClaimsAsyncWithHttpInfo
  6611.      * Creates expense claims
  6612.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  6613.      * @param  \XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims $expense_claims ExpenseClaims with array of ExpenseClaim object in body of request (required)
  6614.      * @throws \InvalidArgumentException
  6615.      * @return \GuzzleHttp\Promise\PromiseInterface */
  6616.     public function createExpenseClaimsAsyncWithHttpInfo($xero_tenant_id$expense_claims)
  6617.     {
  6618.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims';
  6619.         $request $this->createExpenseClaimsRequest($xero_tenant_id$expense_claims);
  6620.         return $this->client
  6621.             ->sendAsync($request$this->createHttpClientOption())
  6622.             ->then(
  6623.                 function ($response) use ($returnType) {
  6624.                     $responseBody $response->getBody();
  6625.                     if ($returnType === '\SplFileObject') {
  6626.                         $content $responseBody//stream goes to serializer
  6627.                     } else {
  6628.                         $content $responseBody->getContents();
  6629.                     }
  6630.                     return [
  6631.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  6632.                         $response->getStatusCode(),
  6633.                         $response->getHeaders()
  6634.                     ];
  6635.                 },
  6636.                 function ($exception) {
  6637.                     $response $exception->getResponse();
  6638.                     $statusCode $response->getStatusCode();
  6639.                     throw new ApiException(
  6640.                         sprintf(
  6641.                             '[%d] Error connecting to the API (%s)',
  6642.                             $statusCode,
  6643.                             $exception->getRequest()->getUri()
  6644.                         ),
  6645.                         $statusCode,
  6646.                         $response->getHeaders(),
  6647.                         $response->getBody()
  6648.                     );
  6649.                 }
  6650.             );
  6651.     }
  6652.     /**
  6653.      * Create request for operation 'createExpenseClaims'
  6654.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  6655.      * @param  \XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims $expense_claims ExpenseClaims with array of ExpenseClaim object in body of request (required)
  6656.      * @throws \InvalidArgumentException
  6657.      * @return \GuzzleHttp\Psr7\Request  */
  6658.     protected function createExpenseClaimsRequest($xero_tenant_id$expense_claims)
  6659.     {
  6660.         // verify the required parameter 'xero_tenant_id' is set
  6661.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  6662.             throw new \InvalidArgumentException(
  6663.                 'Missing the required parameter $xero_tenant_id when calling createExpenseClaims'
  6664.             );
  6665.         }
  6666.         // verify the required parameter 'expense_claims' is set
  6667.         if ($expense_claims === null || (is_array($expense_claims) && count($expense_claims) === 0)) {
  6668.             throw new \InvalidArgumentException(
  6669.                 'Missing the required parameter $expense_claims when calling createExpenseClaims'
  6670.             );
  6671.         }
  6672.         $resourcePath '/ExpenseClaims';
  6673.         $formParams = [];
  6674.         $queryParams = [];
  6675.         $headerParams = [];
  6676.         $httpBody '';
  6677.         $multipart false;
  6678.         // header params
  6679.         if ($xero_tenant_id !== null) {
  6680.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  6681.         }
  6682.         // body params
  6683.         $_tempBody null;
  6684.         if (isset($expense_claims)) {
  6685.             $_tempBody $expense_claims;
  6686.         }
  6687.         if ($multipart) {
  6688.             $headers $this->headerSelector->selectHeadersForMultipart(
  6689.                 ['application/json']
  6690.             );
  6691.         } else {
  6692.             $headers $this->headerSelector->selectHeaders(
  6693.                 ['application/json'],
  6694.                 ['application/json']
  6695.             );
  6696.         }
  6697.         // for model (json/xml)
  6698.         if (isset($_tempBody)) {
  6699.             // $_tempBody is the method argument, if present
  6700.             if ($headers['Content-Type'] === 'application/json') {
  6701.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  6702.             } else {
  6703.                 $httpBody $_tempBody;
  6704.             }
  6705.         } elseif (count($formParams) > 0) {
  6706.             if ($multipart) {
  6707.                 $multipartContents = [
  6708.                     [
  6709.                         'Content-type' => 'multipart/form-data',
  6710.                     ]
  6711.                 ];
  6712.                 
  6713.                 // for HTTP post (form)
  6714.                 $httpBody = new MultipartStream($multipartContents);
  6715.             } elseif ($headers['Content-Type'] === 'application/json') {
  6716.                 $httpBody \GuzzleHttp\json_encode($formParams);
  6717.             } else {
  6718.                 // for HTTP post (form)
  6719.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  6720.             }
  6721.         }
  6722.         // this endpoint requires OAuth (access token)
  6723.         if ($this->config->getAccessToken() !== null) {
  6724.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  6725.         }
  6726.         $defaultHeaders = [];
  6727.         if ($this->config->getUserAgent()) {
  6728.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  6729.         }
  6730.         $headers array_merge(
  6731.             $defaultHeaders,
  6732.             $headerParams,
  6733.             $headers
  6734.         );
  6735.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  6736.         return new Request(
  6737.             'PUT',
  6738.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  6739.             $headers,
  6740.             $httpBody
  6741.         );
  6742.     }
  6743.     /**
  6744.      * Operation createInvoiceAttachmentByFileName
  6745.      * Creates an attachment for a specific invoice or purchase bill by filename
  6746.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  6747.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  6748.      * @param  string $file_name Name of the attachment (required)
  6749.      * @param  string $body Byte array of file in body of request (required)
  6750.      * @param  bool $include_online Allows an attachment to be seen by the end customer within their online invoice (optional, default to false)
  6751.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  6752.      * @throws \InvalidArgumentException
  6753.      * @return \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error
  6754.      */
  6755.     public function createInvoiceAttachmentByFileName($xero_tenant_id$invoice_id$file_name$body$include_online false)
  6756.     {
  6757.         list($response) = $this->createInvoiceAttachmentByFileNameWithHttpInfo($xero_tenant_id$invoice_id$file_name$body$include_online);
  6758.         return $response;
  6759.     }
  6760.     /**
  6761.      * Operation createInvoiceAttachmentByFileNameWithHttpInfo
  6762.      * Creates an attachment for a specific invoice or purchase bill by filename
  6763.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  6764.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  6765.      * @param  string $file_name Name of the attachment (required)
  6766.      * @param  string $body Byte array of file in body of request (required)
  6767.      * @param  bool $include_online Allows an attachment to be seen by the end customer within their online invoice (optional, default to false)
  6768.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  6769.      * @throws \InvalidArgumentException
  6770.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  6771.      */
  6772.     public function createInvoiceAttachmentByFileNameWithHttpInfo($xero_tenant_id$invoice_id$file_name$body$include_online false)
  6773.     {
  6774.         $request $this->createInvoiceAttachmentByFileNameRequest($xero_tenant_id$invoice_id$file_name$body$include_online);
  6775.         try {
  6776.             $options $this->createHttpClientOption();
  6777.             try {
  6778.                 $response $this->client->send($request$options);
  6779.             } catch (RequestException $e) {
  6780.                 throw new ApiException(
  6781.                     "[{$e->getCode()}{$e->getMessage()}",
  6782.                     $e->getCode(),
  6783.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  6784.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  6785.                 );
  6786.             }
  6787.             $statusCode $response->getStatusCode();
  6788.             if ($statusCode 200 || $statusCode 299) {
  6789.                 throw new ApiException(
  6790.                     sprintf(
  6791.                         '[%d] Error connecting to the API (%s)',
  6792.                         $statusCode,
  6793.                         $request->getUri()
  6794.                     ),
  6795.                     $statusCode,
  6796.                     $response->getHeaders(),
  6797.                     $response->getBody()
  6798.                 );
  6799.             }
  6800.             $responseBody $response->getBody();
  6801.             switch($statusCode) {
  6802.                 case 200:
  6803.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Attachments' === '\SplFileObject') {
  6804.                         $content $responseBody//stream goes to serializer
  6805.                     } else {
  6806.                         $content $responseBody->getContents();
  6807.                     }
  6808.                     return [
  6809.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Attachments', []),
  6810.                         $response->getStatusCode(),
  6811.                         $response->getHeaders()
  6812.                     ];
  6813.                 case 400:
  6814.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  6815.                         $content $responseBody//stream goes to serializer
  6816.                     } else {
  6817.                         $content $responseBody->getContents();
  6818.                     }
  6819.                     return [
  6820.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  6821.                         $response->getStatusCode(),
  6822.                         $response->getHeaders()
  6823.                     ];
  6824.             }
  6825.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  6826.             $responseBody $response->getBody();
  6827.             if ($returnType === '\SplFileObject') {
  6828.                 $content $responseBody//stream goes to serializer
  6829.             } else {
  6830.                 $content $responseBody->getContents();
  6831.             }
  6832.             return [
  6833.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  6834.                 $response->getStatusCode(),
  6835.                 $response->getHeaders()
  6836.             ];
  6837.         } catch (ApiException $e) {
  6838.             switch ($e->getCode()) {
  6839.                 case 200:
  6840.                     $data AccountingObjectSerializer::deserialize(
  6841.                         $e->getResponseBody(),
  6842.                         '\XeroAPI\XeroPHP\Models\Accounting\Attachments',
  6843.                         $e->getResponseHeaders()
  6844.                     );
  6845.                     $e->setResponseObject($data);
  6846.                     break;
  6847.                 case 400:
  6848.                     $data AccountingObjectSerializer::deserialize(
  6849.                         $e->getResponseBody(),
  6850.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  6851.                         $e->getResponseHeaders()
  6852.                     );
  6853.                     $e->setResponseObject($data);
  6854.                     break;
  6855.             }
  6856.             throw $e;
  6857.         }
  6858.     }
  6859.     /**
  6860.      * Operation createInvoiceAttachmentByFileNameAsync
  6861.      * Creates an attachment for a specific invoice or purchase bill by filename
  6862.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  6863.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  6864.      * @param  string $file_name Name of the attachment (required)
  6865.      * @param  string $body Byte array of file in body of request (required)
  6866.      * @param  bool $include_online Allows an attachment to be seen by the end customer within their online invoice (optional, default to false)
  6867.      * @throws \InvalidArgumentException
  6868.      * @return \GuzzleHttp\Promise\PromiseInterface
  6869.      */
  6870.     public function createInvoiceAttachmentByFileNameAsync($xero_tenant_id$invoice_id$file_name$body$include_online false)
  6871.     {
  6872.         return $this->createInvoiceAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$invoice_id$file_name$body$include_online)
  6873.             ->then(
  6874.                 function ($response) {
  6875.                     return $response[0];
  6876.                 }
  6877.             );
  6878.     }
  6879.     /**
  6880.      * Operation createInvoiceAttachmentByFileNameAsyncWithHttpInfo
  6881.      * Creates an attachment for a specific invoice or purchase bill by filename
  6882.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  6883.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  6884.      * @param  string $file_name Name of the attachment (required)
  6885.      * @param  string $body Byte array of file in body of request (required)
  6886.      * @param  bool $include_online Allows an attachment to be seen by the end customer within their online invoice (optional, default to false)
  6887.      * @throws \InvalidArgumentException
  6888.      * @return \GuzzleHttp\Promise\PromiseInterface */
  6889.     public function createInvoiceAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$invoice_id$file_name$body$include_online false)
  6890.     {
  6891.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  6892.         $request $this->createInvoiceAttachmentByFileNameRequest($xero_tenant_id$invoice_id$file_name$body$include_online);
  6893.         return $this->client
  6894.             ->sendAsync($request$this->createHttpClientOption())
  6895.             ->then(
  6896.                 function ($response) use ($returnType) {
  6897.                     $responseBody $response->getBody();
  6898.                     if ($returnType === '\SplFileObject') {
  6899.                         $content $responseBody//stream goes to serializer
  6900.                     } else {
  6901.                         $content $responseBody->getContents();
  6902.                     }
  6903.                     return [
  6904.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  6905.                         $response->getStatusCode(),
  6906.                         $response->getHeaders()
  6907.                     ];
  6908.                 },
  6909.                 function ($exception) {
  6910.                     $response $exception->getResponse();
  6911.                     $statusCode $response->getStatusCode();
  6912.                     throw new ApiException(
  6913.                         sprintf(
  6914.                             '[%d] Error connecting to the API (%s)',
  6915.                             $statusCode,
  6916.                             $exception->getRequest()->getUri()
  6917.                         ),
  6918.                         $statusCode,
  6919.                         $response->getHeaders(),
  6920.                         $response->getBody()
  6921.                     );
  6922.                 }
  6923.             );
  6924.     }
  6925.     /**
  6926.      * Create request for operation 'createInvoiceAttachmentByFileName'
  6927.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  6928.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  6929.      * @param  string $file_name Name of the attachment (required)
  6930.      * @param  string $body Byte array of file in body of request (required)
  6931.      * @param  bool $include_online Allows an attachment to be seen by the end customer within their online invoice (optional, default to false)
  6932.      * @throws \InvalidArgumentException
  6933.      * @return \GuzzleHttp\Psr7\Request  */
  6934.     protected function createInvoiceAttachmentByFileNameRequest($xero_tenant_id$invoice_id$file_name$body$include_online false)
  6935.     {
  6936.         // verify the required parameter 'xero_tenant_id' is set
  6937.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  6938.             throw new \InvalidArgumentException(
  6939.                 'Missing the required parameter $xero_tenant_id when calling createInvoiceAttachmentByFileName'
  6940.             );
  6941.         }
  6942.         // verify the required parameter 'invoice_id' is set
  6943.         if ($invoice_id === null || (is_array($invoice_id) && count($invoice_id) === 0)) {
  6944.             throw new \InvalidArgumentException(
  6945.                 'Missing the required parameter $invoice_id when calling createInvoiceAttachmentByFileName'
  6946.             );
  6947.         }
  6948.         // verify the required parameter 'file_name' is set
  6949.         if ($file_name === null || (is_array($file_name) && count($file_name) === 0)) {
  6950.             throw new \InvalidArgumentException(
  6951.                 'Missing the required parameter $file_name when calling createInvoiceAttachmentByFileName'
  6952.             );
  6953.         }
  6954.         // verify the required parameter 'body' is set
  6955.         if ($body === null || (is_array($body) && count($body) === 0)) {
  6956.             throw new \InvalidArgumentException(
  6957.                 'Missing the required parameter $body when calling createInvoiceAttachmentByFileName'
  6958.             );
  6959.         }
  6960.         $resourcePath '/Invoices/{InvoiceID}/Attachments/{FileName}';
  6961.         $formParams = [];
  6962.         $queryParams = [];
  6963.         $headerParams = [];
  6964.         $httpBody '';
  6965.         $multipart false;
  6966.         // query params
  6967.         if ($include_online !== null) {
  6968.             $queryParams['IncludeOnline'] = $include_online 'true' 'false';
  6969.         }
  6970.         // header params
  6971.         if ($xero_tenant_id !== null) {
  6972.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  6973.         }
  6974.         // path params
  6975.         if ($invoice_id !== null) {
  6976.             $resourcePath str_replace(
  6977.                 '{' 'InvoiceID' '}',
  6978.                 AccountingObjectSerializer::toPathValue($invoice_id),
  6979.                 $resourcePath
  6980.             );
  6981.         }
  6982.         // path params
  6983.         if ($file_name !== null) {
  6984.             $resourcePath str_replace(
  6985.                 '{' 'FileName' '}',
  6986.                 AccountingObjectSerializer::toPathValue($file_name),
  6987.                 $resourcePath
  6988.             );
  6989.         }
  6990.         // body params
  6991.         $_tempBody null;
  6992.         if (isset($body)) {
  6993.             $_tempBody $body;
  6994.         }
  6995.         if ($multipart) {
  6996.             $headers $this->headerSelector->selectHeadersForMultipart(
  6997.                 ['application/json']
  6998.             );
  6999.         } else {
  7000.             $headers $this->headerSelector->selectHeaders(
  7001.                 ['application/json'],
  7002.                 ['application/octet-stream']
  7003.             );
  7004.         }
  7005.         // for model (json/xml)
  7006.         if (isset($_tempBody)) {
  7007.             // $_tempBody is the method argument, if present
  7008.             if ($headers['Content-Type'] === 'application/json') {
  7009.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  7010.             } else {
  7011.                 $httpBody $_tempBody;
  7012.             }
  7013.         } elseif (count($formParams) > 0) {
  7014.             if ($multipart) {
  7015.                 $multipartContents = [
  7016.                     [
  7017.                         'Content-type' => 'multipart/form-data',
  7018.                     ]
  7019.                 ];
  7020.                 
  7021.                 // for HTTP post (form)
  7022.                 $httpBody = new MultipartStream($multipartContents);
  7023.             } elseif ($headers['Content-Type'] === 'application/json') {
  7024.                 $httpBody \GuzzleHttp\json_encode($formParams);
  7025.             } else {
  7026.                 // for HTTP post (form)
  7027.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  7028.             }
  7029.         }
  7030.         // this endpoint requires OAuth (access token)
  7031.         if ($this->config->getAccessToken() !== null) {
  7032.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  7033.         }
  7034.         $defaultHeaders = [];
  7035.         if ($this->config->getUserAgent()) {
  7036.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  7037.         }
  7038.         $headers array_merge(
  7039.             $defaultHeaders,
  7040.             $headerParams,
  7041.             $headers
  7042.         );
  7043.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  7044.         return new Request(
  7045.             'PUT',
  7046.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  7047.             $headers,
  7048.             $httpBody
  7049.         );
  7050.     }
  7051.     /**
  7052.      * Operation createInvoiceHistory
  7053.      * Creates a history record for a specific invoice
  7054.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  7055.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  7056.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  7057.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  7058.      * @throws \InvalidArgumentException
  7059.      * @return \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords|\XeroAPI\XeroPHP\Models\Accounting\Error
  7060.      */
  7061.     public function createInvoiceHistory($xero_tenant_id$invoice_id$history_records)
  7062.     {
  7063.         list($response) = $this->createInvoiceHistoryWithHttpInfo($xero_tenant_id$invoice_id$history_records);
  7064.         return $response;
  7065.     }
  7066.     /**
  7067.      * Operation createInvoiceHistoryWithHttpInfo
  7068.      * Creates a history record for a specific invoice
  7069.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  7070.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  7071.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  7072.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  7073.      * @throws \InvalidArgumentException
  7074.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  7075.      */
  7076.     public function createInvoiceHistoryWithHttpInfo($xero_tenant_id$invoice_id$history_records)
  7077.     {
  7078.         $request $this->createInvoiceHistoryRequest($xero_tenant_id$invoice_id$history_records);
  7079.         try {
  7080.             $options $this->createHttpClientOption();
  7081.             try {
  7082.                 $response $this->client->send($request$options);
  7083.             } catch (RequestException $e) {
  7084.                 throw new ApiException(
  7085.                     "[{$e->getCode()}{$e->getMessage()}",
  7086.                     $e->getCode(),
  7087.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  7088.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  7089.                 );
  7090.             }
  7091.             $statusCode $response->getStatusCode();
  7092.             if ($statusCode 200 || $statusCode 299) {
  7093.                 throw new ApiException(
  7094.                     sprintf(
  7095.                         '[%d] Error connecting to the API (%s)',
  7096.                         $statusCode,
  7097.                         $request->getUri()
  7098.                     ),
  7099.                     $statusCode,
  7100.                     $response->getHeaders(),
  7101.                     $response->getBody()
  7102.                 );
  7103.             }
  7104.             $responseBody $response->getBody();
  7105.             switch($statusCode) {
  7106.                 case 200:
  7107.                     if ('\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords' === '\SplFileObject') {
  7108.                         $content $responseBody//stream goes to serializer
  7109.                     } else {
  7110.                         $content $responseBody->getContents();
  7111.                     }
  7112.                     return [
  7113.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords', []),
  7114.                         $response->getStatusCode(),
  7115.                         $response->getHeaders()
  7116.                     ];
  7117.                 case 400:
  7118.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  7119.                         $content $responseBody//stream goes to serializer
  7120.                     } else {
  7121.                         $content $responseBody->getContents();
  7122.                     }
  7123.                     return [
  7124.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  7125.                         $response->getStatusCode(),
  7126.                         $response->getHeaders()
  7127.                     ];
  7128.             }
  7129.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  7130.             $responseBody $response->getBody();
  7131.             if ($returnType === '\SplFileObject') {
  7132.                 $content $responseBody//stream goes to serializer
  7133.             } else {
  7134.                 $content $responseBody->getContents();
  7135.             }
  7136.             return [
  7137.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  7138.                 $response->getStatusCode(),
  7139.                 $response->getHeaders()
  7140.             ];
  7141.         } catch (ApiException $e) {
  7142.             switch ($e->getCode()) {
  7143.                 case 200:
  7144.                     $data AccountingObjectSerializer::deserialize(
  7145.                         $e->getResponseBody(),
  7146.                         '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords',
  7147.                         $e->getResponseHeaders()
  7148.                     );
  7149.                     $e->setResponseObject($data);
  7150.                     break;
  7151.                 case 400:
  7152.                     $data AccountingObjectSerializer::deserialize(
  7153.                         $e->getResponseBody(),
  7154.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  7155.                         $e->getResponseHeaders()
  7156.                     );
  7157.                     $e->setResponseObject($data);
  7158.                     break;
  7159.             }
  7160.             throw $e;
  7161.         }
  7162.     }
  7163.     /**
  7164.      * Operation createInvoiceHistoryAsync
  7165.      * Creates a history record for a specific invoice
  7166.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  7167.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  7168.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  7169.      * @throws \InvalidArgumentException
  7170.      * @return \GuzzleHttp\Promise\PromiseInterface
  7171.      */
  7172.     public function createInvoiceHistoryAsync($xero_tenant_id$invoice_id$history_records)
  7173.     {
  7174.         return $this->createInvoiceHistoryAsyncWithHttpInfo($xero_tenant_id$invoice_id$history_records)
  7175.             ->then(
  7176.                 function ($response) {
  7177.                     return $response[0];
  7178.                 }
  7179.             );
  7180.     }
  7181.     /**
  7182.      * Operation createInvoiceHistoryAsyncWithHttpInfo
  7183.      * Creates a history record for a specific invoice
  7184.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  7185.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  7186.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  7187.      * @throws \InvalidArgumentException
  7188.      * @return \GuzzleHttp\Promise\PromiseInterface */
  7189.     public function createInvoiceHistoryAsyncWithHttpInfo($xero_tenant_id$invoice_id$history_records)
  7190.     {
  7191.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  7192.         $request $this->createInvoiceHistoryRequest($xero_tenant_id$invoice_id$history_records);
  7193.         return $this->client
  7194.             ->sendAsync($request$this->createHttpClientOption())
  7195.             ->then(
  7196.                 function ($response) use ($returnType) {
  7197.                     $responseBody $response->getBody();
  7198.                     if ($returnType === '\SplFileObject') {
  7199.                         $content $responseBody//stream goes to serializer
  7200.                     } else {
  7201.                         $content $responseBody->getContents();
  7202.                     }
  7203.                     return [
  7204.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  7205.                         $response->getStatusCode(),
  7206.                         $response->getHeaders()
  7207.                     ];
  7208.                 },
  7209.                 function ($exception) {
  7210.                     $response $exception->getResponse();
  7211.                     $statusCode $response->getStatusCode();
  7212.                     throw new ApiException(
  7213.                         sprintf(
  7214.                             '[%d] Error connecting to the API (%s)',
  7215.                             $statusCode,
  7216.                             $exception->getRequest()->getUri()
  7217.                         ),
  7218.                         $statusCode,
  7219.                         $response->getHeaders(),
  7220.                         $response->getBody()
  7221.                     );
  7222.                 }
  7223.             );
  7224.     }
  7225.     /**
  7226.      * Create request for operation 'createInvoiceHistory'
  7227.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  7228.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  7229.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  7230.      * @throws \InvalidArgumentException
  7231.      * @return \GuzzleHttp\Psr7\Request  */
  7232.     protected function createInvoiceHistoryRequest($xero_tenant_id$invoice_id$history_records)
  7233.     {
  7234.         // verify the required parameter 'xero_tenant_id' is set
  7235.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  7236.             throw new \InvalidArgumentException(
  7237.                 'Missing the required parameter $xero_tenant_id when calling createInvoiceHistory'
  7238.             );
  7239.         }
  7240.         // verify the required parameter 'invoice_id' is set
  7241.         if ($invoice_id === null || (is_array($invoice_id) && count($invoice_id) === 0)) {
  7242.             throw new \InvalidArgumentException(
  7243.                 'Missing the required parameter $invoice_id when calling createInvoiceHistory'
  7244.             );
  7245.         }
  7246.         // verify the required parameter 'history_records' is set
  7247.         if ($history_records === null || (is_array($history_records) && count($history_records) === 0)) {
  7248.             throw new \InvalidArgumentException(
  7249.                 'Missing the required parameter $history_records when calling createInvoiceHistory'
  7250.             );
  7251.         }
  7252.         $resourcePath '/Invoices/{InvoiceID}/History';
  7253.         $formParams = [];
  7254.         $queryParams = [];
  7255.         $headerParams = [];
  7256.         $httpBody '';
  7257.         $multipart false;
  7258.         // header params
  7259.         if ($xero_tenant_id !== null) {
  7260.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  7261.         }
  7262.         // path params
  7263.         if ($invoice_id !== null) {
  7264.             $resourcePath str_replace(
  7265.                 '{' 'InvoiceID' '}',
  7266.                 AccountingObjectSerializer::toPathValue($invoice_id),
  7267.                 $resourcePath
  7268.             );
  7269.         }
  7270.         // body params
  7271.         $_tempBody null;
  7272.         if (isset($history_records)) {
  7273.             $_tempBody $history_records;
  7274.         }
  7275.         if ($multipart) {
  7276.             $headers $this->headerSelector->selectHeadersForMultipart(
  7277.                 ['application/json']
  7278.             );
  7279.         } else {
  7280.             $headers $this->headerSelector->selectHeaders(
  7281.                 ['application/json'],
  7282.                 ['application/json']
  7283.             );
  7284.         }
  7285.         // for model (json/xml)
  7286.         if (isset($_tempBody)) {
  7287.             // $_tempBody is the method argument, if present
  7288.             if ($headers['Content-Type'] === 'application/json') {
  7289.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  7290.             } else {
  7291.                 $httpBody $_tempBody;
  7292.             }
  7293.         } elseif (count($formParams) > 0) {
  7294.             if ($multipart) {
  7295.                 $multipartContents = [
  7296.                     [
  7297.                         'Content-type' => 'multipart/form-data',
  7298.                     ]
  7299.                 ];
  7300.                 
  7301.                 // for HTTP post (form)
  7302.                 $httpBody = new MultipartStream($multipartContents);
  7303.             } elseif ($headers['Content-Type'] === 'application/json') {
  7304.                 $httpBody \GuzzleHttp\json_encode($formParams);
  7305.             } else {
  7306.                 // for HTTP post (form)
  7307.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  7308.             }
  7309.         }
  7310.         // this endpoint requires OAuth (access token)
  7311.         if ($this->config->getAccessToken() !== null) {
  7312.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  7313.         }
  7314.         $defaultHeaders = [];
  7315.         if ($this->config->getUserAgent()) {
  7316.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  7317.         }
  7318.         $headers array_merge(
  7319.             $defaultHeaders,
  7320.             $headerParams,
  7321.             $headers
  7322.         );
  7323.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  7324.         return new Request(
  7325.             'PUT',
  7326.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  7327.             $headers,
  7328.             $httpBody
  7329.         );
  7330.     }
  7331.     /**
  7332.      * Operation createInvoices
  7333.      * Creates one or more sales invoices or purchase bills
  7334.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  7335.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Invoices $invoices Invoices with an array of invoice objects in body of request (required)
  7336.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  7337.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  7338.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  7339.      * @throws \InvalidArgumentException
  7340.      * @return \XeroAPI\XeroPHP\Models\Accounting\Invoices|\XeroAPI\XeroPHP\Models\Accounting\Error
  7341.      */
  7342.     public function createInvoices($xero_tenant_id$invoices$summarize_errors false$unitdp null)
  7343.     {
  7344.         list($response) = $this->createInvoicesWithHttpInfo($xero_tenant_id$invoices$summarize_errors$unitdp);
  7345.         return $response;
  7346.     }
  7347.     /**
  7348.      * Operation createInvoicesWithHttpInfo
  7349.      * Creates one or more sales invoices or purchase bills
  7350.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  7351.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Invoices $invoices Invoices with an array of invoice objects in body of request (required)
  7352.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  7353.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  7354.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  7355.      * @throws \InvalidArgumentException
  7356.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Invoices|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  7357.      */
  7358.     public function createInvoicesWithHttpInfo($xero_tenant_id$invoices$summarize_errors false$unitdp null)
  7359.     {
  7360.         $request $this->createInvoicesRequest($xero_tenant_id$invoices$summarize_errors$unitdp);
  7361.         try {
  7362.             $options $this->createHttpClientOption();
  7363.             try {
  7364.                 $response $this->client->send($request$options);
  7365.             } catch (RequestException $e) {
  7366.                 throw new ApiException(
  7367.                     "[{$e->getCode()}{$e->getMessage()}",
  7368.                     $e->getCode(),
  7369.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  7370.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  7371.                 );
  7372.             }
  7373.             $statusCode $response->getStatusCode();
  7374.             if ($statusCode 200 || $statusCode 299) {
  7375.                 throw new ApiException(
  7376.                     sprintf(
  7377.                         '[%d] Error connecting to the API (%s)',
  7378.                         $statusCode,
  7379.                         $request->getUri()
  7380.                     ),
  7381.                     $statusCode,
  7382.                     $response->getHeaders(),
  7383.                     $response->getBody()
  7384.                 );
  7385.             }
  7386.             $responseBody $response->getBody();
  7387.             switch($statusCode) {
  7388.                 case 200:
  7389.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Invoices' === '\SplFileObject') {
  7390.                         $content $responseBody//stream goes to serializer
  7391.                     } else {
  7392.                         $content $responseBody->getContents();
  7393.                     }
  7394.                     return [
  7395.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Invoices', []),
  7396.                         $response->getStatusCode(),
  7397.                         $response->getHeaders()
  7398.                     ];
  7399.                 case 400:
  7400.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  7401.                         $content $responseBody//stream goes to serializer
  7402.                     } else {
  7403.                         $content $responseBody->getContents();
  7404.                     }
  7405.                     return [
  7406.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  7407.                         $response->getStatusCode(),
  7408.                         $response->getHeaders()
  7409.                     ];
  7410.             }
  7411.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Invoices';
  7412.             $responseBody $response->getBody();
  7413.             if ($returnType === '\SplFileObject') {
  7414.                 $content $responseBody//stream goes to serializer
  7415.             } else {
  7416.                 $content $responseBody->getContents();
  7417.             }
  7418.             return [
  7419.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  7420.                 $response->getStatusCode(),
  7421.                 $response->getHeaders()
  7422.             ];
  7423.         } catch (ApiException $e) {
  7424.             switch ($e->getCode()) {
  7425.                 case 200:
  7426.                     $data AccountingObjectSerializer::deserialize(
  7427.                         $e->getResponseBody(),
  7428.                         '\XeroAPI\XeroPHP\Models\Accounting\Invoices',
  7429.                         $e->getResponseHeaders()
  7430.                     );
  7431.                     $e->setResponseObject($data);
  7432.                     break;
  7433.                 case 400:
  7434.                     $data AccountingObjectSerializer::deserialize(
  7435.                         $e->getResponseBody(),
  7436.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  7437.                         $e->getResponseHeaders()
  7438.                     );
  7439.                     $e->setResponseObject($data);
  7440.                     break;
  7441.             }
  7442.             throw $e;
  7443.         }
  7444.     }
  7445.     /**
  7446.      * Operation createInvoicesAsync
  7447.      * Creates one or more sales invoices or purchase bills
  7448.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  7449.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Invoices $invoices Invoices with an array of invoice objects in body of request (required)
  7450.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  7451.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  7452.      * @throws \InvalidArgumentException
  7453.      * @return \GuzzleHttp\Promise\PromiseInterface
  7454.      */
  7455.     public function createInvoicesAsync($xero_tenant_id$invoices$summarize_errors false$unitdp null)
  7456.     {
  7457.         return $this->createInvoicesAsyncWithHttpInfo($xero_tenant_id$invoices$summarize_errors$unitdp)
  7458.             ->then(
  7459.                 function ($response) {
  7460.                     return $response[0];
  7461.                 }
  7462.             );
  7463.     }
  7464.     /**
  7465.      * Operation createInvoicesAsyncWithHttpInfo
  7466.      * Creates one or more sales invoices or purchase bills
  7467.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  7468.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Invoices $invoices Invoices with an array of invoice objects in body of request (required)
  7469.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  7470.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  7471.      * @throws \InvalidArgumentException
  7472.      * @return \GuzzleHttp\Promise\PromiseInterface */
  7473.     public function createInvoicesAsyncWithHttpInfo($xero_tenant_id$invoices$summarize_errors false$unitdp null)
  7474.     {
  7475.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Invoices';
  7476.         $request $this->createInvoicesRequest($xero_tenant_id$invoices$summarize_errors$unitdp);
  7477.         return $this->client
  7478.             ->sendAsync($request$this->createHttpClientOption())
  7479.             ->then(
  7480.                 function ($response) use ($returnType) {
  7481.                     $responseBody $response->getBody();
  7482.                     if ($returnType === '\SplFileObject') {
  7483.                         $content $responseBody//stream goes to serializer
  7484.                     } else {
  7485.                         $content $responseBody->getContents();
  7486.                     }
  7487.                     return [
  7488.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  7489.                         $response->getStatusCode(),
  7490.                         $response->getHeaders()
  7491.                     ];
  7492.                 },
  7493.                 function ($exception) {
  7494.                     $response $exception->getResponse();
  7495.                     $statusCode $response->getStatusCode();
  7496.                     throw new ApiException(
  7497.                         sprintf(
  7498.                             '[%d] Error connecting to the API (%s)',
  7499.                             $statusCode,
  7500.                             $exception->getRequest()->getUri()
  7501.                         ),
  7502.                         $statusCode,
  7503.                         $response->getHeaders(),
  7504.                         $response->getBody()
  7505.                     );
  7506.                 }
  7507.             );
  7508.     }
  7509.     /**
  7510.      * Create request for operation 'createInvoices'
  7511.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  7512.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Invoices $invoices Invoices with an array of invoice objects in body of request (required)
  7513.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  7514.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  7515.      * @throws \InvalidArgumentException
  7516.      * @return \GuzzleHttp\Psr7\Request  */
  7517.     protected function createInvoicesRequest($xero_tenant_id$invoices$summarize_errors false$unitdp null)
  7518.     {
  7519.         // verify the required parameter 'xero_tenant_id' is set
  7520.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  7521.             throw new \InvalidArgumentException(
  7522.                 'Missing the required parameter $xero_tenant_id when calling createInvoices'
  7523.             );
  7524.         }
  7525.         // verify the required parameter 'invoices' is set
  7526.         if ($invoices === null || (is_array($invoices) && count($invoices) === 0)) {
  7527.             throw new \InvalidArgumentException(
  7528.                 'Missing the required parameter $invoices when calling createInvoices'
  7529.             );
  7530.         }
  7531.         $resourcePath '/Invoices';
  7532.         $formParams = [];
  7533.         $queryParams = [];
  7534.         $headerParams = [];
  7535.         $httpBody '';
  7536.         $multipart false;
  7537.         // query params
  7538.         if ($summarize_errors !== null) {
  7539.             $queryParams['summarizeErrors'] = $summarize_errors 'true' 'false';
  7540.         }
  7541.         // query params
  7542.         if ($unitdp !== null) {
  7543.             $queryParams['unitdp'] = AccountingObjectSerializer::toQueryValue($unitdp);
  7544.         }
  7545.         // header params
  7546.         if ($xero_tenant_id !== null) {
  7547.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  7548.         }
  7549.         // body params
  7550.         $_tempBody null;
  7551.         if (isset($invoices)) {
  7552.             $_tempBody $invoices;
  7553.         }
  7554.         if ($multipart) {
  7555.             $headers $this->headerSelector->selectHeadersForMultipart(
  7556.                 ['application/json']
  7557.             );
  7558.         } else {
  7559.             $headers $this->headerSelector->selectHeaders(
  7560.                 ['application/json'],
  7561.                 ['application/json']
  7562.             );
  7563.         }
  7564.         // for model (json/xml)
  7565.         if (isset($_tempBody)) {
  7566.             // $_tempBody is the method argument, if present
  7567.             if ($headers['Content-Type'] === 'application/json') {
  7568.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  7569.             } else {
  7570.                 $httpBody $_tempBody;
  7571.             }
  7572.         } elseif (count($formParams) > 0) {
  7573.             if ($multipart) {
  7574.                 $multipartContents = [
  7575.                     [
  7576.                         'Content-type' => 'multipart/form-data',
  7577.                     ]
  7578.                 ];
  7579.                 
  7580.                 // for HTTP post (form)
  7581.                 $httpBody = new MultipartStream($multipartContents);
  7582.             } elseif ($headers['Content-Type'] === 'application/json') {
  7583.                 $httpBody \GuzzleHttp\json_encode($formParams);
  7584.             } else {
  7585.                 // for HTTP post (form)
  7586.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  7587.             }
  7588.         }
  7589.         // this endpoint requires OAuth (access token)
  7590.         if ($this->config->getAccessToken() !== null) {
  7591.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  7592.         }
  7593.         $defaultHeaders = [];
  7594.         if ($this->config->getUserAgent()) {
  7595.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  7596.         }
  7597.         $headers array_merge(
  7598.             $defaultHeaders,
  7599.             $headerParams,
  7600.             $headers
  7601.         );
  7602.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  7603.         return new Request(
  7604.             'PUT',
  7605.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  7606.             $headers,
  7607.             $httpBody
  7608.         );
  7609.     }
  7610.     /**
  7611.      * Operation createItemHistory
  7612.      * Creates a history record for a specific item
  7613.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  7614.      * @param  string $item_id Unique identifier for an Item (required)
  7615.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  7616.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  7617.      * @throws \InvalidArgumentException
  7618.      * @return \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords
  7619.      */
  7620.     public function createItemHistory($xero_tenant_id$item_id$history_records)
  7621.     {
  7622.         list($response) = $this->createItemHistoryWithHttpInfo($xero_tenant_id$item_id$history_records);
  7623.         return $response;
  7624.     }
  7625.     /**
  7626.      * Operation createItemHistoryWithHttpInfo
  7627.      * Creates a history record for a specific item
  7628.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  7629.      * @param  string $item_id Unique identifier for an Item (required)
  7630.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  7631.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  7632.      * @throws \InvalidArgumentException
  7633.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords, HTTP status code, HTTP response headers (array of strings)
  7634.      */
  7635.     public function createItemHistoryWithHttpInfo($xero_tenant_id$item_id$history_records)
  7636.     {
  7637.         $request $this->createItemHistoryRequest($xero_tenant_id$item_id$history_records);
  7638.         try {
  7639.             $options $this->createHttpClientOption();
  7640.             try {
  7641.                 $response $this->client->send($request$options);
  7642.             } catch (RequestException $e) {
  7643.                 throw new ApiException(
  7644.                     "[{$e->getCode()}{$e->getMessage()}",
  7645.                     $e->getCode(),
  7646.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  7647.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  7648.                 );
  7649.             }
  7650.             $statusCode $response->getStatusCode();
  7651.             if ($statusCode 200 || $statusCode 299) {
  7652.                 throw new ApiException(
  7653.                     sprintf(
  7654.                         '[%d] Error connecting to the API (%s)',
  7655.                         $statusCode,
  7656.                         $request->getUri()
  7657.                     ),
  7658.                     $statusCode,
  7659.                     $response->getHeaders(),
  7660.                     $response->getBody()
  7661.                 );
  7662.             }
  7663.             $responseBody $response->getBody();
  7664.             switch($statusCode) {
  7665.                 case 200:
  7666.                     if ('\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords' === '\SplFileObject') {
  7667.                         $content $responseBody//stream goes to serializer
  7668.                     } else {
  7669.                         $content $responseBody->getContents();
  7670.                     }
  7671.                     return [
  7672.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords', []),
  7673.                         $response->getStatusCode(),
  7674.                         $response->getHeaders()
  7675.                     ];
  7676.             }
  7677.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  7678.             $responseBody $response->getBody();
  7679.             if ($returnType === '\SplFileObject') {
  7680.                 $content $responseBody//stream goes to serializer
  7681.             } else {
  7682.                 $content $responseBody->getContents();
  7683.             }
  7684.             return [
  7685.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  7686.                 $response->getStatusCode(),
  7687.                 $response->getHeaders()
  7688.             ];
  7689.         } catch (ApiException $e) {
  7690.             switch ($e->getCode()) {
  7691.                 case 200:
  7692.                     $data AccountingObjectSerializer::deserialize(
  7693.                         $e->getResponseBody(),
  7694.                         '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords',
  7695.                         $e->getResponseHeaders()
  7696.                     );
  7697.                     $e->setResponseObject($data);
  7698.                     break;
  7699.             }
  7700.             throw $e;
  7701.         }
  7702.     }
  7703.     /**
  7704.      * Operation createItemHistoryAsync
  7705.      * Creates a history record for a specific item
  7706.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  7707.      * @param  string $item_id Unique identifier for an Item (required)
  7708.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  7709.      * @throws \InvalidArgumentException
  7710.      * @return \GuzzleHttp\Promise\PromiseInterface
  7711.      */
  7712.     public function createItemHistoryAsync($xero_tenant_id$item_id$history_records)
  7713.     {
  7714.         return $this->createItemHistoryAsyncWithHttpInfo($xero_tenant_id$item_id$history_records)
  7715.             ->then(
  7716.                 function ($response) {
  7717.                     return $response[0];
  7718.                 }
  7719.             );
  7720.     }
  7721.     /**
  7722.      * Operation createItemHistoryAsyncWithHttpInfo
  7723.      * Creates a history record for a specific item
  7724.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  7725.      * @param  string $item_id Unique identifier for an Item (required)
  7726.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  7727.      * @throws \InvalidArgumentException
  7728.      * @return \GuzzleHttp\Promise\PromiseInterface */
  7729.     public function createItemHistoryAsyncWithHttpInfo($xero_tenant_id$item_id$history_records)
  7730.     {
  7731.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  7732.         $request $this->createItemHistoryRequest($xero_tenant_id$item_id$history_records);
  7733.         return $this->client
  7734.             ->sendAsync($request$this->createHttpClientOption())
  7735.             ->then(
  7736.                 function ($response) use ($returnType) {
  7737.                     $responseBody $response->getBody();
  7738.                     if ($returnType === '\SplFileObject') {
  7739.                         $content $responseBody//stream goes to serializer
  7740.                     } else {
  7741.                         $content $responseBody->getContents();
  7742.                     }
  7743.                     return [
  7744.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  7745.                         $response->getStatusCode(),
  7746.                         $response->getHeaders()
  7747.                     ];
  7748.                 },
  7749.                 function ($exception) {
  7750.                     $response $exception->getResponse();
  7751.                     $statusCode $response->getStatusCode();
  7752.                     throw new ApiException(
  7753.                         sprintf(
  7754.                             '[%d] Error connecting to the API (%s)',
  7755.                             $statusCode,
  7756.                             $exception->getRequest()->getUri()
  7757.                         ),
  7758.                         $statusCode,
  7759.                         $response->getHeaders(),
  7760.                         $response->getBody()
  7761.                     );
  7762.                 }
  7763.             );
  7764.     }
  7765.     /**
  7766.      * Create request for operation 'createItemHistory'
  7767.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  7768.      * @param  string $item_id Unique identifier for an Item (required)
  7769.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  7770.      * @throws \InvalidArgumentException
  7771.      * @return \GuzzleHttp\Psr7\Request  */
  7772.     protected function createItemHistoryRequest($xero_tenant_id$item_id$history_records)
  7773.     {
  7774.         // verify the required parameter 'xero_tenant_id' is set
  7775.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  7776.             throw new \InvalidArgumentException(
  7777.                 'Missing the required parameter $xero_tenant_id when calling createItemHistory'
  7778.             );
  7779.         }
  7780.         // verify the required parameter 'item_id' is set
  7781.         if ($item_id === null || (is_array($item_id) && count($item_id) === 0)) {
  7782.             throw new \InvalidArgumentException(
  7783.                 'Missing the required parameter $item_id when calling createItemHistory'
  7784.             );
  7785.         }
  7786.         // verify the required parameter 'history_records' is set
  7787.         if ($history_records === null || (is_array($history_records) && count($history_records) === 0)) {
  7788.             throw new \InvalidArgumentException(
  7789.                 'Missing the required parameter $history_records when calling createItemHistory'
  7790.             );
  7791.         }
  7792.         $resourcePath '/Items/{ItemID}/History';
  7793.         $formParams = [];
  7794.         $queryParams = [];
  7795.         $headerParams = [];
  7796.         $httpBody '';
  7797.         $multipart false;
  7798.         // header params
  7799.         if ($xero_tenant_id !== null) {
  7800.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  7801.         }
  7802.         // path params
  7803.         if ($item_id !== null) {
  7804.             $resourcePath str_replace(
  7805.                 '{' 'ItemID' '}',
  7806.                 AccountingObjectSerializer::toPathValue($item_id),
  7807.                 $resourcePath
  7808.             );
  7809.         }
  7810.         // body params
  7811.         $_tempBody null;
  7812.         if (isset($history_records)) {
  7813.             $_tempBody $history_records;
  7814.         }
  7815.         if ($multipart) {
  7816.             $headers $this->headerSelector->selectHeadersForMultipart(
  7817.                 ['application/json']
  7818.             );
  7819.         } else {
  7820.             $headers $this->headerSelector->selectHeaders(
  7821.                 ['application/json'],
  7822.                 ['application/json']
  7823.             );
  7824.         }
  7825.         // for model (json/xml)
  7826.         if (isset($_tempBody)) {
  7827.             // $_tempBody is the method argument, if present
  7828.             if ($headers['Content-Type'] === 'application/json') {
  7829.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  7830.             } else {
  7831.                 $httpBody $_tempBody;
  7832.             }
  7833.         } elseif (count($formParams) > 0) {
  7834.             if ($multipart) {
  7835.                 $multipartContents = [
  7836.                     [
  7837.                         'Content-type' => 'multipart/form-data',
  7838.                     ]
  7839.                 ];
  7840.                 
  7841.                 // for HTTP post (form)
  7842.                 $httpBody = new MultipartStream($multipartContents);
  7843.             } elseif ($headers['Content-Type'] === 'application/json') {
  7844.                 $httpBody \GuzzleHttp\json_encode($formParams);
  7845.             } else {
  7846.                 // for HTTP post (form)
  7847.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  7848.             }
  7849.         }
  7850.         // this endpoint requires OAuth (access token)
  7851.         if ($this->config->getAccessToken() !== null) {
  7852.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  7853.         }
  7854.         $defaultHeaders = [];
  7855.         if ($this->config->getUserAgent()) {
  7856.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  7857.         }
  7858.         $headers array_merge(
  7859.             $defaultHeaders,
  7860.             $headerParams,
  7861.             $headers
  7862.         );
  7863.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  7864.         return new Request(
  7865.             'PUT',
  7866.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  7867.             $headers,
  7868.             $httpBody
  7869.         );
  7870.     }
  7871.     /**
  7872.      * Operation createItems
  7873.      * Creates one or more items
  7874.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  7875.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Items $items Items with an array of Item objects in body of request (required)
  7876.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  7877.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  7878.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  7879.      * @throws \InvalidArgumentException
  7880.      * @return \XeroAPI\XeroPHP\Models\Accounting\Items|\XeroAPI\XeroPHP\Models\Accounting\Error
  7881.      */
  7882.     public function createItems($xero_tenant_id$items$summarize_errors false$unitdp null)
  7883.     {
  7884.         list($response) = $this->createItemsWithHttpInfo($xero_tenant_id$items$summarize_errors$unitdp);
  7885.         return $response;
  7886.     }
  7887.     /**
  7888.      * Operation createItemsWithHttpInfo
  7889.      * Creates one or more items
  7890.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  7891.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Items $items Items with an array of Item objects in body of request (required)
  7892.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  7893.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  7894.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  7895.      * @throws \InvalidArgumentException
  7896.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Items|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  7897.      */
  7898.     public function createItemsWithHttpInfo($xero_tenant_id$items$summarize_errors false$unitdp null)
  7899.     {
  7900.         $request $this->createItemsRequest($xero_tenant_id$items$summarize_errors$unitdp);
  7901.         try {
  7902.             $options $this->createHttpClientOption();
  7903.             try {
  7904.                 $response $this->client->send($request$options);
  7905.             } catch (RequestException $e) {
  7906.                 throw new ApiException(
  7907.                     "[{$e->getCode()}{$e->getMessage()}",
  7908.                     $e->getCode(),
  7909.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  7910.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  7911.                 );
  7912.             }
  7913.             $statusCode $response->getStatusCode();
  7914.             if ($statusCode 200 || $statusCode 299) {
  7915.                 throw new ApiException(
  7916.                     sprintf(
  7917.                         '[%d] Error connecting to the API (%s)',
  7918.                         $statusCode,
  7919.                         $request->getUri()
  7920.                     ),
  7921.                     $statusCode,
  7922.                     $response->getHeaders(),
  7923.                     $response->getBody()
  7924.                 );
  7925.             }
  7926.             $responseBody $response->getBody();
  7927.             switch($statusCode) {
  7928.                 case 200:
  7929.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Items' === '\SplFileObject') {
  7930.                         $content $responseBody//stream goes to serializer
  7931.                     } else {
  7932.                         $content $responseBody->getContents();
  7933.                     }
  7934.                     return [
  7935.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Items', []),
  7936.                         $response->getStatusCode(),
  7937.                         $response->getHeaders()
  7938.                     ];
  7939.                 case 400:
  7940.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  7941.                         $content $responseBody//stream goes to serializer
  7942.                     } else {
  7943.                         $content $responseBody->getContents();
  7944.                     }
  7945.                     return [
  7946.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  7947.                         $response->getStatusCode(),
  7948.                         $response->getHeaders()
  7949.                     ];
  7950.             }
  7951.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Items';
  7952.             $responseBody $response->getBody();
  7953.             if ($returnType === '\SplFileObject') {
  7954.                 $content $responseBody//stream goes to serializer
  7955.             } else {
  7956.                 $content $responseBody->getContents();
  7957.             }
  7958.             return [
  7959.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  7960.                 $response->getStatusCode(),
  7961.                 $response->getHeaders()
  7962.             ];
  7963.         } catch (ApiException $e) {
  7964.             switch ($e->getCode()) {
  7965.                 case 200:
  7966.                     $data AccountingObjectSerializer::deserialize(
  7967.                         $e->getResponseBody(),
  7968.                         '\XeroAPI\XeroPHP\Models\Accounting\Items',
  7969.                         $e->getResponseHeaders()
  7970.                     );
  7971.                     $e->setResponseObject($data);
  7972.                     break;
  7973.                 case 400:
  7974.                     $data AccountingObjectSerializer::deserialize(
  7975.                         $e->getResponseBody(),
  7976.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  7977.                         $e->getResponseHeaders()
  7978.                     );
  7979.                     $e->setResponseObject($data);
  7980.                     break;
  7981.             }
  7982.             throw $e;
  7983.         }
  7984.     }
  7985.     /**
  7986.      * Operation createItemsAsync
  7987.      * Creates one or more items
  7988.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  7989.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Items $items Items with an array of Item objects in body of request (required)
  7990.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  7991.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  7992.      * @throws \InvalidArgumentException
  7993.      * @return \GuzzleHttp\Promise\PromiseInterface
  7994.      */
  7995.     public function createItemsAsync($xero_tenant_id$items$summarize_errors false$unitdp null)
  7996.     {
  7997.         return $this->createItemsAsyncWithHttpInfo($xero_tenant_id$items$summarize_errors$unitdp)
  7998.             ->then(
  7999.                 function ($response) {
  8000.                     return $response[0];
  8001.                 }
  8002.             );
  8003.     }
  8004.     /**
  8005.      * Operation createItemsAsyncWithHttpInfo
  8006.      * Creates one or more items
  8007.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  8008.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Items $items Items with an array of Item objects in body of request (required)
  8009.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  8010.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  8011.      * @throws \InvalidArgumentException
  8012.      * @return \GuzzleHttp\Promise\PromiseInterface */
  8013.     public function createItemsAsyncWithHttpInfo($xero_tenant_id$items$summarize_errors false$unitdp null)
  8014.     {
  8015.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Items';
  8016.         $request $this->createItemsRequest($xero_tenant_id$items$summarize_errors$unitdp);
  8017.         return $this->client
  8018.             ->sendAsync($request$this->createHttpClientOption())
  8019.             ->then(
  8020.                 function ($response) use ($returnType) {
  8021.                     $responseBody $response->getBody();
  8022.                     if ($returnType === '\SplFileObject') {
  8023.                         $content $responseBody//stream goes to serializer
  8024.                     } else {
  8025.                         $content $responseBody->getContents();
  8026.                     }
  8027.                     return [
  8028.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  8029.                         $response->getStatusCode(),
  8030.                         $response->getHeaders()
  8031.                     ];
  8032.                 },
  8033.                 function ($exception) {
  8034.                     $response $exception->getResponse();
  8035.                     $statusCode $response->getStatusCode();
  8036.                     throw new ApiException(
  8037.                         sprintf(
  8038.                             '[%d] Error connecting to the API (%s)',
  8039.                             $statusCode,
  8040.                             $exception->getRequest()->getUri()
  8041.                         ),
  8042.                         $statusCode,
  8043.                         $response->getHeaders(),
  8044.                         $response->getBody()
  8045.                     );
  8046.                 }
  8047.             );
  8048.     }
  8049.     /**
  8050.      * Create request for operation 'createItems'
  8051.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  8052.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Items $items Items with an array of Item objects in body of request (required)
  8053.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  8054.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  8055.      * @throws \InvalidArgumentException
  8056.      * @return \GuzzleHttp\Psr7\Request  */
  8057.     protected function createItemsRequest($xero_tenant_id$items$summarize_errors false$unitdp null)
  8058.     {
  8059.         // verify the required parameter 'xero_tenant_id' is set
  8060.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  8061.             throw new \InvalidArgumentException(
  8062.                 'Missing the required parameter $xero_tenant_id when calling createItems'
  8063.             );
  8064.         }
  8065.         // verify the required parameter 'items' is set
  8066.         if ($items === null || (is_array($items) && count($items) === 0)) {
  8067.             throw new \InvalidArgumentException(
  8068.                 'Missing the required parameter $items when calling createItems'
  8069.             );
  8070.         }
  8071.         $resourcePath '/Items';
  8072.         $formParams = [];
  8073.         $queryParams = [];
  8074.         $headerParams = [];
  8075.         $httpBody '';
  8076.         $multipart false;
  8077.         // query params
  8078.         if ($summarize_errors !== null) {
  8079.             $queryParams['summarizeErrors'] = $summarize_errors 'true' 'false';
  8080.         }
  8081.         // query params
  8082.         if ($unitdp !== null) {
  8083.             $queryParams['unitdp'] = AccountingObjectSerializer::toQueryValue($unitdp);
  8084.         }
  8085.         // header params
  8086.         if ($xero_tenant_id !== null) {
  8087.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  8088.         }
  8089.         // body params
  8090.         $_tempBody null;
  8091.         if (isset($items)) {
  8092.             $_tempBody $items;
  8093.         }
  8094.         if ($multipart) {
  8095.             $headers $this->headerSelector->selectHeadersForMultipart(
  8096.                 ['application/json']
  8097.             );
  8098.         } else {
  8099.             $headers $this->headerSelector->selectHeaders(
  8100.                 ['application/json'],
  8101.                 ['application/json']
  8102.             );
  8103.         }
  8104.         // for model (json/xml)
  8105.         if (isset($_tempBody)) {
  8106.             // $_tempBody is the method argument, if present
  8107.             if ($headers['Content-Type'] === 'application/json') {
  8108.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  8109.             } else {
  8110.                 $httpBody $_tempBody;
  8111.             }
  8112.         } elseif (count($formParams) > 0) {
  8113.             if ($multipart) {
  8114.                 $multipartContents = [
  8115.                     [
  8116.                         'Content-type' => 'multipart/form-data',
  8117.                     ]
  8118.                 ];
  8119.                 
  8120.                 // for HTTP post (form)
  8121.                 $httpBody = new MultipartStream($multipartContents);
  8122.             } elseif ($headers['Content-Type'] === 'application/json') {
  8123.                 $httpBody \GuzzleHttp\json_encode($formParams);
  8124.             } else {
  8125.                 // for HTTP post (form)
  8126.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  8127.             }
  8128.         }
  8129.         // this endpoint requires OAuth (access token)
  8130.         if ($this->config->getAccessToken() !== null) {
  8131.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  8132.         }
  8133.         $defaultHeaders = [];
  8134.         if ($this->config->getUserAgent()) {
  8135.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  8136.         }
  8137.         $headers array_merge(
  8138.             $defaultHeaders,
  8139.             $headerParams,
  8140.             $headers
  8141.         );
  8142.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  8143.         return new Request(
  8144.             'PUT',
  8145.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  8146.             $headers,
  8147.             $httpBody
  8148.         );
  8149.     }
  8150.     /**
  8151.      * Operation createLinkedTransaction
  8152.      * Creates linked transactions (billable expenses)
  8153.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  8154.      * @param  \XeroAPI\XeroPHP\Models\Accounting\LinkedTransaction $linked_transaction LinkedTransaction object in body of request (required)
  8155.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  8156.      * @throws \InvalidArgumentException
  8157.      * @return \XeroAPI\XeroPHP\Models\Accounting\LinkedTransactions|\XeroAPI\XeroPHP\Models\Accounting\Error
  8158.      */
  8159.     public function createLinkedTransaction($xero_tenant_id$linked_transaction)
  8160.     {
  8161.         list($response) = $this->createLinkedTransactionWithHttpInfo($xero_tenant_id$linked_transaction);
  8162.         return $response;
  8163.     }
  8164.     /**
  8165.      * Operation createLinkedTransactionWithHttpInfo
  8166.      * Creates linked transactions (billable expenses)
  8167.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  8168.      * @param  \XeroAPI\XeroPHP\Models\Accounting\LinkedTransaction $linked_transaction LinkedTransaction object in body of request (required)
  8169.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  8170.      * @throws \InvalidArgumentException
  8171.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\LinkedTransactions|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  8172.      */
  8173.     public function createLinkedTransactionWithHttpInfo($xero_tenant_id$linked_transaction)
  8174.     {
  8175.         $request $this->createLinkedTransactionRequest($xero_tenant_id$linked_transaction);
  8176.         try {
  8177.             $options $this->createHttpClientOption();
  8178.             try {
  8179.                 $response $this->client->send($request$options);
  8180.             } catch (RequestException $e) {
  8181.                 throw new ApiException(
  8182.                     "[{$e->getCode()}{$e->getMessage()}",
  8183.                     $e->getCode(),
  8184.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  8185.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  8186.                 );
  8187.             }
  8188.             $statusCode $response->getStatusCode();
  8189.             if ($statusCode 200 || $statusCode 299) {
  8190.                 throw new ApiException(
  8191.                     sprintf(
  8192.                         '[%d] Error connecting to the API (%s)',
  8193.                         $statusCode,
  8194.                         $request->getUri()
  8195.                     ),
  8196.                     $statusCode,
  8197.                     $response->getHeaders(),
  8198.                     $response->getBody()
  8199.                 );
  8200.             }
  8201.             $responseBody $response->getBody();
  8202.             switch($statusCode) {
  8203.                 case 200:
  8204.                     if ('\XeroAPI\XeroPHP\Models\Accounting\LinkedTransactions' === '\SplFileObject') {
  8205.                         $content $responseBody//stream goes to serializer
  8206.                     } else {
  8207.                         $content $responseBody->getContents();
  8208.                     }
  8209.                     return [
  8210.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\LinkedTransactions', []),
  8211.                         $response->getStatusCode(),
  8212.                         $response->getHeaders()
  8213.                     ];
  8214.                 case 400:
  8215.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  8216.                         $content $responseBody//stream goes to serializer
  8217.                     } else {
  8218.                         $content $responseBody->getContents();
  8219.                     }
  8220.                     return [
  8221.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  8222.                         $response->getStatusCode(),
  8223.                         $response->getHeaders()
  8224.                     ];
  8225.             }
  8226.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\LinkedTransactions';
  8227.             $responseBody $response->getBody();
  8228.             if ($returnType === '\SplFileObject') {
  8229.                 $content $responseBody//stream goes to serializer
  8230.             } else {
  8231.                 $content $responseBody->getContents();
  8232.             }
  8233.             return [
  8234.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  8235.                 $response->getStatusCode(),
  8236.                 $response->getHeaders()
  8237.             ];
  8238.         } catch (ApiException $e) {
  8239.             switch ($e->getCode()) {
  8240.                 case 200:
  8241.                     $data AccountingObjectSerializer::deserialize(
  8242.                         $e->getResponseBody(),
  8243.                         '\XeroAPI\XeroPHP\Models\Accounting\LinkedTransactions',
  8244.                         $e->getResponseHeaders()
  8245.                     );
  8246.                     $e->setResponseObject($data);
  8247.                     break;
  8248.                 case 400:
  8249.                     $data AccountingObjectSerializer::deserialize(
  8250.                         $e->getResponseBody(),
  8251.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  8252.                         $e->getResponseHeaders()
  8253.                     );
  8254.                     $e->setResponseObject($data);
  8255.                     break;
  8256.             }
  8257.             throw $e;
  8258.         }
  8259.     }
  8260.     /**
  8261.      * Operation createLinkedTransactionAsync
  8262.      * Creates linked transactions (billable expenses)
  8263.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  8264.      * @param  \XeroAPI\XeroPHP\Models\Accounting\LinkedTransaction $linked_transaction LinkedTransaction object in body of request (required)
  8265.      * @throws \InvalidArgumentException
  8266.      * @return \GuzzleHttp\Promise\PromiseInterface
  8267.      */
  8268.     public function createLinkedTransactionAsync($xero_tenant_id$linked_transaction)
  8269.     {
  8270.         return $this->createLinkedTransactionAsyncWithHttpInfo($xero_tenant_id$linked_transaction)
  8271.             ->then(
  8272.                 function ($response) {
  8273.                     return $response[0];
  8274.                 }
  8275.             );
  8276.     }
  8277.     /**
  8278.      * Operation createLinkedTransactionAsyncWithHttpInfo
  8279.      * Creates linked transactions (billable expenses)
  8280.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  8281.      * @param  \XeroAPI\XeroPHP\Models\Accounting\LinkedTransaction $linked_transaction LinkedTransaction object in body of request (required)
  8282.      * @throws \InvalidArgumentException
  8283.      * @return \GuzzleHttp\Promise\PromiseInterface */
  8284.     public function createLinkedTransactionAsyncWithHttpInfo($xero_tenant_id$linked_transaction)
  8285.     {
  8286.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\LinkedTransactions';
  8287.         $request $this->createLinkedTransactionRequest($xero_tenant_id$linked_transaction);
  8288.         return $this->client
  8289.             ->sendAsync($request$this->createHttpClientOption())
  8290.             ->then(
  8291.                 function ($response) use ($returnType) {
  8292.                     $responseBody $response->getBody();
  8293.                     if ($returnType === '\SplFileObject') {
  8294.                         $content $responseBody//stream goes to serializer
  8295.                     } else {
  8296.                         $content $responseBody->getContents();
  8297.                     }
  8298.                     return [
  8299.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  8300.                         $response->getStatusCode(),
  8301.                         $response->getHeaders()
  8302.                     ];
  8303.                 },
  8304.                 function ($exception) {
  8305.                     $response $exception->getResponse();
  8306.                     $statusCode $response->getStatusCode();
  8307.                     throw new ApiException(
  8308.                         sprintf(
  8309.                             '[%d] Error connecting to the API (%s)',
  8310.                             $statusCode,
  8311.                             $exception->getRequest()->getUri()
  8312.                         ),
  8313.                         $statusCode,
  8314.                         $response->getHeaders(),
  8315.                         $response->getBody()
  8316.                     );
  8317.                 }
  8318.             );
  8319.     }
  8320.     /**
  8321.      * Create request for operation 'createLinkedTransaction'
  8322.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  8323.      * @param  \XeroAPI\XeroPHP\Models\Accounting\LinkedTransaction $linked_transaction LinkedTransaction object in body of request (required)
  8324.      * @throws \InvalidArgumentException
  8325.      * @return \GuzzleHttp\Psr7\Request  */
  8326.     protected function createLinkedTransactionRequest($xero_tenant_id$linked_transaction)
  8327.     {
  8328.         // verify the required parameter 'xero_tenant_id' is set
  8329.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  8330.             throw new \InvalidArgumentException(
  8331.                 'Missing the required parameter $xero_tenant_id when calling createLinkedTransaction'
  8332.             );
  8333.         }
  8334.         // verify the required parameter 'linked_transaction' is set
  8335.         if ($linked_transaction === null || (is_array($linked_transaction) && count($linked_transaction) === 0)) {
  8336.             throw new \InvalidArgumentException(
  8337.                 'Missing the required parameter $linked_transaction when calling createLinkedTransaction'
  8338.             );
  8339.         }
  8340.         $resourcePath '/LinkedTransactions';
  8341.         $formParams = [];
  8342.         $queryParams = [];
  8343.         $headerParams = [];
  8344.         $httpBody '';
  8345.         $multipart false;
  8346.         // header params
  8347.         if ($xero_tenant_id !== null) {
  8348.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  8349.         }
  8350.         // body params
  8351.         $_tempBody null;
  8352.         if (isset($linked_transaction)) {
  8353.             $_tempBody $linked_transaction;
  8354.         }
  8355.         if ($multipart) {
  8356.             $headers $this->headerSelector->selectHeadersForMultipart(
  8357.                 ['application/json']
  8358.             );
  8359.         } else {
  8360.             $headers $this->headerSelector->selectHeaders(
  8361.                 ['application/json'],
  8362.                 ['application/json']
  8363.             );
  8364.         }
  8365.         // for model (json/xml)
  8366.         if (isset($_tempBody)) {
  8367.             // $_tempBody is the method argument, if present
  8368.             if ($headers['Content-Type'] === 'application/json') {
  8369.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  8370.             } else {
  8371.                 $httpBody $_tempBody;
  8372.             }
  8373.         } elseif (count($formParams) > 0) {
  8374.             if ($multipart) {
  8375.                 $multipartContents = [
  8376.                     [
  8377.                         'Content-type' => 'multipart/form-data',
  8378.                     ]
  8379.                 ];
  8380.                 
  8381.                 // for HTTP post (form)
  8382.                 $httpBody = new MultipartStream($multipartContents);
  8383.             } elseif ($headers['Content-Type'] === 'application/json') {
  8384.                 $httpBody \GuzzleHttp\json_encode($formParams);
  8385.             } else {
  8386.                 // for HTTP post (form)
  8387.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  8388.             }
  8389.         }
  8390.         // this endpoint requires OAuth (access token)
  8391.         if ($this->config->getAccessToken() !== null) {
  8392.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  8393.         }
  8394.         $defaultHeaders = [];
  8395.         if ($this->config->getUserAgent()) {
  8396.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  8397.         }
  8398.         $headers array_merge(
  8399.             $defaultHeaders,
  8400.             $headerParams,
  8401.             $headers
  8402.         );
  8403.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  8404.         return new Request(
  8405.             'PUT',
  8406.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  8407.             $headers,
  8408.             $httpBody
  8409.         );
  8410.     }
  8411.     /**
  8412.      * Operation createManualJournalAttachmentByFileName
  8413.      * Creates a specific attachment for a specific manual journal by file name
  8414.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  8415.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  8416.      * @param  string $file_name Name of the attachment (required)
  8417.      * @param  string $body Byte array of file in body of request (required)
  8418.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  8419.      * @throws \InvalidArgumentException
  8420.      * @return \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error
  8421.      */
  8422.     public function createManualJournalAttachmentByFileName($xero_tenant_id$manual_journal_id$file_name$body)
  8423.     {
  8424.         list($response) = $this->createManualJournalAttachmentByFileNameWithHttpInfo($xero_tenant_id$manual_journal_id$file_name$body);
  8425.         return $response;
  8426.     }
  8427.     /**
  8428.      * Operation createManualJournalAttachmentByFileNameWithHttpInfo
  8429.      * Creates a specific attachment for a specific manual journal by file name
  8430.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  8431.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  8432.      * @param  string $file_name Name of the attachment (required)
  8433.      * @param  string $body Byte array of file in body of request (required)
  8434.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  8435.      * @throws \InvalidArgumentException
  8436.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  8437.      */
  8438.     public function createManualJournalAttachmentByFileNameWithHttpInfo($xero_tenant_id$manual_journal_id$file_name$body)
  8439.     {
  8440.         $request $this->createManualJournalAttachmentByFileNameRequest($xero_tenant_id$manual_journal_id$file_name$body);
  8441.         try {
  8442.             $options $this->createHttpClientOption();
  8443.             try {
  8444.                 $response $this->client->send($request$options);
  8445.             } catch (RequestException $e) {
  8446.                 throw new ApiException(
  8447.                     "[{$e->getCode()}{$e->getMessage()}",
  8448.                     $e->getCode(),
  8449.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  8450.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  8451.                 );
  8452.             }
  8453.             $statusCode $response->getStatusCode();
  8454.             if ($statusCode 200 || $statusCode 299) {
  8455.                 throw new ApiException(
  8456.                     sprintf(
  8457.                         '[%d] Error connecting to the API (%s)',
  8458.                         $statusCode,
  8459.                         $request->getUri()
  8460.                     ),
  8461.                     $statusCode,
  8462.                     $response->getHeaders(),
  8463.                     $response->getBody()
  8464.                 );
  8465.             }
  8466.             $responseBody $response->getBody();
  8467.             switch($statusCode) {
  8468.                 case 200:
  8469.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Attachments' === '\SplFileObject') {
  8470.                         $content $responseBody//stream goes to serializer
  8471.                     } else {
  8472.                         $content $responseBody->getContents();
  8473.                     }
  8474.                     return [
  8475.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Attachments', []),
  8476.                         $response->getStatusCode(),
  8477.                         $response->getHeaders()
  8478.                     ];
  8479.                 case 400:
  8480.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  8481.                         $content $responseBody//stream goes to serializer
  8482.                     } else {
  8483.                         $content $responseBody->getContents();
  8484.                     }
  8485.                     return [
  8486.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  8487.                         $response->getStatusCode(),
  8488.                         $response->getHeaders()
  8489.                     ];
  8490.             }
  8491.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  8492.             $responseBody $response->getBody();
  8493.             if ($returnType === '\SplFileObject') {
  8494.                 $content $responseBody//stream goes to serializer
  8495.             } else {
  8496.                 $content $responseBody->getContents();
  8497.             }
  8498.             return [
  8499.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  8500.                 $response->getStatusCode(),
  8501.                 $response->getHeaders()
  8502.             ];
  8503.         } catch (ApiException $e) {
  8504.             switch ($e->getCode()) {
  8505.                 case 200:
  8506.                     $data AccountingObjectSerializer::deserialize(
  8507.                         $e->getResponseBody(),
  8508.                         '\XeroAPI\XeroPHP\Models\Accounting\Attachments',
  8509.                         $e->getResponseHeaders()
  8510.                     );
  8511.                     $e->setResponseObject($data);
  8512.                     break;
  8513.                 case 400:
  8514.                     $data AccountingObjectSerializer::deserialize(
  8515.                         $e->getResponseBody(),
  8516.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  8517.                         $e->getResponseHeaders()
  8518.                     );
  8519.                     $e->setResponseObject($data);
  8520.                     break;
  8521.             }
  8522.             throw $e;
  8523.         }
  8524.     }
  8525.     /**
  8526.      * Operation createManualJournalAttachmentByFileNameAsync
  8527.      * Creates a specific attachment for a specific manual journal by file name
  8528.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  8529.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  8530.      * @param  string $file_name Name of the attachment (required)
  8531.      * @param  string $body Byte array of file in body of request (required)
  8532.      * @throws \InvalidArgumentException
  8533.      * @return \GuzzleHttp\Promise\PromiseInterface
  8534.      */
  8535.     public function createManualJournalAttachmentByFileNameAsync($xero_tenant_id$manual_journal_id$file_name$body)
  8536.     {
  8537.         return $this->createManualJournalAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$manual_journal_id$file_name$body)
  8538.             ->then(
  8539.                 function ($response) {
  8540.                     return $response[0];
  8541.                 }
  8542.             );
  8543.     }
  8544.     /**
  8545.      * Operation createManualJournalAttachmentByFileNameAsyncWithHttpInfo
  8546.      * Creates a specific attachment for a specific manual journal by file name
  8547.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  8548.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  8549.      * @param  string $file_name Name of the attachment (required)
  8550.      * @param  string $body Byte array of file in body of request (required)
  8551.      * @throws \InvalidArgumentException
  8552.      * @return \GuzzleHttp\Promise\PromiseInterface */
  8553.     public function createManualJournalAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$manual_journal_id$file_name$body)
  8554.     {
  8555.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  8556.         $request $this->createManualJournalAttachmentByFileNameRequest($xero_tenant_id$manual_journal_id$file_name$body);
  8557.         return $this->client
  8558.             ->sendAsync($request$this->createHttpClientOption())
  8559.             ->then(
  8560.                 function ($response) use ($returnType) {
  8561.                     $responseBody $response->getBody();
  8562.                     if ($returnType === '\SplFileObject') {
  8563.                         $content $responseBody//stream goes to serializer
  8564.                     } else {
  8565.                         $content $responseBody->getContents();
  8566.                     }
  8567.                     return [
  8568.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  8569.                         $response->getStatusCode(),
  8570.                         $response->getHeaders()
  8571.                     ];
  8572.                 },
  8573.                 function ($exception) {
  8574.                     $response $exception->getResponse();
  8575.                     $statusCode $response->getStatusCode();
  8576.                     throw new ApiException(
  8577.                         sprintf(
  8578.                             '[%d] Error connecting to the API (%s)',
  8579.                             $statusCode,
  8580.                             $exception->getRequest()->getUri()
  8581.                         ),
  8582.                         $statusCode,
  8583.                         $response->getHeaders(),
  8584.                         $response->getBody()
  8585.                     );
  8586.                 }
  8587.             );
  8588.     }
  8589.     /**
  8590.      * Create request for operation 'createManualJournalAttachmentByFileName'
  8591.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  8592.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  8593.      * @param  string $file_name Name of the attachment (required)
  8594.      * @param  string $body Byte array of file in body of request (required)
  8595.      * @throws \InvalidArgumentException
  8596.      * @return \GuzzleHttp\Psr7\Request  */
  8597.     protected function createManualJournalAttachmentByFileNameRequest($xero_tenant_id$manual_journal_id$file_name$body)
  8598.     {
  8599.         // verify the required parameter 'xero_tenant_id' is set
  8600.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  8601.             throw new \InvalidArgumentException(
  8602.                 'Missing the required parameter $xero_tenant_id when calling createManualJournalAttachmentByFileName'
  8603.             );
  8604.         }
  8605.         // verify the required parameter 'manual_journal_id' is set
  8606.         if ($manual_journal_id === null || (is_array($manual_journal_id) && count($manual_journal_id) === 0)) {
  8607.             throw new \InvalidArgumentException(
  8608.                 'Missing the required parameter $manual_journal_id when calling createManualJournalAttachmentByFileName'
  8609.             );
  8610.         }
  8611.         // verify the required parameter 'file_name' is set
  8612.         if ($file_name === null || (is_array($file_name) && count($file_name) === 0)) {
  8613.             throw new \InvalidArgumentException(
  8614.                 'Missing the required parameter $file_name when calling createManualJournalAttachmentByFileName'
  8615.             );
  8616.         }
  8617.         // verify the required parameter 'body' is set
  8618.         if ($body === null || (is_array($body) && count($body) === 0)) {
  8619.             throw new \InvalidArgumentException(
  8620.                 'Missing the required parameter $body when calling createManualJournalAttachmentByFileName'
  8621.             );
  8622.         }
  8623.         $resourcePath '/ManualJournals/{ManualJournalID}/Attachments/{FileName}';
  8624.         $formParams = [];
  8625.         $queryParams = [];
  8626.         $headerParams = [];
  8627.         $httpBody '';
  8628.         $multipart false;
  8629.         // header params
  8630.         if ($xero_tenant_id !== null) {
  8631.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  8632.         }
  8633.         // path params
  8634.         if ($manual_journal_id !== null) {
  8635.             $resourcePath str_replace(
  8636.                 '{' 'ManualJournalID' '}',
  8637.                 AccountingObjectSerializer::toPathValue($manual_journal_id),
  8638.                 $resourcePath
  8639.             );
  8640.         }
  8641.         // path params
  8642.         if ($file_name !== null) {
  8643.             $resourcePath str_replace(
  8644.                 '{' 'FileName' '}',
  8645.                 AccountingObjectSerializer::toPathValue($file_name),
  8646.                 $resourcePath
  8647.             );
  8648.         }
  8649.         // body params
  8650.         $_tempBody null;
  8651.         if (isset($body)) {
  8652.             $_tempBody $body;
  8653.         }
  8654.         if ($multipart) {
  8655.             $headers $this->headerSelector->selectHeadersForMultipart(
  8656.                 ['application/json']
  8657.             );
  8658.         } else {
  8659.             $headers $this->headerSelector->selectHeaders(
  8660.                 ['application/json'],
  8661.                 ['application/octet-stream']
  8662.             );
  8663.         }
  8664.         // for model (json/xml)
  8665.         if (isset($_tempBody)) {
  8666.             // $_tempBody is the method argument, if present
  8667.             if ($headers['Content-Type'] === 'application/json') {
  8668.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  8669.             } else {
  8670.                 $httpBody $_tempBody;
  8671.             }
  8672.         } elseif (count($formParams) > 0) {
  8673.             if ($multipart) {
  8674.                 $multipartContents = [
  8675.                     [
  8676.                         'Content-type' => 'multipart/form-data',
  8677.                     ]
  8678.                 ];
  8679.                 
  8680.                 // for HTTP post (form)
  8681.                 $httpBody = new MultipartStream($multipartContents);
  8682.             } elseif ($headers['Content-Type'] === 'application/json') {
  8683.                 $httpBody \GuzzleHttp\json_encode($formParams);
  8684.             } else {
  8685.                 // for HTTP post (form)
  8686.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  8687.             }
  8688.         }
  8689.         // this endpoint requires OAuth (access token)
  8690.         if ($this->config->getAccessToken() !== null) {
  8691.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  8692.         }
  8693.         $defaultHeaders = [];
  8694.         if ($this->config->getUserAgent()) {
  8695.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  8696.         }
  8697.         $headers array_merge(
  8698.             $defaultHeaders,
  8699.             $headerParams,
  8700.             $headers
  8701.         );
  8702.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  8703.         return new Request(
  8704.             'PUT',
  8705.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  8706.             $headers,
  8707.             $httpBody
  8708.         );
  8709.     }
  8710.     /**
  8711.      * Operation createManualJournalHistoryRecord
  8712.      * Creates a history record for a specific manual journal
  8713.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  8714.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  8715.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  8716.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  8717.      * @throws \InvalidArgumentException
  8718.      * @return \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords|\XeroAPI\XeroPHP\Models\Accounting\Error
  8719.      */
  8720.     public function createManualJournalHistoryRecord($xero_tenant_id$manual_journal_id$history_records)
  8721.     {
  8722.         list($response) = $this->createManualJournalHistoryRecordWithHttpInfo($xero_tenant_id$manual_journal_id$history_records);
  8723.         return $response;
  8724.     }
  8725.     /**
  8726.      * Operation createManualJournalHistoryRecordWithHttpInfo
  8727.      * Creates a history record for a specific manual journal
  8728.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  8729.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  8730.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  8731.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  8732.      * @throws \InvalidArgumentException
  8733.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  8734.      */
  8735.     public function createManualJournalHistoryRecordWithHttpInfo($xero_tenant_id$manual_journal_id$history_records)
  8736.     {
  8737.         $request $this->createManualJournalHistoryRecordRequest($xero_tenant_id$manual_journal_id$history_records);
  8738.         try {
  8739.             $options $this->createHttpClientOption();
  8740.             try {
  8741.                 $response $this->client->send($request$options);
  8742.             } catch (RequestException $e) {
  8743.                 throw new ApiException(
  8744.                     "[{$e->getCode()}{$e->getMessage()}",
  8745.                     $e->getCode(),
  8746.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  8747.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  8748.                 );
  8749.             }
  8750.             $statusCode $response->getStatusCode();
  8751.             if ($statusCode 200 || $statusCode 299) {
  8752.                 throw new ApiException(
  8753.                     sprintf(
  8754.                         '[%d] Error connecting to the API (%s)',
  8755.                         $statusCode,
  8756.                         $request->getUri()
  8757.                     ),
  8758.                     $statusCode,
  8759.                     $response->getHeaders(),
  8760.                     $response->getBody()
  8761.                 );
  8762.             }
  8763.             $responseBody $response->getBody();
  8764.             switch($statusCode) {
  8765.                 case 200:
  8766.                     if ('\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords' === '\SplFileObject') {
  8767.                         $content $responseBody//stream goes to serializer
  8768.                     } else {
  8769.                         $content $responseBody->getContents();
  8770.                     }
  8771.                     return [
  8772.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords', []),
  8773.                         $response->getStatusCode(),
  8774.                         $response->getHeaders()
  8775.                     ];
  8776.                 case 400:
  8777.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  8778.                         $content $responseBody//stream goes to serializer
  8779.                     } else {
  8780.                         $content $responseBody->getContents();
  8781.                     }
  8782.                     return [
  8783.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  8784.                         $response->getStatusCode(),
  8785.                         $response->getHeaders()
  8786.                     ];
  8787.             }
  8788.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  8789.             $responseBody $response->getBody();
  8790.             if ($returnType === '\SplFileObject') {
  8791.                 $content $responseBody//stream goes to serializer
  8792.             } else {
  8793.                 $content $responseBody->getContents();
  8794.             }
  8795.             return [
  8796.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  8797.                 $response->getStatusCode(),
  8798.                 $response->getHeaders()
  8799.             ];
  8800.         } catch (ApiException $e) {
  8801.             switch ($e->getCode()) {
  8802.                 case 200:
  8803.                     $data AccountingObjectSerializer::deserialize(
  8804.                         $e->getResponseBody(),
  8805.                         '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords',
  8806.                         $e->getResponseHeaders()
  8807.                     );
  8808.                     $e->setResponseObject($data);
  8809.                     break;
  8810.                 case 400:
  8811.                     $data AccountingObjectSerializer::deserialize(
  8812.                         $e->getResponseBody(),
  8813.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  8814.                         $e->getResponseHeaders()
  8815.                     );
  8816.                     $e->setResponseObject($data);
  8817.                     break;
  8818.             }
  8819.             throw $e;
  8820.         }
  8821.     }
  8822.     /**
  8823.      * Operation createManualJournalHistoryRecordAsync
  8824.      * Creates a history record for a specific manual journal
  8825.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  8826.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  8827.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  8828.      * @throws \InvalidArgumentException
  8829.      * @return \GuzzleHttp\Promise\PromiseInterface
  8830.      */
  8831.     public function createManualJournalHistoryRecordAsync($xero_tenant_id$manual_journal_id$history_records)
  8832.     {
  8833.         return $this->createManualJournalHistoryRecordAsyncWithHttpInfo($xero_tenant_id$manual_journal_id$history_records)
  8834.             ->then(
  8835.                 function ($response) {
  8836.                     return $response[0];
  8837.                 }
  8838.             );
  8839.     }
  8840.     /**
  8841.      * Operation createManualJournalHistoryRecordAsyncWithHttpInfo
  8842.      * Creates a history record for a specific manual journal
  8843.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  8844.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  8845.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  8846.      * @throws \InvalidArgumentException
  8847.      * @return \GuzzleHttp\Promise\PromiseInterface */
  8848.     public function createManualJournalHistoryRecordAsyncWithHttpInfo($xero_tenant_id$manual_journal_id$history_records)
  8849.     {
  8850.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  8851.         $request $this->createManualJournalHistoryRecordRequest($xero_tenant_id$manual_journal_id$history_records);
  8852.         return $this->client
  8853.             ->sendAsync($request$this->createHttpClientOption())
  8854.             ->then(
  8855.                 function ($response) use ($returnType) {
  8856.                     $responseBody $response->getBody();
  8857.                     if ($returnType === '\SplFileObject') {
  8858.                         $content $responseBody//stream goes to serializer
  8859.                     } else {
  8860.                         $content $responseBody->getContents();
  8861.                     }
  8862.                     return [
  8863.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  8864.                         $response->getStatusCode(),
  8865.                         $response->getHeaders()
  8866.                     ];
  8867.                 },
  8868.                 function ($exception) {
  8869.                     $response $exception->getResponse();
  8870.                     $statusCode $response->getStatusCode();
  8871.                     throw new ApiException(
  8872.                         sprintf(
  8873.                             '[%d] Error connecting to the API (%s)',
  8874.                             $statusCode,
  8875.                             $exception->getRequest()->getUri()
  8876.                         ),
  8877.                         $statusCode,
  8878.                         $response->getHeaders(),
  8879.                         $response->getBody()
  8880.                     );
  8881.                 }
  8882.             );
  8883.     }
  8884.     /**
  8885.      * Create request for operation 'createManualJournalHistoryRecord'
  8886.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  8887.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  8888.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  8889.      * @throws \InvalidArgumentException
  8890.      * @return \GuzzleHttp\Psr7\Request  */
  8891.     protected function createManualJournalHistoryRecordRequest($xero_tenant_id$manual_journal_id$history_records)
  8892.     {
  8893.         // verify the required parameter 'xero_tenant_id' is set
  8894.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  8895.             throw new \InvalidArgumentException(
  8896.                 'Missing the required parameter $xero_tenant_id when calling createManualJournalHistoryRecord'
  8897.             );
  8898.         }
  8899.         // verify the required parameter 'manual_journal_id' is set
  8900.         if ($manual_journal_id === null || (is_array($manual_journal_id) && count($manual_journal_id) === 0)) {
  8901.             throw new \InvalidArgumentException(
  8902.                 'Missing the required parameter $manual_journal_id when calling createManualJournalHistoryRecord'
  8903.             );
  8904.         }
  8905.         // verify the required parameter 'history_records' is set
  8906.         if ($history_records === null || (is_array($history_records) && count($history_records) === 0)) {
  8907.             throw new \InvalidArgumentException(
  8908.                 'Missing the required parameter $history_records when calling createManualJournalHistoryRecord'
  8909.             );
  8910.         }
  8911.         $resourcePath '/ManualJournals/{ManualJournalID}/History';
  8912.         $formParams = [];
  8913.         $queryParams = [];
  8914.         $headerParams = [];
  8915.         $httpBody '';
  8916.         $multipart false;
  8917.         // header params
  8918.         if ($xero_tenant_id !== null) {
  8919.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  8920.         }
  8921.         // path params
  8922.         if ($manual_journal_id !== null) {
  8923.             $resourcePath str_replace(
  8924.                 '{' 'ManualJournalID' '}',
  8925.                 AccountingObjectSerializer::toPathValue($manual_journal_id),
  8926.                 $resourcePath
  8927.             );
  8928.         }
  8929.         // body params
  8930.         $_tempBody null;
  8931.         if (isset($history_records)) {
  8932.             $_tempBody $history_records;
  8933.         }
  8934.         if ($multipart) {
  8935.             $headers $this->headerSelector->selectHeadersForMultipart(
  8936.                 ['application/json']
  8937.             );
  8938.         } else {
  8939.             $headers $this->headerSelector->selectHeaders(
  8940.                 ['application/json'],
  8941.                 ['application/json']
  8942.             );
  8943.         }
  8944.         // for model (json/xml)
  8945.         if (isset($_tempBody)) {
  8946.             // $_tempBody is the method argument, if present
  8947.             if ($headers['Content-Type'] === 'application/json') {
  8948.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  8949.             } else {
  8950.                 $httpBody $_tempBody;
  8951.             }
  8952.         } elseif (count($formParams) > 0) {
  8953.             if ($multipart) {
  8954.                 $multipartContents = [
  8955.                     [
  8956.                         'Content-type' => 'multipart/form-data',
  8957.                     ]
  8958.                 ];
  8959.                 
  8960.                 // for HTTP post (form)
  8961.                 $httpBody = new MultipartStream($multipartContents);
  8962.             } elseif ($headers['Content-Type'] === 'application/json') {
  8963.                 $httpBody \GuzzleHttp\json_encode($formParams);
  8964.             } else {
  8965.                 // for HTTP post (form)
  8966.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  8967.             }
  8968.         }
  8969.         // this endpoint requires OAuth (access token)
  8970.         if ($this->config->getAccessToken() !== null) {
  8971.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  8972.         }
  8973.         $defaultHeaders = [];
  8974.         if ($this->config->getUserAgent()) {
  8975.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  8976.         }
  8977.         $headers array_merge(
  8978.             $defaultHeaders,
  8979.             $headerParams,
  8980.             $headers
  8981.         );
  8982.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  8983.         return new Request(
  8984.             'PUT',
  8985.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  8986.             $headers,
  8987.             $httpBody
  8988.         );
  8989.     }
  8990.     /**
  8991.      * Operation createManualJournals
  8992.      * Creates one or more manual journals
  8993.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  8994.      * @param  \XeroAPI\XeroPHP\Models\Accounting\ManualJournals $manual_journals ManualJournals array with ManualJournal object in body of request (required)
  8995.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  8996.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  8997.      * @throws \InvalidArgumentException
  8998.      * @return \XeroAPI\XeroPHP\Models\Accounting\ManualJournals|\XeroAPI\XeroPHP\Models\Accounting\Error
  8999.      */
  9000.     public function createManualJournals($xero_tenant_id$manual_journals$summarize_errors false)
  9001.     {
  9002.         list($response) = $this->createManualJournalsWithHttpInfo($xero_tenant_id$manual_journals$summarize_errors);
  9003.         return $response;
  9004.     }
  9005.     /**
  9006.      * Operation createManualJournalsWithHttpInfo
  9007.      * Creates one or more manual journals
  9008.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  9009.      * @param  \XeroAPI\XeroPHP\Models\Accounting\ManualJournals $manual_journals ManualJournals array with ManualJournal object in body of request (required)
  9010.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  9011.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  9012.      * @throws \InvalidArgumentException
  9013.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\ManualJournals|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  9014.      */
  9015.     public function createManualJournalsWithHttpInfo($xero_tenant_id$manual_journals$summarize_errors false)
  9016.     {
  9017.         $request $this->createManualJournalsRequest($xero_tenant_id$manual_journals$summarize_errors);
  9018.         try {
  9019.             $options $this->createHttpClientOption();
  9020.             try {
  9021.                 $response $this->client->send($request$options);
  9022.             } catch (RequestException $e) {
  9023.                 throw new ApiException(
  9024.                     "[{$e->getCode()}{$e->getMessage()}",
  9025.                     $e->getCode(),
  9026.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  9027.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  9028.                 );
  9029.             }
  9030.             $statusCode $response->getStatusCode();
  9031.             if ($statusCode 200 || $statusCode 299) {
  9032.                 throw new ApiException(
  9033.                     sprintf(
  9034.                         '[%d] Error connecting to the API (%s)',
  9035.                         $statusCode,
  9036.                         $request->getUri()
  9037.                     ),
  9038.                     $statusCode,
  9039.                     $response->getHeaders(),
  9040.                     $response->getBody()
  9041.                 );
  9042.             }
  9043.             $responseBody $response->getBody();
  9044.             switch($statusCode) {
  9045.                 case 200:
  9046.                     if ('\XeroAPI\XeroPHP\Models\Accounting\ManualJournals' === '\SplFileObject') {
  9047.                         $content $responseBody//stream goes to serializer
  9048.                     } else {
  9049.                         $content $responseBody->getContents();
  9050.                     }
  9051.                     return [
  9052.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\ManualJournals', []),
  9053.                         $response->getStatusCode(),
  9054.                         $response->getHeaders()
  9055.                     ];
  9056.                 case 400:
  9057.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  9058.                         $content $responseBody//stream goes to serializer
  9059.                     } else {
  9060.                         $content $responseBody->getContents();
  9061.                     }
  9062.                     return [
  9063.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  9064.                         $response->getStatusCode(),
  9065.                         $response->getHeaders()
  9066.                     ];
  9067.             }
  9068.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\ManualJournals';
  9069.             $responseBody $response->getBody();
  9070.             if ($returnType === '\SplFileObject') {
  9071.                 $content $responseBody//stream goes to serializer
  9072.             } else {
  9073.                 $content $responseBody->getContents();
  9074.             }
  9075.             return [
  9076.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  9077.                 $response->getStatusCode(),
  9078.                 $response->getHeaders()
  9079.             ];
  9080.         } catch (ApiException $e) {
  9081.             switch ($e->getCode()) {
  9082.                 case 200:
  9083.                     $data AccountingObjectSerializer::deserialize(
  9084.                         $e->getResponseBody(),
  9085.                         '\XeroAPI\XeroPHP\Models\Accounting\ManualJournals',
  9086.                         $e->getResponseHeaders()
  9087.                     );
  9088.                     $e->setResponseObject($data);
  9089.                     break;
  9090.                 case 400:
  9091.                     $data AccountingObjectSerializer::deserialize(
  9092.                         $e->getResponseBody(),
  9093.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  9094.                         $e->getResponseHeaders()
  9095.                     );
  9096.                     $e->setResponseObject($data);
  9097.                     break;
  9098.             }
  9099.             throw $e;
  9100.         }
  9101.     }
  9102.     /**
  9103.      * Operation createManualJournalsAsync
  9104.      * Creates one or more manual journals
  9105.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  9106.      * @param  \XeroAPI\XeroPHP\Models\Accounting\ManualJournals $manual_journals ManualJournals array with ManualJournal object in body of request (required)
  9107.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  9108.      * @throws \InvalidArgumentException
  9109.      * @return \GuzzleHttp\Promise\PromiseInterface
  9110.      */
  9111.     public function createManualJournalsAsync($xero_tenant_id$manual_journals$summarize_errors false)
  9112.     {
  9113.         return $this->createManualJournalsAsyncWithHttpInfo($xero_tenant_id$manual_journals$summarize_errors)
  9114.             ->then(
  9115.                 function ($response) {
  9116.                     return $response[0];
  9117.                 }
  9118.             );
  9119.     }
  9120.     /**
  9121.      * Operation createManualJournalsAsyncWithHttpInfo
  9122.      * Creates one or more manual journals
  9123.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  9124.      * @param  \XeroAPI\XeroPHP\Models\Accounting\ManualJournals $manual_journals ManualJournals array with ManualJournal object in body of request (required)
  9125.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  9126.      * @throws \InvalidArgumentException
  9127.      * @return \GuzzleHttp\Promise\PromiseInterface */
  9128.     public function createManualJournalsAsyncWithHttpInfo($xero_tenant_id$manual_journals$summarize_errors false)
  9129.     {
  9130.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\ManualJournals';
  9131.         $request $this->createManualJournalsRequest($xero_tenant_id$manual_journals$summarize_errors);
  9132.         return $this->client
  9133.             ->sendAsync($request$this->createHttpClientOption())
  9134.             ->then(
  9135.                 function ($response) use ($returnType) {
  9136.                     $responseBody $response->getBody();
  9137.                     if ($returnType === '\SplFileObject') {
  9138.                         $content $responseBody//stream goes to serializer
  9139.                     } else {
  9140.                         $content $responseBody->getContents();
  9141.                     }
  9142.                     return [
  9143.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  9144.                         $response->getStatusCode(),
  9145.                         $response->getHeaders()
  9146.                     ];
  9147.                 },
  9148.                 function ($exception) {
  9149.                     $response $exception->getResponse();
  9150.                     $statusCode $response->getStatusCode();
  9151.                     throw new ApiException(
  9152.                         sprintf(
  9153.                             '[%d] Error connecting to the API (%s)',
  9154.                             $statusCode,
  9155.                             $exception->getRequest()->getUri()
  9156.                         ),
  9157.                         $statusCode,
  9158.                         $response->getHeaders(),
  9159.                         $response->getBody()
  9160.                     );
  9161.                 }
  9162.             );
  9163.     }
  9164.     /**
  9165.      * Create request for operation 'createManualJournals'
  9166.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  9167.      * @param  \XeroAPI\XeroPHP\Models\Accounting\ManualJournals $manual_journals ManualJournals array with ManualJournal object in body of request (required)
  9168.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  9169.      * @throws \InvalidArgumentException
  9170.      * @return \GuzzleHttp\Psr7\Request  */
  9171.     protected function createManualJournalsRequest($xero_tenant_id$manual_journals$summarize_errors false)
  9172.     {
  9173.         // verify the required parameter 'xero_tenant_id' is set
  9174.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  9175.             throw new \InvalidArgumentException(
  9176.                 'Missing the required parameter $xero_tenant_id when calling createManualJournals'
  9177.             );
  9178.         }
  9179.         // verify the required parameter 'manual_journals' is set
  9180.         if ($manual_journals === null || (is_array($manual_journals) && count($manual_journals) === 0)) {
  9181.             throw new \InvalidArgumentException(
  9182.                 'Missing the required parameter $manual_journals when calling createManualJournals'
  9183.             );
  9184.         }
  9185.         $resourcePath '/ManualJournals';
  9186.         $formParams = [];
  9187.         $queryParams = [];
  9188.         $headerParams = [];
  9189.         $httpBody '';
  9190.         $multipart false;
  9191.         // query params
  9192.         if ($summarize_errors !== null) {
  9193.             $queryParams['summarizeErrors'] = $summarize_errors 'true' 'false';
  9194.         }
  9195.         // header params
  9196.         if ($xero_tenant_id !== null) {
  9197.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  9198.         }
  9199.         // body params
  9200.         $_tempBody null;
  9201.         if (isset($manual_journals)) {
  9202.             $_tempBody $manual_journals;
  9203.         }
  9204.         if ($multipart) {
  9205.             $headers $this->headerSelector->selectHeadersForMultipart(
  9206.                 ['application/json']
  9207.             );
  9208.         } else {
  9209.             $headers $this->headerSelector->selectHeaders(
  9210.                 ['application/json'],
  9211.                 ['application/json']
  9212.             );
  9213.         }
  9214.         // for model (json/xml)
  9215.         if (isset($_tempBody)) {
  9216.             // $_tempBody is the method argument, if present
  9217.             if ($headers['Content-Type'] === 'application/json') {
  9218.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  9219.             } else {
  9220.                 $httpBody $_tempBody;
  9221.             }
  9222.         } elseif (count($formParams) > 0) {
  9223.             if ($multipart) {
  9224.                 $multipartContents = [
  9225.                     [
  9226.                         'Content-type' => 'multipart/form-data',
  9227.                     ]
  9228.                 ];
  9229.                 
  9230.                 // for HTTP post (form)
  9231.                 $httpBody = new MultipartStream($multipartContents);
  9232.             } elseif ($headers['Content-Type'] === 'application/json') {
  9233.                 $httpBody \GuzzleHttp\json_encode($formParams);
  9234.             } else {
  9235.                 // for HTTP post (form)
  9236.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  9237.             }
  9238.         }
  9239.         // this endpoint requires OAuth (access token)
  9240.         if ($this->config->getAccessToken() !== null) {
  9241.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  9242.         }
  9243.         $defaultHeaders = [];
  9244.         if ($this->config->getUserAgent()) {
  9245.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  9246.         }
  9247.         $headers array_merge(
  9248.             $defaultHeaders,
  9249.             $headerParams,
  9250.             $headers
  9251.         );
  9252.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  9253.         return new Request(
  9254.             'PUT',
  9255.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  9256.             $headers,
  9257.             $httpBody
  9258.         );
  9259.     }
  9260.     /**
  9261.      * Operation createOverpaymentAllocations
  9262.      * Creates a single allocation for a specific overpayment
  9263.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  9264.      * @param  string $overpayment_id Unique identifier for a Overpayment (required)
  9265.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Allocations $allocations Allocations array with Allocation object in body of request (required)
  9266.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  9267.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  9268.      * @throws \InvalidArgumentException
  9269.      * @return \XeroAPI\XeroPHP\Models\Accounting\Allocations|\XeroAPI\XeroPHP\Models\Accounting\Error
  9270.      */
  9271.     public function createOverpaymentAllocations($xero_tenant_id$overpayment_id$allocations$summarize_errors false)
  9272.     {
  9273.         list($response) = $this->createOverpaymentAllocationsWithHttpInfo($xero_tenant_id$overpayment_id$allocations$summarize_errors);
  9274.         return $response;
  9275.     }
  9276.     /**
  9277.      * Operation createOverpaymentAllocationsWithHttpInfo
  9278.      * Creates a single allocation for a specific overpayment
  9279.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  9280.      * @param  string $overpayment_id Unique identifier for a Overpayment (required)
  9281.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Allocations $allocations Allocations array with Allocation object in body of request (required)
  9282.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  9283.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  9284.      * @throws \InvalidArgumentException
  9285.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Allocations|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  9286.      */
  9287.     public function createOverpaymentAllocationsWithHttpInfo($xero_tenant_id$overpayment_id$allocations$summarize_errors false)
  9288.     {
  9289.         $request $this->createOverpaymentAllocationsRequest($xero_tenant_id$overpayment_id$allocations$summarize_errors);
  9290.         try {
  9291.             $options $this->createHttpClientOption();
  9292.             try {
  9293.                 $response $this->client->send($request$options);
  9294.             } catch (RequestException $e) {
  9295.                 throw new ApiException(
  9296.                     "[{$e->getCode()}{$e->getMessage()}",
  9297.                     $e->getCode(),
  9298.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  9299.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  9300.                 );
  9301.             }
  9302.             $statusCode $response->getStatusCode();
  9303.             if ($statusCode 200 || $statusCode 299) {
  9304.                 throw new ApiException(
  9305.                     sprintf(
  9306.                         '[%d] Error connecting to the API (%s)',
  9307.                         $statusCode,
  9308.                         $request->getUri()
  9309.                     ),
  9310.                     $statusCode,
  9311.                     $response->getHeaders(),
  9312.                     $response->getBody()
  9313.                 );
  9314.             }
  9315.             $responseBody $response->getBody();
  9316.             switch($statusCode) {
  9317.                 case 200:
  9318.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Allocations' === '\SplFileObject') {
  9319.                         $content $responseBody//stream goes to serializer
  9320.                     } else {
  9321.                         $content $responseBody->getContents();
  9322.                     }
  9323.                     return [
  9324.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Allocations', []),
  9325.                         $response->getStatusCode(),
  9326.                         $response->getHeaders()
  9327.                     ];
  9328.                 case 400:
  9329.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  9330.                         $content $responseBody//stream goes to serializer
  9331.                     } else {
  9332.                         $content $responseBody->getContents();
  9333.                     }
  9334.                     return [
  9335.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  9336.                         $response->getStatusCode(),
  9337.                         $response->getHeaders()
  9338.                     ];
  9339.             }
  9340.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Allocations';
  9341.             $responseBody $response->getBody();
  9342.             if ($returnType === '\SplFileObject') {
  9343.                 $content $responseBody//stream goes to serializer
  9344.             } else {
  9345.                 $content $responseBody->getContents();
  9346.             }
  9347.             return [
  9348.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  9349.                 $response->getStatusCode(),
  9350.                 $response->getHeaders()
  9351.             ];
  9352.         } catch (ApiException $e) {
  9353.             switch ($e->getCode()) {
  9354.                 case 200:
  9355.                     $data AccountingObjectSerializer::deserialize(
  9356.                         $e->getResponseBody(),
  9357.                         '\XeroAPI\XeroPHP\Models\Accounting\Allocations',
  9358.                         $e->getResponseHeaders()
  9359.                     );
  9360.                     $e->setResponseObject($data);
  9361.                     break;
  9362.                 case 400:
  9363.                     $data AccountingObjectSerializer::deserialize(
  9364.                         $e->getResponseBody(),
  9365.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  9366.                         $e->getResponseHeaders()
  9367.                     );
  9368.                     $e->setResponseObject($data);
  9369.                     break;
  9370.             }
  9371.             throw $e;
  9372.         }
  9373.     }
  9374.     /**
  9375.      * Operation createOverpaymentAllocationsAsync
  9376.      * Creates a single allocation for a specific overpayment
  9377.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  9378.      * @param  string $overpayment_id Unique identifier for a Overpayment (required)
  9379.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Allocations $allocations Allocations array with Allocation object in body of request (required)
  9380.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  9381.      * @throws \InvalidArgumentException
  9382.      * @return \GuzzleHttp\Promise\PromiseInterface
  9383.      */
  9384.     public function createOverpaymentAllocationsAsync($xero_tenant_id$overpayment_id$allocations$summarize_errors false)
  9385.     {
  9386.         return $this->createOverpaymentAllocationsAsyncWithHttpInfo($xero_tenant_id$overpayment_id$allocations$summarize_errors)
  9387.             ->then(
  9388.                 function ($response) {
  9389.                     return $response[0];
  9390.                 }
  9391.             );
  9392.     }
  9393.     /**
  9394.      * Operation createOverpaymentAllocationsAsyncWithHttpInfo
  9395.      * Creates a single allocation for a specific overpayment
  9396.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  9397.      * @param  string $overpayment_id Unique identifier for a Overpayment (required)
  9398.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Allocations $allocations Allocations array with Allocation object in body of request (required)
  9399.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  9400.      * @throws \InvalidArgumentException
  9401.      * @return \GuzzleHttp\Promise\PromiseInterface */
  9402.     public function createOverpaymentAllocationsAsyncWithHttpInfo($xero_tenant_id$overpayment_id$allocations$summarize_errors false)
  9403.     {
  9404.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Allocations';
  9405.         $request $this->createOverpaymentAllocationsRequest($xero_tenant_id$overpayment_id$allocations$summarize_errors);
  9406.         return $this->client
  9407.             ->sendAsync($request$this->createHttpClientOption())
  9408.             ->then(
  9409.                 function ($response) use ($returnType) {
  9410.                     $responseBody $response->getBody();
  9411.                     if ($returnType === '\SplFileObject') {
  9412.                         $content $responseBody//stream goes to serializer
  9413.                     } else {
  9414.                         $content $responseBody->getContents();
  9415.                     }
  9416.                     return [
  9417.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  9418.                         $response->getStatusCode(),
  9419.                         $response->getHeaders()
  9420.                     ];
  9421.                 },
  9422.                 function ($exception) {
  9423.                     $response $exception->getResponse();
  9424.                     $statusCode $response->getStatusCode();
  9425.                     throw new ApiException(
  9426.                         sprintf(
  9427.                             '[%d] Error connecting to the API (%s)',
  9428.                             $statusCode,
  9429.                             $exception->getRequest()->getUri()
  9430.                         ),
  9431.                         $statusCode,
  9432.                         $response->getHeaders(),
  9433.                         $response->getBody()
  9434.                     );
  9435.                 }
  9436.             );
  9437.     }
  9438.     /**
  9439.      * Create request for operation 'createOverpaymentAllocations'
  9440.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  9441.      * @param  string $overpayment_id Unique identifier for a Overpayment (required)
  9442.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Allocations $allocations Allocations array with Allocation object in body of request (required)
  9443.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  9444.      * @throws \InvalidArgumentException
  9445.      * @return \GuzzleHttp\Psr7\Request  */
  9446.     protected function createOverpaymentAllocationsRequest($xero_tenant_id$overpayment_id$allocations$summarize_errors false)
  9447.     {
  9448.         // verify the required parameter 'xero_tenant_id' is set
  9449.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  9450.             throw new \InvalidArgumentException(
  9451.                 'Missing the required parameter $xero_tenant_id when calling createOverpaymentAllocations'
  9452.             );
  9453.         }
  9454.         // verify the required parameter 'overpayment_id' is set
  9455.         if ($overpayment_id === null || (is_array($overpayment_id) && count($overpayment_id) === 0)) {
  9456.             throw new \InvalidArgumentException(
  9457.                 'Missing the required parameter $overpayment_id when calling createOverpaymentAllocations'
  9458.             );
  9459.         }
  9460.         // verify the required parameter 'allocations' is set
  9461.         if ($allocations === null || (is_array($allocations) && count($allocations) === 0)) {
  9462.             throw new \InvalidArgumentException(
  9463.                 'Missing the required parameter $allocations when calling createOverpaymentAllocations'
  9464.             );
  9465.         }
  9466.         $resourcePath '/Overpayments/{OverpaymentID}/Allocations';
  9467.         $formParams = [];
  9468.         $queryParams = [];
  9469.         $headerParams = [];
  9470.         $httpBody '';
  9471.         $multipart false;
  9472.         // query params
  9473.         if ($summarize_errors !== null) {
  9474.             $queryParams['summarizeErrors'] = $summarize_errors 'true' 'false';
  9475.         }
  9476.         // header params
  9477.         if ($xero_tenant_id !== null) {
  9478.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  9479.         }
  9480.         // path params
  9481.         if ($overpayment_id !== null) {
  9482.             $resourcePath str_replace(
  9483.                 '{' 'OverpaymentID' '}',
  9484.                 AccountingObjectSerializer::toPathValue($overpayment_id),
  9485.                 $resourcePath
  9486.             );
  9487.         }
  9488.         // body params
  9489.         $_tempBody null;
  9490.         if (isset($allocations)) {
  9491.             $_tempBody $allocations;
  9492.         }
  9493.         if ($multipart) {
  9494.             $headers $this->headerSelector->selectHeadersForMultipart(
  9495.                 ['application/json']
  9496.             );
  9497.         } else {
  9498.             $headers $this->headerSelector->selectHeaders(
  9499.                 ['application/json'],
  9500.                 ['application/json']
  9501.             );
  9502.         }
  9503.         // for model (json/xml)
  9504.         if (isset($_tempBody)) {
  9505.             // $_tempBody is the method argument, if present
  9506.             if ($headers['Content-Type'] === 'application/json') {
  9507.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  9508.             } else {
  9509.                 $httpBody $_tempBody;
  9510.             }
  9511.         } elseif (count($formParams) > 0) {
  9512.             if ($multipart) {
  9513.                 $multipartContents = [
  9514.                     [
  9515.                         'Content-type' => 'multipart/form-data',
  9516.                     ]
  9517.                 ];
  9518.                 
  9519.                 // for HTTP post (form)
  9520.                 $httpBody = new MultipartStream($multipartContents);
  9521.             } elseif ($headers['Content-Type'] === 'application/json') {
  9522.                 $httpBody \GuzzleHttp\json_encode($formParams);
  9523.             } else {
  9524.                 // for HTTP post (form)
  9525.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  9526.             }
  9527.         }
  9528.         // this endpoint requires OAuth (access token)
  9529.         if ($this->config->getAccessToken() !== null) {
  9530.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  9531.         }
  9532.         $defaultHeaders = [];
  9533.         if ($this->config->getUserAgent()) {
  9534.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  9535.         }
  9536.         $headers array_merge(
  9537.             $defaultHeaders,
  9538.             $headerParams,
  9539.             $headers
  9540.         );
  9541.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  9542.         return new Request(
  9543.             'PUT',
  9544.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  9545.             $headers,
  9546.             $httpBody
  9547.         );
  9548.     }
  9549.     /**
  9550.      * Operation createOverpaymentHistory
  9551.      * Creates a history record for a specific overpayment
  9552.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  9553.      * @param  string $overpayment_id Unique identifier for a Overpayment (required)
  9554.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  9555.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  9556.      * @throws \InvalidArgumentException
  9557.      * @return \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords|\XeroAPI\XeroPHP\Models\Accounting\Error
  9558.      */
  9559.     public function createOverpaymentHistory($xero_tenant_id$overpayment_id$history_records)
  9560.     {
  9561.         list($response) = $this->createOverpaymentHistoryWithHttpInfo($xero_tenant_id$overpayment_id$history_records);
  9562.         return $response;
  9563.     }
  9564.     /**
  9565.      * Operation createOverpaymentHistoryWithHttpInfo
  9566.      * Creates a history record for a specific overpayment
  9567.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  9568.      * @param  string $overpayment_id Unique identifier for a Overpayment (required)
  9569.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  9570.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  9571.      * @throws \InvalidArgumentException
  9572.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  9573.      */
  9574.     public function createOverpaymentHistoryWithHttpInfo($xero_tenant_id$overpayment_id$history_records)
  9575.     {
  9576.         $request $this->createOverpaymentHistoryRequest($xero_tenant_id$overpayment_id$history_records);
  9577.         try {
  9578.             $options $this->createHttpClientOption();
  9579.             try {
  9580.                 $response $this->client->send($request$options);
  9581.             } catch (RequestException $e) {
  9582.                 throw new ApiException(
  9583.                     "[{$e->getCode()}{$e->getMessage()}",
  9584.                     $e->getCode(),
  9585.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  9586.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  9587.                 );
  9588.             }
  9589.             $statusCode $response->getStatusCode();
  9590.             if ($statusCode 200 || $statusCode 299) {
  9591.                 throw new ApiException(
  9592.                     sprintf(
  9593.                         '[%d] Error connecting to the API (%s)',
  9594.                         $statusCode,
  9595.                         $request->getUri()
  9596.                     ),
  9597.                     $statusCode,
  9598.                     $response->getHeaders(),
  9599.                     $response->getBody()
  9600.                 );
  9601.             }
  9602.             $responseBody $response->getBody();
  9603.             switch($statusCode) {
  9604.                 case 200:
  9605.                     if ('\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords' === '\SplFileObject') {
  9606.                         $content $responseBody//stream goes to serializer
  9607.                     } else {
  9608.                         $content $responseBody->getContents();
  9609.                     }
  9610.                     return [
  9611.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords', []),
  9612.                         $response->getStatusCode(),
  9613.                         $response->getHeaders()
  9614.                     ];
  9615.                 case 400:
  9616.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  9617.                         $content $responseBody//stream goes to serializer
  9618.                     } else {
  9619.                         $content $responseBody->getContents();
  9620.                     }
  9621.                     return [
  9622.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  9623.                         $response->getStatusCode(),
  9624.                         $response->getHeaders()
  9625.                     ];
  9626.             }
  9627.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  9628.             $responseBody $response->getBody();
  9629.             if ($returnType === '\SplFileObject') {
  9630.                 $content $responseBody//stream goes to serializer
  9631.             } else {
  9632.                 $content $responseBody->getContents();
  9633.             }
  9634.             return [
  9635.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  9636.                 $response->getStatusCode(),
  9637.                 $response->getHeaders()
  9638.             ];
  9639.         } catch (ApiException $e) {
  9640.             switch ($e->getCode()) {
  9641.                 case 200:
  9642.                     $data AccountingObjectSerializer::deserialize(
  9643.                         $e->getResponseBody(),
  9644.                         '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords',
  9645.                         $e->getResponseHeaders()
  9646.                     );
  9647.                     $e->setResponseObject($data);
  9648.                     break;
  9649.                 case 400:
  9650.                     $data AccountingObjectSerializer::deserialize(
  9651.                         $e->getResponseBody(),
  9652.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  9653.                         $e->getResponseHeaders()
  9654.                     );
  9655.                     $e->setResponseObject($data);
  9656.                     break;
  9657.             }
  9658.             throw $e;
  9659.         }
  9660.     }
  9661.     /**
  9662.      * Operation createOverpaymentHistoryAsync
  9663.      * Creates a history record for a specific overpayment
  9664.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  9665.      * @param  string $overpayment_id Unique identifier for a Overpayment (required)
  9666.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  9667.      * @throws \InvalidArgumentException
  9668.      * @return \GuzzleHttp\Promise\PromiseInterface
  9669.      */
  9670.     public function createOverpaymentHistoryAsync($xero_tenant_id$overpayment_id$history_records)
  9671.     {
  9672.         return $this->createOverpaymentHistoryAsyncWithHttpInfo($xero_tenant_id$overpayment_id$history_records)
  9673.             ->then(
  9674.                 function ($response) {
  9675.                     return $response[0];
  9676.                 }
  9677.             );
  9678.     }
  9679.     /**
  9680.      * Operation createOverpaymentHistoryAsyncWithHttpInfo
  9681.      * Creates a history record for a specific overpayment
  9682.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  9683.      * @param  string $overpayment_id Unique identifier for a Overpayment (required)
  9684.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  9685.      * @throws \InvalidArgumentException
  9686.      * @return \GuzzleHttp\Promise\PromiseInterface */
  9687.     public function createOverpaymentHistoryAsyncWithHttpInfo($xero_tenant_id$overpayment_id$history_records)
  9688.     {
  9689.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  9690.         $request $this->createOverpaymentHistoryRequest($xero_tenant_id$overpayment_id$history_records);
  9691.         return $this->client
  9692.             ->sendAsync($request$this->createHttpClientOption())
  9693.             ->then(
  9694.                 function ($response) use ($returnType) {
  9695.                     $responseBody $response->getBody();
  9696.                     if ($returnType === '\SplFileObject') {
  9697.                         $content $responseBody//stream goes to serializer
  9698.                     } else {
  9699.                         $content $responseBody->getContents();
  9700.                     }
  9701.                     return [
  9702.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  9703.                         $response->getStatusCode(),
  9704.                         $response->getHeaders()
  9705.                     ];
  9706.                 },
  9707.                 function ($exception) {
  9708.                     $response $exception->getResponse();
  9709.                     $statusCode $response->getStatusCode();
  9710.                     throw new ApiException(
  9711.                         sprintf(
  9712.                             '[%d] Error connecting to the API (%s)',
  9713.                             $statusCode,
  9714.                             $exception->getRequest()->getUri()
  9715.                         ),
  9716.                         $statusCode,
  9717.                         $response->getHeaders(),
  9718.                         $response->getBody()
  9719.                     );
  9720.                 }
  9721.             );
  9722.     }
  9723.     /**
  9724.      * Create request for operation 'createOverpaymentHistory'
  9725.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  9726.      * @param  string $overpayment_id Unique identifier for a Overpayment (required)
  9727.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  9728.      * @throws \InvalidArgumentException
  9729.      * @return \GuzzleHttp\Psr7\Request  */
  9730.     protected function createOverpaymentHistoryRequest($xero_tenant_id$overpayment_id$history_records)
  9731.     {
  9732.         // verify the required parameter 'xero_tenant_id' is set
  9733.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  9734.             throw new \InvalidArgumentException(
  9735.                 'Missing the required parameter $xero_tenant_id when calling createOverpaymentHistory'
  9736.             );
  9737.         }
  9738.         // verify the required parameter 'overpayment_id' is set
  9739.         if ($overpayment_id === null || (is_array($overpayment_id) && count($overpayment_id) === 0)) {
  9740.             throw new \InvalidArgumentException(
  9741.                 'Missing the required parameter $overpayment_id when calling createOverpaymentHistory'
  9742.             );
  9743.         }
  9744.         // verify the required parameter 'history_records' is set
  9745.         if ($history_records === null || (is_array($history_records) && count($history_records) === 0)) {
  9746.             throw new \InvalidArgumentException(
  9747.                 'Missing the required parameter $history_records when calling createOverpaymentHistory'
  9748.             );
  9749.         }
  9750.         $resourcePath '/Overpayments/{OverpaymentID}/History';
  9751.         $formParams = [];
  9752.         $queryParams = [];
  9753.         $headerParams = [];
  9754.         $httpBody '';
  9755.         $multipart false;
  9756.         // header params
  9757.         if ($xero_tenant_id !== null) {
  9758.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  9759.         }
  9760.         // path params
  9761.         if ($overpayment_id !== null) {
  9762.             $resourcePath str_replace(
  9763.                 '{' 'OverpaymentID' '}',
  9764.                 AccountingObjectSerializer::toPathValue($overpayment_id),
  9765.                 $resourcePath
  9766.             );
  9767.         }
  9768.         // body params
  9769.         $_tempBody null;
  9770.         if (isset($history_records)) {
  9771.             $_tempBody $history_records;
  9772.         }
  9773.         if ($multipart) {
  9774.             $headers $this->headerSelector->selectHeadersForMultipart(
  9775.                 ['application/json']
  9776.             );
  9777.         } else {
  9778.             $headers $this->headerSelector->selectHeaders(
  9779.                 ['application/json'],
  9780.                 ['application/json']
  9781.             );
  9782.         }
  9783.         // for model (json/xml)
  9784.         if (isset($_tempBody)) {
  9785.             // $_tempBody is the method argument, if present
  9786.             if ($headers['Content-Type'] === 'application/json') {
  9787.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  9788.             } else {
  9789.                 $httpBody $_tempBody;
  9790.             }
  9791.         } elseif (count($formParams) > 0) {
  9792.             if ($multipart) {
  9793.                 $multipartContents = [
  9794.                     [
  9795.                         'Content-type' => 'multipart/form-data',
  9796.                     ]
  9797.                 ];
  9798.                 
  9799.                 // for HTTP post (form)
  9800.                 $httpBody = new MultipartStream($multipartContents);
  9801.             } elseif ($headers['Content-Type'] === 'application/json') {
  9802.                 $httpBody \GuzzleHttp\json_encode($formParams);
  9803.             } else {
  9804.                 // for HTTP post (form)
  9805.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  9806.             }
  9807.         }
  9808.         // this endpoint requires OAuth (access token)
  9809.         if ($this->config->getAccessToken() !== null) {
  9810.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  9811.         }
  9812.         $defaultHeaders = [];
  9813.         if ($this->config->getUserAgent()) {
  9814.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  9815.         }
  9816.         $headers array_merge(
  9817.             $defaultHeaders,
  9818.             $headerParams,
  9819.             $headers
  9820.         );
  9821.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  9822.         return new Request(
  9823.             'PUT',
  9824.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  9825.             $headers,
  9826.             $httpBody
  9827.         );
  9828.     }
  9829.     /**
  9830.      * Operation createPayment
  9831.      * Creates a single payment for invoice or credit notes
  9832.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  9833.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Payment $payment Request body with a single Payment object (required)
  9834.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  9835.      * @throws \InvalidArgumentException
  9836.      * @return \XeroAPI\XeroPHP\Models\Accounting\Payments|\XeroAPI\XeroPHP\Models\Accounting\Error
  9837.      */
  9838.     public function createPayment($xero_tenant_id$payment)
  9839.     {
  9840.         list($response) = $this->createPaymentWithHttpInfo($xero_tenant_id$payment);
  9841.         return $response;
  9842.     }
  9843.     /**
  9844.      * Operation createPaymentWithHttpInfo
  9845.      * Creates a single payment for invoice or credit notes
  9846.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  9847.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Payment $payment Request body with a single Payment object (required)
  9848.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  9849.      * @throws \InvalidArgumentException
  9850.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Payments|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  9851.      */
  9852.     public function createPaymentWithHttpInfo($xero_tenant_id$payment)
  9853.     {
  9854.         $request $this->createPaymentRequest($xero_tenant_id$payment);
  9855.         try {
  9856.             $options $this->createHttpClientOption();
  9857.             try {
  9858.                 $response $this->client->send($request$options);
  9859.             } catch (RequestException $e) {
  9860.                 throw new ApiException(
  9861.                     "[{$e->getCode()}{$e->getMessage()}",
  9862.                     $e->getCode(),
  9863.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  9864.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  9865.                 );
  9866.             }
  9867.             $statusCode $response->getStatusCode();
  9868.             if ($statusCode 200 || $statusCode 299) {
  9869.                 throw new ApiException(
  9870.                     sprintf(
  9871.                         '[%d] Error connecting to the API (%s)',
  9872.                         $statusCode,
  9873.                         $request->getUri()
  9874.                     ),
  9875.                     $statusCode,
  9876.                     $response->getHeaders(),
  9877.                     $response->getBody()
  9878.                 );
  9879.             }
  9880.             $responseBody $response->getBody();
  9881.             switch($statusCode) {
  9882.                 case 200:
  9883.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Payments' === '\SplFileObject') {
  9884.                         $content $responseBody//stream goes to serializer
  9885.                     } else {
  9886.                         $content $responseBody->getContents();
  9887.                     }
  9888.                     return [
  9889.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Payments', []),
  9890.                         $response->getStatusCode(),
  9891.                         $response->getHeaders()
  9892.                     ];
  9893.                 case 400:
  9894.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  9895.                         $content $responseBody//stream goes to serializer
  9896.                     } else {
  9897.                         $content $responseBody->getContents();
  9898.                     }
  9899.                     return [
  9900.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  9901.                         $response->getStatusCode(),
  9902.                         $response->getHeaders()
  9903.                     ];
  9904.             }
  9905.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Payments';
  9906.             $responseBody $response->getBody();
  9907.             if ($returnType === '\SplFileObject') {
  9908.                 $content $responseBody//stream goes to serializer
  9909.             } else {
  9910.                 $content $responseBody->getContents();
  9911.             }
  9912.             return [
  9913.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  9914.                 $response->getStatusCode(),
  9915.                 $response->getHeaders()
  9916.             ];
  9917.         } catch (ApiException $e) {
  9918.             switch ($e->getCode()) {
  9919.                 case 200:
  9920.                     $data AccountingObjectSerializer::deserialize(
  9921.                         $e->getResponseBody(),
  9922.                         '\XeroAPI\XeroPHP\Models\Accounting\Payments',
  9923.                         $e->getResponseHeaders()
  9924.                     );
  9925.                     $e->setResponseObject($data);
  9926.                     break;
  9927.                 case 400:
  9928.                     $data AccountingObjectSerializer::deserialize(
  9929.                         $e->getResponseBody(),
  9930.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  9931.                         $e->getResponseHeaders()
  9932.                     );
  9933.                     $e->setResponseObject($data);
  9934.                     break;
  9935.             }
  9936.             throw $e;
  9937.         }
  9938.     }
  9939.     /**
  9940.      * Operation createPaymentAsync
  9941.      * Creates a single payment for invoice or credit notes
  9942.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  9943.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Payment $payment Request body with a single Payment object (required)
  9944.      * @throws \InvalidArgumentException
  9945.      * @return \GuzzleHttp\Promise\PromiseInterface
  9946.      */
  9947.     public function createPaymentAsync($xero_tenant_id$payment)
  9948.     {
  9949.         return $this->createPaymentAsyncWithHttpInfo($xero_tenant_id$payment)
  9950.             ->then(
  9951.                 function ($response) {
  9952.                     return $response[0];
  9953.                 }
  9954.             );
  9955.     }
  9956.     /**
  9957.      * Operation createPaymentAsyncWithHttpInfo
  9958.      * Creates a single payment for invoice or credit notes
  9959.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  9960.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Payment $payment Request body with a single Payment object (required)
  9961.      * @throws \InvalidArgumentException
  9962.      * @return \GuzzleHttp\Promise\PromiseInterface */
  9963.     public function createPaymentAsyncWithHttpInfo($xero_tenant_id$payment)
  9964.     {
  9965.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Payments';
  9966.         $request $this->createPaymentRequest($xero_tenant_id$payment);
  9967.         return $this->client
  9968.             ->sendAsync($request$this->createHttpClientOption())
  9969.             ->then(
  9970.                 function ($response) use ($returnType) {
  9971.                     $responseBody $response->getBody();
  9972.                     if ($returnType === '\SplFileObject') {
  9973.                         $content $responseBody//stream goes to serializer
  9974.                     } else {
  9975.                         $content $responseBody->getContents();
  9976.                     }
  9977.                     return [
  9978.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  9979.                         $response->getStatusCode(),
  9980.                         $response->getHeaders()
  9981.                     ];
  9982.                 },
  9983.                 function ($exception) {
  9984.                     $response $exception->getResponse();
  9985.                     $statusCode $response->getStatusCode();
  9986.                     throw new ApiException(
  9987.                         sprintf(
  9988.                             '[%d] Error connecting to the API (%s)',
  9989.                             $statusCode,
  9990.                             $exception->getRequest()->getUri()
  9991.                         ),
  9992.                         $statusCode,
  9993.                         $response->getHeaders(),
  9994.                         $response->getBody()
  9995.                     );
  9996.                 }
  9997.             );
  9998.     }
  9999.     /**
  10000.      * Create request for operation 'createPayment'
  10001.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  10002.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Payment $payment Request body with a single Payment object (required)
  10003.      * @throws \InvalidArgumentException
  10004.      * @return \GuzzleHttp\Psr7\Request  */
  10005.     protected function createPaymentRequest($xero_tenant_id$payment)
  10006.     {
  10007.         // verify the required parameter 'xero_tenant_id' is set
  10008.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  10009.             throw new \InvalidArgumentException(
  10010.                 'Missing the required parameter $xero_tenant_id when calling createPayment'
  10011.             );
  10012.         }
  10013.         // verify the required parameter 'payment' is set
  10014.         if ($payment === null || (is_array($payment) && count($payment) === 0)) {
  10015.             throw new \InvalidArgumentException(
  10016.                 'Missing the required parameter $payment when calling createPayment'
  10017.             );
  10018.         }
  10019.         $resourcePath '/Payments';
  10020.         $formParams = [];
  10021.         $queryParams = [];
  10022.         $headerParams = [];
  10023.         $httpBody '';
  10024.         $multipart false;
  10025.         // header params
  10026.         if ($xero_tenant_id !== null) {
  10027.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  10028.         }
  10029.         // body params
  10030.         $_tempBody null;
  10031.         if (isset($payment)) {
  10032.             $_tempBody $payment;
  10033.         }
  10034.         if ($multipart) {
  10035.             $headers $this->headerSelector->selectHeadersForMultipart(
  10036.                 ['application/json']
  10037.             );
  10038.         } else {
  10039.             $headers $this->headerSelector->selectHeaders(
  10040.                 ['application/json'],
  10041.                 ['application/json']
  10042.             );
  10043.         }
  10044.         // for model (json/xml)
  10045.         if (isset($_tempBody)) {
  10046.             // $_tempBody is the method argument, if present
  10047.             if ($headers['Content-Type'] === 'application/json') {
  10048.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  10049.             } else {
  10050.                 $httpBody $_tempBody;
  10051.             }
  10052.         } elseif (count($formParams) > 0) {
  10053.             if ($multipart) {
  10054.                 $multipartContents = [
  10055.                     [
  10056.                         'Content-type' => 'multipart/form-data',
  10057.                     ]
  10058.                 ];
  10059.                 
  10060.                 // for HTTP post (form)
  10061.                 $httpBody = new MultipartStream($multipartContents);
  10062.             } elseif ($headers['Content-Type'] === 'application/json') {
  10063.                 $httpBody \GuzzleHttp\json_encode($formParams);
  10064.             } else {
  10065.                 // for HTTP post (form)
  10066.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  10067.             }
  10068.         }
  10069.         // this endpoint requires OAuth (access token)
  10070.         if ($this->config->getAccessToken() !== null) {
  10071.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  10072.         }
  10073.         $defaultHeaders = [];
  10074.         if ($this->config->getUserAgent()) {
  10075.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  10076.         }
  10077.         $headers array_merge(
  10078.             $defaultHeaders,
  10079.             $headerParams,
  10080.             $headers
  10081.         );
  10082.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  10083.         return new Request(
  10084.             'POST',
  10085.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  10086.             $headers,
  10087.             $httpBody
  10088.         );
  10089.     }
  10090.     /**
  10091.      * Operation createPaymentHistory
  10092.      * Creates a history record for a specific payment
  10093.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  10094.      * @param  string $payment_id Unique identifier for a Payment (required)
  10095.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  10096.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  10097.      * @throws \InvalidArgumentException
  10098.      * @return \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords|\XeroAPI\XeroPHP\Models\Accounting\Error
  10099.      */
  10100.     public function createPaymentHistory($xero_tenant_id$payment_id$history_records)
  10101.     {
  10102.         list($response) = $this->createPaymentHistoryWithHttpInfo($xero_tenant_id$payment_id$history_records);
  10103.         return $response;
  10104.     }
  10105.     /**
  10106.      * Operation createPaymentHistoryWithHttpInfo
  10107.      * Creates a history record for a specific payment
  10108.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  10109.      * @param  string $payment_id Unique identifier for a Payment (required)
  10110.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  10111.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  10112.      * @throws \InvalidArgumentException
  10113.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  10114.      */
  10115.     public function createPaymentHistoryWithHttpInfo($xero_tenant_id$payment_id$history_records)
  10116.     {
  10117.         $request $this->createPaymentHistoryRequest($xero_tenant_id$payment_id$history_records);
  10118.         try {
  10119.             $options $this->createHttpClientOption();
  10120.             try {
  10121.                 $response $this->client->send($request$options);
  10122.             } catch (RequestException $e) {
  10123.                 throw new ApiException(
  10124.                     "[{$e->getCode()}{$e->getMessage()}",
  10125.                     $e->getCode(),
  10126.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  10127.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  10128.                 );
  10129.             }
  10130.             $statusCode $response->getStatusCode();
  10131.             if ($statusCode 200 || $statusCode 299) {
  10132.                 throw new ApiException(
  10133.                     sprintf(
  10134.                         '[%d] Error connecting to the API (%s)',
  10135.                         $statusCode,
  10136.                         $request->getUri()
  10137.                     ),
  10138.                     $statusCode,
  10139.                     $response->getHeaders(),
  10140.                     $response->getBody()
  10141.                 );
  10142.             }
  10143.             $responseBody $response->getBody();
  10144.             switch($statusCode) {
  10145.                 case 200:
  10146.                     if ('\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords' === '\SplFileObject') {
  10147.                         $content $responseBody//stream goes to serializer
  10148.                     } else {
  10149.                         $content $responseBody->getContents();
  10150.                     }
  10151.                     return [
  10152.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords', []),
  10153.                         $response->getStatusCode(),
  10154.                         $response->getHeaders()
  10155.                     ];
  10156.                 case 400:
  10157.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  10158.                         $content $responseBody//stream goes to serializer
  10159.                     } else {
  10160.                         $content $responseBody->getContents();
  10161.                     }
  10162.                     return [
  10163.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  10164.                         $response->getStatusCode(),
  10165.                         $response->getHeaders()
  10166.                     ];
  10167.             }
  10168.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  10169.             $responseBody $response->getBody();
  10170.             if ($returnType === '\SplFileObject') {
  10171.                 $content $responseBody//stream goes to serializer
  10172.             } else {
  10173.                 $content $responseBody->getContents();
  10174.             }
  10175.             return [
  10176.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  10177.                 $response->getStatusCode(),
  10178.                 $response->getHeaders()
  10179.             ];
  10180.         } catch (ApiException $e) {
  10181.             switch ($e->getCode()) {
  10182.                 case 200:
  10183.                     $data AccountingObjectSerializer::deserialize(
  10184.                         $e->getResponseBody(),
  10185.                         '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords',
  10186.                         $e->getResponseHeaders()
  10187.                     );
  10188.                     $e->setResponseObject($data);
  10189.                     break;
  10190.                 case 400:
  10191.                     $data AccountingObjectSerializer::deserialize(
  10192.                         $e->getResponseBody(),
  10193.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  10194.                         $e->getResponseHeaders()
  10195.                     );
  10196.                     $e->setResponseObject($data);
  10197.                     break;
  10198.             }
  10199.             throw $e;
  10200.         }
  10201.     }
  10202.     /**
  10203.      * Operation createPaymentHistoryAsync
  10204.      * Creates a history record for a specific payment
  10205.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  10206.      * @param  string $payment_id Unique identifier for a Payment (required)
  10207.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  10208.      * @throws \InvalidArgumentException
  10209.      * @return \GuzzleHttp\Promise\PromiseInterface
  10210.      */
  10211.     public function createPaymentHistoryAsync($xero_tenant_id$payment_id$history_records)
  10212.     {
  10213.         return $this->createPaymentHistoryAsyncWithHttpInfo($xero_tenant_id$payment_id$history_records)
  10214.             ->then(
  10215.                 function ($response) {
  10216.                     return $response[0];
  10217.                 }
  10218.             );
  10219.     }
  10220.     /**
  10221.      * Operation createPaymentHistoryAsyncWithHttpInfo
  10222.      * Creates a history record for a specific payment
  10223.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  10224.      * @param  string $payment_id Unique identifier for a Payment (required)
  10225.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  10226.      * @throws \InvalidArgumentException
  10227.      * @return \GuzzleHttp\Promise\PromiseInterface */
  10228.     public function createPaymentHistoryAsyncWithHttpInfo($xero_tenant_id$payment_id$history_records)
  10229.     {
  10230.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  10231.         $request $this->createPaymentHistoryRequest($xero_tenant_id$payment_id$history_records);
  10232.         return $this->client
  10233.             ->sendAsync($request$this->createHttpClientOption())
  10234.             ->then(
  10235.                 function ($response) use ($returnType) {
  10236.                     $responseBody $response->getBody();
  10237.                     if ($returnType === '\SplFileObject') {
  10238.                         $content $responseBody//stream goes to serializer
  10239.                     } else {
  10240.                         $content $responseBody->getContents();
  10241.                     }
  10242.                     return [
  10243.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  10244.                         $response->getStatusCode(),
  10245.                         $response->getHeaders()
  10246.                     ];
  10247.                 },
  10248.                 function ($exception) {
  10249.                     $response $exception->getResponse();
  10250.                     $statusCode $response->getStatusCode();
  10251.                     throw new ApiException(
  10252.                         sprintf(
  10253.                             '[%d] Error connecting to the API (%s)',
  10254.                             $statusCode,
  10255.                             $exception->getRequest()->getUri()
  10256.                         ),
  10257.                         $statusCode,
  10258.                         $response->getHeaders(),
  10259.                         $response->getBody()
  10260.                     );
  10261.                 }
  10262.             );
  10263.     }
  10264.     /**
  10265.      * Create request for operation 'createPaymentHistory'
  10266.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  10267.      * @param  string $payment_id Unique identifier for a Payment (required)
  10268.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  10269.      * @throws \InvalidArgumentException
  10270.      * @return \GuzzleHttp\Psr7\Request  */
  10271.     protected function createPaymentHistoryRequest($xero_tenant_id$payment_id$history_records)
  10272.     {
  10273.         // verify the required parameter 'xero_tenant_id' is set
  10274.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  10275.             throw new \InvalidArgumentException(
  10276.                 'Missing the required parameter $xero_tenant_id when calling createPaymentHistory'
  10277.             );
  10278.         }
  10279.         // verify the required parameter 'payment_id' is set
  10280.         if ($payment_id === null || (is_array($payment_id) && count($payment_id) === 0)) {
  10281.             throw new \InvalidArgumentException(
  10282.                 'Missing the required parameter $payment_id when calling createPaymentHistory'
  10283.             );
  10284.         }
  10285.         // verify the required parameter 'history_records' is set
  10286.         if ($history_records === null || (is_array($history_records) && count($history_records) === 0)) {
  10287.             throw new \InvalidArgumentException(
  10288.                 'Missing the required parameter $history_records when calling createPaymentHistory'
  10289.             );
  10290.         }
  10291.         $resourcePath '/Payments/{PaymentID}/History';
  10292.         $formParams = [];
  10293.         $queryParams = [];
  10294.         $headerParams = [];
  10295.         $httpBody '';
  10296.         $multipart false;
  10297.         // header params
  10298.         if ($xero_tenant_id !== null) {
  10299.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  10300.         }
  10301.         // path params
  10302.         if ($payment_id !== null) {
  10303.             $resourcePath str_replace(
  10304.                 '{' 'PaymentID' '}',
  10305.                 AccountingObjectSerializer::toPathValue($payment_id),
  10306.                 $resourcePath
  10307.             );
  10308.         }
  10309.         // body params
  10310.         $_tempBody null;
  10311.         if (isset($history_records)) {
  10312.             $_tempBody $history_records;
  10313.         }
  10314.         if ($multipart) {
  10315.             $headers $this->headerSelector->selectHeadersForMultipart(
  10316.                 ['application/json']
  10317.             );
  10318.         } else {
  10319.             $headers $this->headerSelector->selectHeaders(
  10320.                 ['application/json'],
  10321.                 ['application/json']
  10322.             );
  10323.         }
  10324.         // for model (json/xml)
  10325.         if (isset($_tempBody)) {
  10326.             // $_tempBody is the method argument, if present
  10327.             if ($headers['Content-Type'] === 'application/json') {
  10328.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  10329.             } else {
  10330.                 $httpBody $_tempBody;
  10331.             }
  10332.         } elseif (count($formParams) > 0) {
  10333.             if ($multipart) {
  10334.                 $multipartContents = [
  10335.                     [
  10336.                         'Content-type' => 'multipart/form-data',
  10337.                     ]
  10338.                 ];
  10339.                 
  10340.                 // for HTTP post (form)
  10341.                 $httpBody = new MultipartStream($multipartContents);
  10342.             } elseif ($headers['Content-Type'] === 'application/json') {
  10343.                 $httpBody \GuzzleHttp\json_encode($formParams);
  10344.             } else {
  10345.                 // for HTTP post (form)
  10346.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  10347.             }
  10348.         }
  10349.         // this endpoint requires OAuth (access token)
  10350.         if ($this->config->getAccessToken() !== null) {
  10351.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  10352.         }
  10353.         $defaultHeaders = [];
  10354.         if ($this->config->getUserAgent()) {
  10355.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  10356.         }
  10357.         $headers array_merge(
  10358.             $defaultHeaders,
  10359.             $headerParams,
  10360.             $headers
  10361.         );
  10362.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  10363.         return new Request(
  10364.             'PUT',
  10365.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  10366.             $headers,
  10367.             $httpBody
  10368.         );
  10369.     }
  10370.     /**
  10371.      * Operation createPaymentService
  10372.      * Creates a payment service
  10373.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  10374.      * @param  \XeroAPI\XeroPHP\Models\Accounting\PaymentServices $payment_services PaymentServices array with PaymentService object in body of request (required)
  10375.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  10376.      * @throws \InvalidArgumentException
  10377.      * @return \XeroAPI\XeroPHP\Models\Accounting\PaymentServices|\XeroAPI\XeroPHP\Models\Accounting\Error
  10378.      */
  10379.     public function createPaymentService($xero_tenant_id$payment_services)
  10380.     {
  10381.         list($response) = $this->createPaymentServiceWithHttpInfo($xero_tenant_id$payment_services);
  10382.         return $response;
  10383.     }
  10384.     /**
  10385.      * Operation createPaymentServiceWithHttpInfo
  10386.      * Creates a payment service
  10387.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  10388.      * @param  \XeroAPI\XeroPHP\Models\Accounting\PaymentServices $payment_services PaymentServices array with PaymentService object in body of request (required)
  10389.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  10390.      * @throws \InvalidArgumentException
  10391.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\PaymentServices|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  10392.      */
  10393.     public function createPaymentServiceWithHttpInfo($xero_tenant_id$payment_services)
  10394.     {
  10395.         $request $this->createPaymentServiceRequest($xero_tenant_id$payment_services);
  10396.         try {
  10397.             $options $this->createHttpClientOption();
  10398.             try {
  10399.                 $response $this->client->send($request$options);
  10400.             } catch (RequestException $e) {
  10401.                 throw new ApiException(
  10402.                     "[{$e->getCode()}{$e->getMessage()}",
  10403.                     $e->getCode(),
  10404.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  10405.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  10406.                 );
  10407.             }
  10408.             $statusCode $response->getStatusCode();
  10409.             if ($statusCode 200 || $statusCode 299) {
  10410.                 throw new ApiException(
  10411.                     sprintf(
  10412.                         '[%d] Error connecting to the API (%s)',
  10413.                         $statusCode,
  10414.                         $request->getUri()
  10415.                     ),
  10416.                     $statusCode,
  10417.                     $response->getHeaders(),
  10418.                     $response->getBody()
  10419.                 );
  10420.             }
  10421.             $responseBody $response->getBody();
  10422.             switch($statusCode) {
  10423.                 case 200:
  10424.                     if ('\XeroAPI\XeroPHP\Models\Accounting\PaymentServices' === '\SplFileObject') {
  10425.                         $content $responseBody//stream goes to serializer
  10426.                     } else {
  10427.                         $content $responseBody->getContents();
  10428.                     }
  10429.                     return [
  10430.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\PaymentServices', []),
  10431.                         $response->getStatusCode(),
  10432.                         $response->getHeaders()
  10433.                     ];
  10434.                 case 400:
  10435.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  10436.                         $content $responseBody//stream goes to serializer
  10437.                     } else {
  10438.                         $content $responseBody->getContents();
  10439.                     }
  10440.                     return [
  10441.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  10442.                         $response->getStatusCode(),
  10443.                         $response->getHeaders()
  10444.                     ];
  10445.             }
  10446.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\PaymentServices';
  10447.             $responseBody $response->getBody();
  10448.             if ($returnType === '\SplFileObject') {
  10449.                 $content $responseBody//stream goes to serializer
  10450.             } else {
  10451.                 $content $responseBody->getContents();
  10452.             }
  10453.             return [
  10454.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  10455.                 $response->getStatusCode(),
  10456.                 $response->getHeaders()
  10457.             ];
  10458.         } catch (ApiException $e) {
  10459.             switch ($e->getCode()) {
  10460.                 case 200:
  10461.                     $data AccountingObjectSerializer::deserialize(
  10462.                         $e->getResponseBody(),
  10463.                         '\XeroAPI\XeroPHP\Models\Accounting\PaymentServices',
  10464.                         $e->getResponseHeaders()
  10465.                     );
  10466.                     $e->setResponseObject($data);
  10467.                     break;
  10468.                 case 400:
  10469.                     $data AccountingObjectSerializer::deserialize(
  10470.                         $e->getResponseBody(),
  10471.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  10472.                         $e->getResponseHeaders()
  10473.                     );
  10474.                     $e->setResponseObject($data);
  10475.                     break;
  10476.             }
  10477.             throw $e;
  10478.         }
  10479.     }
  10480.     /**
  10481.      * Operation createPaymentServiceAsync
  10482.      * Creates a payment service
  10483.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  10484.      * @param  \XeroAPI\XeroPHP\Models\Accounting\PaymentServices $payment_services PaymentServices array with PaymentService object in body of request (required)
  10485.      * @throws \InvalidArgumentException
  10486.      * @return \GuzzleHttp\Promise\PromiseInterface
  10487.      */
  10488.     public function createPaymentServiceAsync($xero_tenant_id$payment_services)
  10489.     {
  10490.         return $this->createPaymentServiceAsyncWithHttpInfo($xero_tenant_id$payment_services)
  10491.             ->then(
  10492.                 function ($response) {
  10493.                     return $response[0];
  10494.                 }
  10495.             );
  10496.     }
  10497.     /**
  10498.      * Operation createPaymentServiceAsyncWithHttpInfo
  10499.      * Creates a payment service
  10500.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  10501.      * @param  \XeroAPI\XeroPHP\Models\Accounting\PaymentServices $payment_services PaymentServices array with PaymentService object in body of request (required)
  10502.      * @throws \InvalidArgumentException
  10503.      * @return \GuzzleHttp\Promise\PromiseInterface */
  10504.     public function createPaymentServiceAsyncWithHttpInfo($xero_tenant_id$payment_services)
  10505.     {
  10506.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\PaymentServices';
  10507.         $request $this->createPaymentServiceRequest($xero_tenant_id$payment_services);
  10508.         return $this->client
  10509.             ->sendAsync($request$this->createHttpClientOption())
  10510.             ->then(
  10511.                 function ($response) use ($returnType) {
  10512.                     $responseBody $response->getBody();
  10513.                     if ($returnType === '\SplFileObject') {
  10514.                         $content $responseBody//stream goes to serializer
  10515.                     } else {
  10516.                         $content $responseBody->getContents();
  10517.                     }
  10518.                     return [
  10519.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  10520.                         $response->getStatusCode(),
  10521.                         $response->getHeaders()
  10522.                     ];
  10523.                 },
  10524.                 function ($exception) {
  10525.                     $response $exception->getResponse();
  10526.                     $statusCode $response->getStatusCode();
  10527.                     throw new ApiException(
  10528.                         sprintf(
  10529.                             '[%d] Error connecting to the API (%s)',
  10530.                             $statusCode,
  10531.                             $exception->getRequest()->getUri()
  10532.                         ),
  10533.                         $statusCode,
  10534.                         $response->getHeaders(),
  10535.                         $response->getBody()
  10536.                     );
  10537.                 }
  10538.             );
  10539.     }
  10540.     /**
  10541.      * Create request for operation 'createPaymentService'
  10542.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  10543.      * @param  \XeroAPI\XeroPHP\Models\Accounting\PaymentServices $payment_services PaymentServices array with PaymentService object in body of request (required)
  10544.      * @throws \InvalidArgumentException
  10545.      * @return \GuzzleHttp\Psr7\Request  */
  10546.     protected function createPaymentServiceRequest($xero_tenant_id$payment_services)
  10547.     {
  10548.         // verify the required parameter 'xero_tenant_id' is set
  10549.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  10550.             throw new \InvalidArgumentException(
  10551.                 'Missing the required parameter $xero_tenant_id when calling createPaymentService'
  10552.             );
  10553.         }
  10554.         // verify the required parameter 'payment_services' is set
  10555.         if ($payment_services === null || (is_array($payment_services) && count($payment_services) === 0)) {
  10556.             throw new \InvalidArgumentException(
  10557.                 'Missing the required parameter $payment_services when calling createPaymentService'
  10558.             );
  10559.         }
  10560.         $resourcePath '/PaymentServices';
  10561.         $formParams = [];
  10562.         $queryParams = [];
  10563.         $headerParams = [];
  10564.         $httpBody '';
  10565.         $multipart false;
  10566.         // header params
  10567.         if ($xero_tenant_id !== null) {
  10568.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  10569.         }
  10570.         // body params
  10571.         $_tempBody null;
  10572.         if (isset($payment_services)) {
  10573.             $_tempBody $payment_services;
  10574.         }
  10575.         if ($multipart) {
  10576.             $headers $this->headerSelector->selectHeadersForMultipart(
  10577.                 ['application/json']
  10578.             );
  10579.         } else {
  10580.             $headers $this->headerSelector->selectHeaders(
  10581.                 ['application/json'],
  10582.                 ['application/json']
  10583.             );
  10584.         }
  10585.         // for model (json/xml)
  10586.         if (isset($_tempBody)) {
  10587.             // $_tempBody is the method argument, if present
  10588.             if ($headers['Content-Type'] === 'application/json') {
  10589.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  10590.             } else {
  10591.                 $httpBody $_tempBody;
  10592.             }
  10593.         } elseif (count($formParams) > 0) {
  10594.             if ($multipart) {
  10595.                 $multipartContents = [
  10596.                     [
  10597.                         'Content-type' => 'multipart/form-data',
  10598.                     ]
  10599.                 ];
  10600.                 
  10601.                 // for HTTP post (form)
  10602.                 $httpBody = new MultipartStream($multipartContents);
  10603.             } elseif ($headers['Content-Type'] === 'application/json') {
  10604.                 $httpBody \GuzzleHttp\json_encode($formParams);
  10605.             } else {
  10606.                 // for HTTP post (form)
  10607.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  10608.             }
  10609.         }
  10610.         // this endpoint requires OAuth (access token)
  10611.         if ($this->config->getAccessToken() !== null) {
  10612.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  10613.         }
  10614.         $defaultHeaders = [];
  10615.         if ($this->config->getUserAgent()) {
  10616.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  10617.         }
  10618.         $headers array_merge(
  10619.             $defaultHeaders,
  10620.             $headerParams,
  10621.             $headers
  10622.         );
  10623.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  10624.         return new Request(
  10625.             'PUT',
  10626.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  10627.             $headers,
  10628.             $httpBody
  10629.         );
  10630.     }
  10631.     /**
  10632.      * Operation createPayments
  10633.      * Creates multiple payments for invoices or credit notes
  10634.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  10635.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Payments $payments Payments array with Payment object in body of request (required)
  10636.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  10637.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  10638.      * @throws \InvalidArgumentException
  10639.      * @return \XeroAPI\XeroPHP\Models\Accounting\Payments|\XeroAPI\XeroPHP\Models\Accounting\Error
  10640.      */
  10641.     public function createPayments($xero_tenant_id$payments$summarize_errors false)
  10642.     {
  10643.         list($response) = $this->createPaymentsWithHttpInfo($xero_tenant_id$payments$summarize_errors);
  10644.         return $response;
  10645.     }
  10646.     /**
  10647.      * Operation createPaymentsWithHttpInfo
  10648.      * Creates multiple payments for invoices or credit notes
  10649.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  10650.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Payments $payments Payments array with Payment object in body of request (required)
  10651.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  10652.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  10653.      * @throws \InvalidArgumentException
  10654.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Payments|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  10655.      */
  10656.     public function createPaymentsWithHttpInfo($xero_tenant_id$payments$summarize_errors false)
  10657.     {
  10658.         $request $this->createPaymentsRequest($xero_tenant_id$payments$summarize_errors);
  10659.         try {
  10660.             $options $this->createHttpClientOption();
  10661.             try {
  10662.                 $response $this->client->send($request$options);
  10663.             } catch (RequestException $e) {
  10664.                 throw new ApiException(
  10665.                     "[{$e->getCode()}{$e->getMessage()}",
  10666.                     $e->getCode(),
  10667.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  10668.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  10669.                 );
  10670.             }
  10671.             $statusCode $response->getStatusCode();
  10672.             if ($statusCode 200 || $statusCode 299) {
  10673.                 throw new ApiException(
  10674.                     sprintf(
  10675.                         '[%d] Error connecting to the API (%s)',
  10676.                         $statusCode,
  10677.                         $request->getUri()
  10678.                     ),
  10679.                     $statusCode,
  10680.                     $response->getHeaders(),
  10681.                     $response->getBody()
  10682.                 );
  10683.             }
  10684.             $responseBody $response->getBody();
  10685.             switch($statusCode) {
  10686.                 case 200:
  10687.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Payments' === '\SplFileObject') {
  10688.                         $content $responseBody//stream goes to serializer
  10689.                     } else {
  10690.                         $content $responseBody->getContents();
  10691.                     }
  10692.                     return [
  10693.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Payments', []),
  10694.                         $response->getStatusCode(),
  10695.                         $response->getHeaders()
  10696.                     ];
  10697.                 case 400:
  10698.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  10699.                         $content $responseBody//stream goes to serializer
  10700.                     } else {
  10701.                         $content $responseBody->getContents();
  10702.                     }
  10703.                     return [
  10704.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  10705.                         $response->getStatusCode(),
  10706.                         $response->getHeaders()
  10707.                     ];
  10708.             }
  10709.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Payments';
  10710.             $responseBody $response->getBody();
  10711.             if ($returnType === '\SplFileObject') {
  10712.                 $content $responseBody//stream goes to serializer
  10713.             } else {
  10714.                 $content $responseBody->getContents();
  10715.             }
  10716.             return [
  10717.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  10718.                 $response->getStatusCode(),
  10719.                 $response->getHeaders()
  10720.             ];
  10721.         } catch (ApiException $e) {
  10722.             switch ($e->getCode()) {
  10723.                 case 200:
  10724.                     $data AccountingObjectSerializer::deserialize(
  10725.                         $e->getResponseBody(),
  10726.                         '\XeroAPI\XeroPHP\Models\Accounting\Payments',
  10727.                         $e->getResponseHeaders()
  10728.                     );
  10729.                     $e->setResponseObject($data);
  10730.                     break;
  10731.                 case 400:
  10732.                     $data AccountingObjectSerializer::deserialize(
  10733.                         $e->getResponseBody(),
  10734.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  10735.                         $e->getResponseHeaders()
  10736.                     );
  10737.                     $e->setResponseObject($data);
  10738.                     break;
  10739.             }
  10740.             throw $e;
  10741.         }
  10742.     }
  10743.     /**
  10744.      * Operation createPaymentsAsync
  10745.      * Creates multiple payments for invoices or credit notes
  10746.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  10747.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Payments $payments Payments array with Payment object in body of request (required)
  10748.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  10749.      * @throws \InvalidArgumentException
  10750.      * @return \GuzzleHttp\Promise\PromiseInterface
  10751.      */
  10752.     public function createPaymentsAsync($xero_tenant_id$payments$summarize_errors false)
  10753.     {
  10754.         return $this->createPaymentsAsyncWithHttpInfo($xero_tenant_id$payments$summarize_errors)
  10755.             ->then(
  10756.                 function ($response) {
  10757.                     return $response[0];
  10758.                 }
  10759.             );
  10760.     }
  10761.     /**
  10762.      * Operation createPaymentsAsyncWithHttpInfo
  10763.      * Creates multiple payments for invoices or credit notes
  10764.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  10765.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Payments $payments Payments array with Payment object in body of request (required)
  10766.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  10767.      * @throws \InvalidArgumentException
  10768.      * @return \GuzzleHttp\Promise\PromiseInterface */
  10769.     public function createPaymentsAsyncWithHttpInfo($xero_tenant_id$payments$summarize_errors false)
  10770.     {
  10771.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Payments';
  10772.         $request $this->createPaymentsRequest($xero_tenant_id$payments$summarize_errors);
  10773.         return $this->client
  10774.             ->sendAsync($request$this->createHttpClientOption())
  10775.             ->then(
  10776.                 function ($response) use ($returnType) {
  10777.                     $responseBody $response->getBody();
  10778.                     if ($returnType === '\SplFileObject') {
  10779.                         $content $responseBody//stream goes to serializer
  10780.                     } else {
  10781.                         $content $responseBody->getContents();
  10782.                     }
  10783.                     return [
  10784.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  10785.                         $response->getStatusCode(),
  10786.                         $response->getHeaders()
  10787.                     ];
  10788.                 },
  10789.                 function ($exception) {
  10790.                     $response $exception->getResponse();
  10791.                     $statusCode $response->getStatusCode();
  10792.                     throw new ApiException(
  10793.                         sprintf(
  10794.                             '[%d] Error connecting to the API (%s)',
  10795.                             $statusCode,
  10796.                             $exception->getRequest()->getUri()
  10797.                         ),
  10798.                         $statusCode,
  10799.                         $response->getHeaders(),
  10800.                         $response->getBody()
  10801.                     );
  10802.                 }
  10803.             );
  10804.     }
  10805.     /**
  10806.      * Create request for operation 'createPayments'
  10807.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  10808.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Payments $payments Payments array with Payment object in body of request (required)
  10809.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  10810.      * @throws \InvalidArgumentException
  10811.      * @return \GuzzleHttp\Psr7\Request  */
  10812.     protected function createPaymentsRequest($xero_tenant_id$payments$summarize_errors false)
  10813.     {
  10814.         // verify the required parameter 'xero_tenant_id' is set
  10815.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  10816.             throw new \InvalidArgumentException(
  10817.                 'Missing the required parameter $xero_tenant_id when calling createPayments'
  10818.             );
  10819.         }
  10820.         // verify the required parameter 'payments' is set
  10821.         if ($payments === null || (is_array($payments) && count($payments) === 0)) {
  10822.             throw new \InvalidArgumentException(
  10823.                 'Missing the required parameter $payments when calling createPayments'
  10824.             );
  10825.         }
  10826.         $resourcePath '/Payments';
  10827.         $formParams = [];
  10828.         $queryParams = [];
  10829.         $headerParams = [];
  10830.         $httpBody '';
  10831.         $multipart false;
  10832.         // query params
  10833.         if ($summarize_errors !== null) {
  10834.             $queryParams['summarizeErrors'] = $summarize_errors 'true' 'false';
  10835.         }
  10836.         // header params
  10837.         if ($xero_tenant_id !== null) {
  10838.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  10839.         }
  10840.         // body params
  10841.         $_tempBody null;
  10842.         if (isset($payments)) {
  10843.             $_tempBody $payments;
  10844.         }
  10845.         if ($multipart) {
  10846.             $headers $this->headerSelector->selectHeadersForMultipart(
  10847.                 ['application/json']
  10848.             );
  10849.         } else {
  10850.             $headers $this->headerSelector->selectHeaders(
  10851.                 ['application/json'],
  10852.                 ['application/json']
  10853.             );
  10854.         }
  10855.         // for model (json/xml)
  10856.         if (isset($_tempBody)) {
  10857.             // $_tempBody is the method argument, if present
  10858.             if ($headers['Content-Type'] === 'application/json') {
  10859.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  10860.             } else {
  10861.                 $httpBody $_tempBody;
  10862.             }
  10863.         } elseif (count($formParams) > 0) {
  10864.             if ($multipart) {
  10865.                 $multipartContents = [
  10866.                     [
  10867.                         'Content-type' => 'multipart/form-data',
  10868.                     ]
  10869.                 ];
  10870.                 
  10871.                 // for HTTP post (form)
  10872.                 $httpBody = new MultipartStream($multipartContents);
  10873.             } elseif ($headers['Content-Type'] === 'application/json') {
  10874.                 $httpBody \GuzzleHttp\json_encode($formParams);
  10875.             } else {
  10876.                 // for HTTP post (form)
  10877.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  10878.             }
  10879.         }
  10880.         // this endpoint requires OAuth (access token)
  10881.         if ($this->config->getAccessToken() !== null) {
  10882.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  10883.         }
  10884.         $defaultHeaders = [];
  10885.         if ($this->config->getUserAgent()) {
  10886.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  10887.         }
  10888.         $headers array_merge(
  10889.             $defaultHeaders,
  10890.             $headerParams,
  10891.             $headers
  10892.         );
  10893.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  10894.         return new Request(
  10895.             'PUT',
  10896.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  10897.             $headers,
  10898.             $httpBody
  10899.         );
  10900.     }
  10901.     /**
  10902.      * Operation createPrepaymentAllocations
  10903.      * Allows you to create an Allocation for prepayments
  10904.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  10905.      * @param  string $prepayment_id Unique identifier for a PrePayment (required)
  10906.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Allocations $allocations Allocations with an array of Allocation object in body of request (required)
  10907.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  10908.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  10909.      * @throws \InvalidArgumentException
  10910.      * @return \XeroAPI\XeroPHP\Models\Accounting\Allocations|\XeroAPI\XeroPHP\Models\Accounting\Error
  10911.      */
  10912.     public function createPrepaymentAllocations($xero_tenant_id$prepayment_id$allocations$summarize_errors false)
  10913.     {
  10914.         list($response) = $this->createPrepaymentAllocationsWithHttpInfo($xero_tenant_id$prepayment_id$allocations$summarize_errors);
  10915.         return $response;
  10916.     }
  10917.     /**
  10918.      * Operation createPrepaymentAllocationsWithHttpInfo
  10919.      * Allows you to create an Allocation for prepayments
  10920.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  10921.      * @param  string $prepayment_id Unique identifier for a PrePayment (required)
  10922.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Allocations $allocations Allocations with an array of Allocation object in body of request (required)
  10923.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  10924.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  10925.      * @throws \InvalidArgumentException
  10926.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Allocations|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  10927.      */
  10928.     public function createPrepaymentAllocationsWithHttpInfo($xero_tenant_id$prepayment_id$allocations$summarize_errors false)
  10929.     {
  10930.         $request $this->createPrepaymentAllocationsRequest($xero_tenant_id$prepayment_id$allocations$summarize_errors);
  10931.         try {
  10932.             $options $this->createHttpClientOption();
  10933.             try {
  10934.                 $response $this->client->send($request$options);
  10935.             } catch (RequestException $e) {
  10936.                 throw new ApiException(
  10937.                     "[{$e->getCode()}{$e->getMessage()}",
  10938.                     $e->getCode(),
  10939.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  10940.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  10941.                 );
  10942.             }
  10943.             $statusCode $response->getStatusCode();
  10944.             if ($statusCode 200 || $statusCode 299) {
  10945.                 throw new ApiException(
  10946.                     sprintf(
  10947.                         '[%d] Error connecting to the API (%s)',
  10948.                         $statusCode,
  10949.                         $request->getUri()
  10950.                     ),
  10951.                     $statusCode,
  10952.                     $response->getHeaders(),
  10953.                     $response->getBody()
  10954.                 );
  10955.             }
  10956.             $responseBody $response->getBody();
  10957.             switch($statusCode) {
  10958.                 case 200:
  10959.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Allocations' === '\SplFileObject') {
  10960.                         $content $responseBody//stream goes to serializer
  10961.                     } else {
  10962.                         $content $responseBody->getContents();
  10963.                     }
  10964.                     return [
  10965.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Allocations', []),
  10966.                         $response->getStatusCode(),
  10967.                         $response->getHeaders()
  10968.                     ];
  10969.                 case 400:
  10970.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  10971.                         $content $responseBody//stream goes to serializer
  10972.                     } else {
  10973.                         $content $responseBody->getContents();
  10974.                     }
  10975.                     return [
  10976.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  10977.                         $response->getStatusCode(),
  10978.                         $response->getHeaders()
  10979.                     ];
  10980.             }
  10981.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Allocations';
  10982.             $responseBody $response->getBody();
  10983.             if ($returnType === '\SplFileObject') {
  10984.                 $content $responseBody//stream goes to serializer
  10985.             } else {
  10986.                 $content $responseBody->getContents();
  10987.             }
  10988.             return [
  10989.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  10990.                 $response->getStatusCode(),
  10991.                 $response->getHeaders()
  10992.             ];
  10993.         } catch (ApiException $e) {
  10994.             switch ($e->getCode()) {
  10995.                 case 200:
  10996.                     $data AccountingObjectSerializer::deserialize(
  10997.                         $e->getResponseBody(),
  10998.                         '\XeroAPI\XeroPHP\Models\Accounting\Allocations',
  10999.                         $e->getResponseHeaders()
  11000.                     );
  11001.                     $e->setResponseObject($data);
  11002.                     break;
  11003.                 case 400:
  11004.                     $data AccountingObjectSerializer::deserialize(
  11005.                         $e->getResponseBody(),
  11006.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  11007.                         $e->getResponseHeaders()
  11008.                     );
  11009.                     $e->setResponseObject($data);
  11010.                     break;
  11011.             }
  11012.             throw $e;
  11013.         }
  11014.     }
  11015.     /**
  11016.      * Operation createPrepaymentAllocationsAsync
  11017.      * Allows you to create an Allocation for prepayments
  11018.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  11019.      * @param  string $prepayment_id Unique identifier for a PrePayment (required)
  11020.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Allocations $allocations Allocations with an array of Allocation object in body of request (required)
  11021.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  11022.      * @throws \InvalidArgumentException
  11023.      * @return \GuzzleHttp\Promise\PromiseInterface
  11024.      */
  11025.     public function createPrepaymentAllocationsAsync($xero_tenant_id$prepayment_id$allocations$summarize_errors false)
  11026.     {
  11027.         return $this->createPrepaymentAllocationsAsyncWithHttpInfo($xero_tenant_id$prepayment_id$allocations$summarize_errors)
  11028.             ->then(
  11029.                 function ($response) {
  11030.                     return $response[0];
  11031.                 }
  11032.             );
  11033.     }
  11034.     /**
  11035.      * Operation createPrepaymentAllocationsAsyncWithHttpInfo
  11036.      * Allows you to create an Allocation for prepayments
  11037.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  11038.      * @param  string $prepayment_id Unique identifier for a PrePayment (required)
  11039.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Allocations $allocations Allocations with an array of Allocation object in body of request (required)
  11040.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  11041.      * @throws \InvalidArgumentException
  11042.      * @return \GuzzleHttp\Promise\PromiseInterface */
  11043.     public function createPrepaymentAllocationsAsyncWithHttpInfo($xero_tenant_id$prepayment_id$allocations$summarize_errors false)
  11044.     {
  11045.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Allocations';
  11046.         $request $this->createPrepaymentAllocationsRequest($xero_tenant_id$prepayment_id$allocations$summarize_errors);
  11047.         return $this->client
  11048.             ->sendAsync($request$this->createHttpClientOption())
  11049.             ->then(
  11050.                 function ($response) use ($returnType) {
  11051.                     $responseBody $response->getBody();
  11052.                     if ($returnType === '\SplFileObject') {
  11053.                         $content $responseBody//stream goes to serializer
  11054.                     } else {
  11055.                         $content $responseBody->getContents();
  11056.                     }
  11057.                     return [
  11058.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  11059.                         $response->getStatusCode(),
  11060.                         $response->getHeaders()
  11061.                     ];
  11062.                 },
  11063.                 function ($exception) {
  11064.                     $response $exception->getResponse();
  11065.                     $statusCode $response->getStatusCode();
  11066.                     throw new ApiException(
  11067.                         sprintf(
  11068.                             '[%d] Error connecting to the API (%s)',
  11069.                             $statusCode,
  11070.                             $exception->getRequest()->getUri()
  11071.                         ),
  11072.                         $statusCode,
  11073.                         $response->getHeaders(),
  11074.                         $response->getBody()
  11075.                     );
  11076.                 }
  11077.             );
  11078.     }
  11079.     /**
  11080.      * Create request for operation 'createPrepaymentAllocations'
  11081.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  11082.      * @param  string $prepayment_id Unique identifier for a PrePayment (required)
  11083.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Allocations $allocations Allocations with an array of Allocation object in body of request (required)
  11084.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  11085.      * @throws \InvalidArgumentException
  11086.      * @return \GuzzleHttp\Psr7\Request  */
  11087.     protected function createPrepaymentAllocationsRequest($xero_tenant_id$prepayment_id$allocations$summarize_errors false)
  11088.     {
  11089.         // verify the required parameter 'xero_tenant_id' is set
  11090.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  11091.             throw new \InvalidArgumentException(
  11092.                 'Missing the required parameter $xero_tenant_id when calling createPrepaymentAllocations'
  11093.             );
  11094.         }
  11095.         // verify the required parameter 'prepayment_id' is set
  11096.         if ($prepayment_id === null || (is_array($prepayment_id) && count($prepayment_id) === 0)) {
  11097.             throw new \InvalidArgumentException(
  11098.                 'Missing the required parameter $prepayment_id when calling createPrepaymentAllocations'
  11099.             );
  11100.         }
  11101.         // verify the required parameter 'allocations' is set
  11102.         if ($allocations === null || (is_array($allocations) && count($allocations) === 0)) {
  11103.             throw new \InvalidArgumentException(
  11104.                 'Missing the required parameter $allocations when calling createPrepaymentAllocations'
  11105.             );
  11106.         }
  11107.         $resourcePath '/Prepayments/{PrepaymentID}/Allocations';
  11108.         $formParams = [];
  11109.         $queryParams = [];
  11110.         $headerParams = [];
  11111.         $httpBody '';
  11112.         $multipart false;
  11113.         // query params
  11114.         if ($summarize_errors !== null) {
  11115.             $queryParams['summarizeErrors'] = $summarize_errors 'true' 'false';
  11116.         }
  11117.         // header params
  11118.         if ($xero_tenant_id !== null) {
  11119.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  11120.         }
  11121.         // path params
  11122.         if ($prepayment_id !== null) {
  11123.             $resourcePath str_replace(
  11124.                 '{' 'PrepaymentID' '}',
  11125.                 AccountingObjectSerializer::toPathValue($prepayment_id),
  11126.                 $resourcePath
  11127.             );
  11128.         }
  11129.         // body params
  11130.         $_tempBody null;
  11131.         if (isset($allocations)) {
  11132.             $_tempBody $allocations;
  11133.         }
  11134.         if ($multipart) {
  11135.             $headers $this->headerSelector->selectHeadersForMultipart(
  11136.                 ['application/json']
  11137.             );
  11138.         } else {
  11139.             $headers $this->headerSelector->selectHeaders(
  11140.                 ['application/json'],
  11141.                 ['application/json']
  11142.             );
  11143.         }
  11144.         // for model (json/xml)
  11145.         if (isset($_tempBody)) {
  11146.             // $_tempBody is the method argument, if present
  11147.             if ($headers['Content-Type'] === 'application/json') {
  11148.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  11149.             } else {
  11150.                 $httpBody $_tempBody;
  11151.             }
  11152.         } elseif (count($formParams) > 0) {
  11153.             if ($multipart) {
  11154.                 $multipartContents = [
  11155.                     [
  11156.                         'Content-type' => 'multipart/form-data',
  11157.                     ]
  11158.                 ];
  11159.                 
  11160.                 // for HTTP post (form)
  11161.                 $httpBody = new MultipartStream($multipartContents);
  11162.             } elseif ($headers['Content-Type'] === 'application/json') {
  11163.                 $httpBody \GuzzleHttp\json_encode($formParams);
  11164.             } else {
  11165.                 // for HTTP post (form)
  11166.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  11167.             }
  11168.         }
  11169.         // this endpoint requires OAuth (access token)
  11170.         if ($this->config->getAccessToken() !== null) {
  11171.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  11172.         }
  11173.         $defaultHeaders = [];
  11174.         if ($this->config->getUserAgent()) {
  11175.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  11176.         }
  11177.         $headers array_merge(
  11178.             $defaultHeaders,
  11179.             $headerParams,
  11180.             $headers
  11181.         );
  11182.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  11183.         return new Request(
  11184.             'PUT',
  11185.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  11186.             $headers,
  11187.             $httpBody
  11188.         );
  11189.     }
  11190.     /**
  11191.      * Operation createPrepaymentHistory
  11192.      * Creates a history record for a specific prepayment
  11193.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  11194.      * @param  string $prepayment_id Unique identifier for a PrePayment (required)
  11195.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  11196.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  11197.      * @throws \InvalidArgumentException
  11198.      * @return \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords|\XeroAPI\XeroPHP\Models\Accounting\Error
  11199.      */
  11200.     public function createPrepaymentHistory($xero_tenant_id$prepayment_id$history_records)
  11201.     {
  11202.         list($response) = $this->createPrepaymentHistoryWithHttpInfo($xero_tenant_id$prepayment_id$history_records);
  11203.         return $response;
  11204.     }
  11205.     /**
  11206.      * Operation createPrepaymentHistoryWithHttpInfo
  11207.      * Creates a history record for a specific prepayment
  11208.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  11209.      * @param  string $prepayment_id Unique identifier for a PrePayment (required)
  11210.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  11211.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  11212.      * @throws \InvalidArgumentException
  11213.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  11214.      */
  11215.     public function createPrepaymentHistoryWithHttpInfo($xero_tenant_id$prepayment_id$history_records)
  11216.     {
  11217.         $request $this->createPrepaymentHistoryRequest($xero_tenant_id$prepayment_id$history_records);
  11218.         try {
  11219.             $options $this->createHttpClientOption();
  11220.             try {
  11221.                 $response $this->client->send($request$options);
  11222.             } catch (RequestException $e) {
  11223.                 throw new ApiException(
  11224.                     "[{$e->getCode()}{$e->getMessage()}",
  11225.                     $e->getCode(),
  11226.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  11227.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  11228.                 );
  11229.             }
  11230.             $statusCode $response->getStatusCode();
  11231.             if ($statusCode 200 || $statusCode 299) {
  11232.                 throw new ApiException(
  11233.                     sprintf(
  11234.                         '[%d] Error connecting to the API (%s)',
  11235.                         $statusCode,
  11236.                         $request->getUri()
  11237.                     ),
  11238.                     $statusCode,
  11239.                     $response->getHeaders(),
  11240.                     $response->getBody()
  11241.                 );
  11242.             }
  11243.             $responseBody $response->getBody();
  11244.             switch($statusCode) {
  11245.                 case 200:
  11246.                     if ('\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords' === '\SplFileObject') {
  11247.                         $content $responseBody//stream goes to serializer
  11248.                     } else {
  11249.                         $content $responseBody->getContents();
  11250.                     }
  11251.                     return [
  11252.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords', []),
  11253.                         $response->getStatusCode(),
  11254.                         $response->getHeaders()
  11255.                     ];
  11256.                 case 400:
  11257.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  11258.                         $content $responseBody//stream goes to serializer
  11259.                     } else {
  11260.                         $content $responseBody->getContents();
  11261.                     }
  11262.                     return [
  11263.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  11264.                         $response->getStatusCode(),
  11265.                         $response->getHeaders()
  11266.                     ];
  11267.             }
  11268.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  11269.             $responseBody $response->getBody();
  11270.             if ($returnType === '\SplFileObject') {
  11271.                 $content $responseBody//stream goes to serializer
  11272.             } else {
  11273.                 $content $responseBody->getContents();
  11274.             }
  11275.             return [
  11276.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  11277.                 $response->getStatusCode(),
  11278.                 $response->getHeaders()
  11279.             ];
  11280.         } catch (ApiException $e) {
  11281.             switch ($e->getCode()) {
  11282.                 case 200:
  11283.                     $data AccountingObjectSerializer::deserialize(
  11284.                         $e->getResponseBody(),
  11285.                         '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords',
  11286.                         $e->getResponseHeaders()
  11287.                     );
  11288.                     $e->setResponseObject($data);
  11289.                     break;
  11290.                 case 400:
  11291.                     $data AccountingObjectSerializer::deserialize(
  11292.                         $e->getResponseBody(),
  11293.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  11294.                         $e->getResponseHeaders()
  11295.                     );
  11296.                     $e->setResponseObject($data);
  11297.                     break;
  11298.             }
  11299.             throw $e;
  11300.         }
  11301.     }
  11302.     /**
  11303.      * Operation createPrepaymentHistoryAsync
  11304.      * Creates a history record for a specific prepayment
  11305.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  11306.      * @param  string $prepayment_id Unique identifier for a PrePayment (required)
  11307.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  11308.      * @throws \InvalidArgumentException
  11309.      * @return \GuzzleHttp\Promise\PromiseInterface
  11310.      */
  11311.     public function createPrepaymentHistoryAsync($xero_tenant_id$prepayment_id$history_records)
  11312.     {
  11313.         return $this->createPrepaymentHistoryAsyncWithHttpInfo($xero_tenant_id$prepayment_id$history_records)
  11314.             ->then(
  11315.                 function ($response) {
  11316.                     return $response[0];
  11317.                 }
  11318.             );
  11319.     }
  11320.     /**
  11321.      * Operation createPrepaymentHistoryAsyncWithHttpInfo
  11322.      * Creates a history record for a specific prepayment
  11323.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  11324.      * @param  string $prepayment_id Unique identifier for a PrePayment (required)
  11325.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  11326.      * @throws \InvalidArgumentException
  11327.      * @return \GuzzleHttp\Promise\PromiseInterface */
  11328.     public function createPrepaymentHistoryAsyncWithHttpInfo($xero_tenant_id$prepayment_id$history_records)
  11329.     {
  11330.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  11331.         $request $this->createPrepaymentHistoryRequest($xero_tenant_id$prepayment_id$history_records);
  11332.         return $this->client
  11333.             ->sendAsync($request$this->createHttpClientOption())
  11334.             ->then(
  11335.                 function ($response) use ($returnType) {
  11336.                     $responseBody $response->getBody();
  11337.                     if ($returnType === '\SplFileObject') {
  11338.                         $content $responseBody//stream goes to serializer
  11339.                     } else {
  11340.                         $content $responseBody->getContents();
  11341.                     }
  11342.                     return [
  11343.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  11344.                         $response->getStatusCode(),
  11345.                         $response->getHeaders()
  11346.                     ];
  11347.                 },
  11348.                 function ($exception) {
  11349.                     $response $exception->getResponse();
  11350.                     $statusCode $response->getStatusCode();
  11351.                     throw new ApiException(
  11352.                         sprintf(
  11353.                             '[%d] Error connecting to the API (%s)',
  11354.                             $statusCode,
  11355.                             $exception->getRequest()->getUri()
  11356.                         ),
  11357.                         $statusCode,
  11358.                         $response->getHeaders(),
  11359.                         $response->getBody()
  11360.                     );
  11361.                 }
  11362.             );
  11363.     }
  11364.     /**
  11365.      * Create request for operation 'createPrepaymentHistory'
  11366.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  11367.      * @param  string $prepayment_id Unique identifier for a PrePayment (required)
  11368.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  11369.      * @throws \InvalidArgumentException
  11370.      * @return \GuzzleHttp\Psr7\Request  */
  11371.     protected function createPrepaymentHistoryRequest($xero_tenant_id$prepayment_id$history_records)
  11372.     {
  11373.         // verify the required parameter 'xero_tenant_id' is set
  11374.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  11375.             throw new \InvalidArgumentException(
  11376.                 'Missing the required parameter $xero_tenant_id when calling createPrepaymentHistory'
  11377.             );
  11378.         }
  11379.         // verify the required parameter 'prepayment_id' is set
  11380.         if ($prepayment_id === null || (is_array($prepayment_id) && count($prepayment_id) === 0)) {
  11381.             throw new \InvalidArgumentException(
  11382.                 'Missing the required parameter $prepayment_id when calling createPrepaymentHistory'
  11383.             );
  11384.         }
  11385.         // verify the required parameter 'history_records' is set
  11386.         if ($history_records === null || (is_array($history_records) && count($history_records) === 0)) {
  11387.             throw new \InvalidArgumentException(
  11388.                 'Missing the required parameter $history_records when calling createPrepaymentHistory'
  11389.             );
  11390.         }
  11391.         $resourcePath '/Prepayments/{PrepaymentID}/History';
  11392.         $formParams = [];
  11393.         $queryParams = [];
  11394.         $headerParams = [];
  11395.         $httpBody '';
  11396.         $multipart false;
  11397.         // header params
  11398.         if ($xero_tenant_id !== null) {
  11399.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  11400.         }
  11401.         // path params
  11402.         if ($prepayment_id !== null) {
  11403.             $resourcePath str_replace(
  11404.                 '{' 'PrepaymentID' '}',
  11405.                 AccountingObjectSerializer::toPathValue($prepayment_id),
  11406.                 $resourcePath
  11407.             );
  11408.         }
  11409.         // body params
  11410.         $_tempBody null;
  11411.         if (isset($history_records)) {
  11412.             $_tempBody $history_records;
  11413.         }
  11414.         if ($multipart) {
  11415.             $headers $this->headerSelector->selectHeadersForMultipart(
  11416.                 ['application/json']
  11417.             );
  11418.         } else {
  11419.             $headers $this->headerSelector->selectHeaders(
  11420.                 ['application/json'],
  11421.                 ['application/json']
  11422.             );
  11423.         }
  11424.         // for model (json/xml)
  11425.         if (isset($_tempBody)) {
  11426.             // $_tempBody is the method argument, if present
  11427.             if ($headers['Content-Type'] === 'application/json') {
  11428.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  11429.             } else {
  11430.                 $httpBody $_tempBody;
  11431.             }
  11432.         } elseif (count($formParams) > 0) {
  11433.             if ($multipart) {
  11434.                 $multipartContents = [
  11435.                     [
  11436.                         'Content-type' => 'multipart/form-data',
  11437.                     ]
  11438.                 ];
  11439.                 
  11440.                 // for HTTP post (form)
  11441.                 $httpBody = new MultipartStream($multipartContents);
  11442.             } elseif ($headers['Content-Type'] === 'application/json') {
  11443.                 $httpBody \GuzzleHttp\json_encode($formParams);
  11444.             } else {
  11445.                 // for HTTP post (form)
  11446.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  11447.             }
  11448.         }
  11449.         // this endpoint requires OAuth (access token)
  11450.         if ($this->config->getAccessToken() !== null) {
  11451.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  11452.         }
  11453.         $defaultHeaders = [];
  11454.         if ($this->config->getUserAgent()) {
  11455.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  11456.         }
  11457.         $headers array_merge(
  11458.             $defaultHeaders,
  11459.             $headerParams,
  11460.             $headers
  11461.         );
  11462.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  11463.         return new Request(
  11464.             'PUT',
  11465.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  11466.             $headers,
  11467.             $httpBody
  11468.         );
  11469.     }
  11470.     /**
  11471.      * Operation createPurchaseOrderAttachmentByFileName
  11472.      * Creates attachment for a specific purchase order
  11473.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  11474.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  11475.      * @param  string $file_name Name of the attachment (required)
  11476.      * @param  string $body Byte array of file in body of request (required)
  11477.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  11478.      * @throws \InvalidArgumentException
  11479.      * @return \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error
  11480.      */
  11481.     public function createPurchaseOrderAttachmentByFileName($xero_tenant_id$purchase_order_id$file_name$body)
  11482.     {
  11483.         list($response) = $this->createPurchaseOrderAttachmentByFileNameWithHttpInfo($xero_tenant_id$purchase_order_id$file_name$body);
  11484.         return $response;
  11485.     }
  11486.     /**
  11487.      * Operation createPurchaseOrderAttachmentByFileNameWithHttpInfo
  11488.      * Creates attachment for a specific purchase order
  11489.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  11490.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  11491.      * @param  string $file_name Name of the attachment (required)
  11492.      * @param  string $body Byte array of file in body of request (required)
  11493.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  11494.      * @throws \InvalidArgumentException
  11495.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  11496.      */
  11497.     public function createPurchaseOrderAttachmentByFileNameWithHttpInfo($xero_tenant_id$purchase_order_id$file_name$body)
  11498.     {
  11499.         $request $this->createPurchaseOrderAttachmentByFileNameRequest($xero_tenant_id$purchase_order_id$file_name$body);
  11500.         try {
  11501.             $options $this->createHttpClientOption();
  11502.             try {
  11503.                 $response $this->client->send($request$options);
  11504.             } catch (RequestException $e) {
  11505.                 throw new ApiException(
  11506.                     "[{$e->getCode()}{$e->getMessage()}",
  11507.                     $e->getCode(),
  11508.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  11509.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  11510.                 );
  11511.             }
  11512.             $statusCode $response->getStatusCode();
  11513.             if ($statusCode 200 || $statusCode 299) {
  11514.                 throw new ApiException(
  11515.                     sprintf(
  11516.                         '[%d] Error connecting to the API (%s)',
  11517.                         $statusCode,
  11518.                         $request->getUri()
  11519.                     ),
  11520.                     $statusCode,
  11521.                     $response->getHeaders(),
  11522.                     $response->getBody()
  11523.                 );
  11524.             }
  11525.             $responseBody $response->getBody();
  11526.             switch($statusCode) {
  11527.                 case 200:
  11528.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Attachments' === '\SplFileObject') {
  11529.                         $content $responseBody//stream goes to serializer
  11530.                     } else {
  11531.                         $content $responseBody->getContents();
  11532.                     }
  11533.                     return [
  11534.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Attachments', []),
  11535.                         $response->getStatusCode(),
  11536.                         $response->getHeaders()
  11537.                     ];
  11538.                 case 400:
  11539.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  11540.                         $content $responseBody//stream goes to serializer
  11541.                     } else {
  11542.                         $content $responseBody->getContents();
  11543.                     }
  11544.                     return [
  11545.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  11546.                         $response->getStatusCode(),
  11547.                         $response->getHeaders()
  11548.                     ];
  11549.             }
  11550.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  11551.             $responseBody $response->getBody();
  11552.             if ($returnType === '\SplFileObject') {
  11553.                 $content $responseBody//stream goes to serializer
  11554.             } else {
  11555.                 $content $responseBody->getContents();
  11556.             }
  11557.             return [
  11558.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  11559.                 $response->getStatusCode(),
  11560.                 $response->getHeaders()
  11561.             ];
  11562.         } catch (ApiException $e) {
  11563.             switch ($e->getCode()) {
  11564.                 case 200:
  11565.                     $data AccountingObjectSerializer::deserialize(
  11566.                         $e->getResponseBody(),
  11567.                         '\XeroAPI\XeroPHP\Models\Accounting\Attachments',
  11568.                         $e->getResponseHeaders()
  11569.                     );
  11570.                     $e->setResponseObject($data);
  11571.                     break;
  11572.                 case 400:
  11573.                     $data AccountingObjectSerializer::deserialize(
  11574.                         $e->getResponseBody(),
  11575.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  11576.                         $e->getResponseHeaders()
  11577.                     );
  11578.                     $e->setResponseObject($data);
  11579.                     break;
  11580.             }
  11581.             throw $e;
  11582.         }
  11583.     }
  11584.     /**
  11585.      * Operation createPurchaseOrderAttachmentByFileNameAsync
  11586.      * Creates attachment for a specific purchase order
  11587.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  11588.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  11589.      * @param  string $file_name Name of the attachment (required)
  11590.      * @param  string $body Byte array of file in body of request (required)
  11591.      * @throws \InvalidArgumentException
  11592.      * @return \GuzzleHttp\Promise\PromiseInterface
  11593.      */
  11594.     public function createPurchaseOrderAttachmentByFileNameAsync($xero_tenant_id$purchase_order_id$file_name$body)
  11595.     {
  11596.         return $this->createPurchaseOrderAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$purchase_order_id$file_name$body)
  11597.             ->then(
  11598.                 function ($response) {
  11599.                     return $response[0];
  11600.                 }
  11601.             );
  11602.     }
  11603.     /**
  11604.      * Operation createPurchaseOrderAttachmentByFileNameAsyncWithHttpInfo
  11605.      * Creates attachment for a specific purchase order
  11606.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  11607.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  11608.      * @param  string $file_name Name of the attachment (required)
  11609.      * @param  string $body Byte array of file in body of request (required)
  11610.      * @throws \InvalidArgumentException
  11611.      * @return \GuzzleHttp\Promise\PromiseInterface */
  11612.     public function createPurchaseOrderAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$purchase_order_id$file_name$body)
  11613.     {
  11614.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  11615.         $request $this->createPurchaseOrderAttachmentByFileNameRequest($xero_tenant_id$purchase_order_id$file_name$body);
  11616.         return $this->client
  11617.             ->sendAsync($request$this->createHttpClientOption())
  11618.             ->then(
  11619.                 function ($response) use ($returnType) {
  11620.                     $responseBody $response->getBody();
  11621.                     if ($returnType === '\SplFileObject') {
  11622.                         $content $responseBody//stream goes to serializer
  11623.                     } else {
  11624.                         $content $responseBody->getContents();
  11625.                     }
  11626.                     return [
  11627.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  11628.                         $response->getStatusCode(),
  11629.                         $response->getHeaders()
  11630.                     ];
  11631.                 },
  11632.                 function ($exception) {
  11633.                     $response $exception->getResponse();
  11634.                     $statusCode $response->getStatusCode();
  11635.                     throw new ApiException(
  11636.                         sprintf(
  11637.                             '[%d] Error connecting to the API (%s)',
  11638.                             $statusCode,
  11639.                             $exception->getRequest()->getUri()
  11640.                         ),
  11641.                         $statusCode,
  11642.                         $response->getHeaders(),
  11643.                         $response->getBody()
  11644.                     );
  11645.                 }
  11646.             );
  11647.     }
  11648.     /**
  11649.      * Create request for operation 'createPurchaseOrderAttachmentByFileName'
  11650.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  11651.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  11652.      * @param  string $file_name Name of the attachment (required)
  11653.      * @param  string $body Byte array of file in body of request (required)
  11654.      * @throws \InvalidArgumentException
  11655.      * @return \GuzzleHttp\Psr7\Request  */
  11656.     protected function createPurchaseOrderAttachmentByFileNameRequest($xero_tenant_id$purchase_order_id$file_name$body)
  11657.     {
  11658.         // verify the required parameter 'xero_tenant_id' is set
  11659.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  11660.             throw new \InvalidArgumentException(
  11661.                 'Missing the required parameter $xero_tenant_id when calling createPurchaseOrderAttachmentByFileName'
  11662.             );
  11663.         }
  11664.         // verify the required parameter 'purchase_order_id' is set
  11665.         if ($purchase_order_id === null || (is_array($purchase_order_id) && count($purchase_order_id) === 0)) {
  11666.             throw new \InvalidArgumentException(
  11667.                 'Missing the required parameter $purchase_order_id when calling createPurchaseOrderAttachmentByFileName'
  11668.             );
  11669.         }
  11670.         // verify the required parameter 'file_name' is set
  11671.         if ($file_name === null || (is_array($file_name) && count($file_name) === 0)) {
  11672.             throw new \InvalidArgumentException(
  11673.                 'Missing the required parameter $file_name when calling createPurchaseOrderAttachmentByFileName'
  11674.             );
  11675.         }
  11676.         // verify the required parameter 'body' is set
  11677.         if ($body === null || (is_array($body) && count($body) === 0)) {
  11678.             throw new \InvalidArgumentException(
  11679.                 'Missing the required parameter $body when calling createPurchaseOrderAttachmentByFileName'
  11680.             );
  11681.         }
  11682.         $resourcePath '/PurchaseOrders/{PurchaseOrderID}/Attachments/{FileName}';
  11683.         $formParams = [];
  11684.         $queryParams = [];
  11685.         $headerParams = [];
  11686.         $httpBody '';
  11687.         $multipart false;
  11688.         // header params
  11689.         if ($xero_tenant_id !== null) {
  11690.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  11691.         }
  11692.         // path params
  11693.         if ($purchase_order_id !== null) {
  11694.             $resourcePath str_replace(
  11695.                 '{' 'PurchaseOrderID' '}',
  11696.                 AccountingObjectSerializer::toPathValue($purchase_order_id),
  11697.                 $resourcePath
  11698.             );
  11699.         }
  11700.         // path params
  11701.         if ($file_name !== null) {
  11702.             $resourcePath str_replace(
  11703.                 '{' 'FileName' '}',
  11704.                 AccountingObjectSerializer::toPathValue($file_name),
  11705.                 $resourcePath
  11706.             );
  11707.         }
  11708.         // body params
  11709.         $_tempBody null;
  11710.         if (isset($body)) {
  11711.             $_tempBody $body;
  11712.         }
  11713.         if ($multipart) {
  11714.             $headers $this->headerSelector->selectHeadersForMultipart(
  11715.                 ['application/json']
  11716.             );
  11717.         } else {
  11718.             $headers $this->headerSelector->selectHeaders(
  11719.                 ['application/json'],
  11720.                 ['application/octet-stream']
  11721.             );
  11722.         }
  11723.         // for model (json/xml)
  11724.         if (isset($_tempBody)) {
  11725.             // $_tempBody is the method argument, if present
  11726.             if ($headers['Content-Type'] === 'application/json') {
  11727.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  11728.             } else {
  11729.                 $httpBody $_tempBody;
  11730.             }
  11731.         } elseif (count($formParams) > 0) {
  11732.             if ($multipart) {
  11733.                 $multipartContents = [
  11734.                     [
  11735.                         'Content-type' => 'multipart/form-data',
  11736.                     ]
  11737.                 ];
  11738.                 
  11739.                 // for HTTP post (form)
  11740.                 $httpBody = new MultipartStream($multipartContents);
  11741.             } elseif ($headers['Content-Type'] === 'application/json') {
  11742.                 $httpBody \GuzzleHttp\json_encode($formParams);
  11743.             } else {
  11744.                 // for HTTP post (form)
  11745.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  11746.             }
  11747.         }
  11748.         // this endpoint requires OAuth (access token)
  11749.         if ($this->config->getAccessToken() !== null) {
  11750.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  11751.         }
  11752.         $defaultHeaders = [];
  11753.         if ($this->config->getUserAgent()) {
  11754.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  11755.         }
  11756.         $headers array_merge(
  11757.             $defaultHeaders,
  11758.             $headerParams,
  11759.             $headers
  11760.         );
  11761.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  11762.         return new Request(
  11763.             'PUT',
  11764.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  11765.             $headers,
  11766.             $httpBody
  11767.         );
  11768.     }
  11769.     /**
  11770.      * Operation createPurchaseOrderHistory
  11771.      * Creates a history record for a specific purchase orders
  11772.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  11773.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  11774.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  11775.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  11776.      * @throws \InvalidArgumentException
  11777.      * @return \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords|\XeroAPI\XeroPHP\Models\Accounting\Error
  11778.      */
  11779.     public function createPurchaseOrderHistory($xero_tenant_id$purchase_order_id$history_records)
  11780.     {
  11781.         list($response) = $this->createPurchaseOrderHistoryWithHttpInfo($xero_tenant_id$purchase_order_id$history_records);
  11782.         return $response;
  11783.     }
  11784.     /**
  11785.      * Operation createPurchaseOrderHistoryWithHttpInfo
  11786.      * Creates a history record for a specific purchase orders
  11787.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  11788.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  11789.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  11790.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  11791.      * @throws \InvalidArgumentException
  11792.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  11793.      */
  11794.     public function createPurchaseOrderHistoryWithHttpInfo($xero_tenant_id$purchase_order_id$history_records)
  11795.     {
  11796.         $request $this->createPurchaseOrderHistoryRequest($xero_tenant_id$purchase_order_id$history_records);
  11797.         try {
  11798.             $options $this->createHttpClientOption();
  11799.             try {
  11800.                 $response $this->client->send($request$options);
  11801.             } catch (RequestException $e) {
  11802.                 throw new ApiException(
  11803.                     "[{$e->getCode()}{$e->getMessage()}",
  11804.                     $e->getCode(),
  11805.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  11806.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  11807.                 );
  11808.             }
  11809.             $statusCode $response->getStatusCode();
  11810.             if ($statusCode 200 || $statusCode 299) {
  11811.                 throw new ApiException(
  11812.                     sprintf(
  11813.                         '[%d] Error connecting to the API (%s)',
  11814.                         $statusCode,
  11815.                         $request->getUri()
  11816.                     ),
  11817.                     $statusCode,
  11818.                     $response->getHeaders(),
  11819.                     $response->getBody()
  11820.                 );
  11821.             }
  11822.             $responseBody $response->getBody();
  11823.             switch($statusCode) {
  11824.                 case 200:
  11825.                     if ('\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords' === '\SplFileObject') {
  11826.                         $content $responseBody//stream goes to serializer
  11827.                     } else {
  11828.                         $content $responseBody->getContents();
  11829.                     }
  11830.                     return [
  11831.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords', []),
  11832.                         $response->getStatusCode(),
  11833.                         $response->getHeaders()
  11834.                     ];
  11835.                 case 400:
  11836.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  11837.                         $content $responseBody//stream goes to serializer
  11838.                     } else {
  11839.                         $content $responseBody->getContents();
  11840.                     }
  11841.                     return [
  11842.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  11843.                         $response->getStatusCode(),
  11844.                         $response->getHeaders()
  11845.                     ];
  11846.             }
  11847.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  11848.             $responseBody $response->getBody();
  11849.             if ($returnType === '\SplFileObject') {
  11850.                 $content $responseBody//stream goes to serializer
  11851.             } else {
  11852.                 $content $responseBody->getContents();
  11853.             }
  11854.             return [
  11855.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  11856.                 $response->getStatusCode(),
  11857.                 $response->getHeaders()
  11858.             ];
  11859.         } catch (ApiException $e) {
  11860.             switch ($e->getCode()) {
  11861.                 case 200:
  11862.                     $data AccountingObjectSerializer::deserialize(
  11863.                         $e->getResponseBody(),
  11864.                         '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords',
  11865.                         $e->getResponseHeaders()
  11866.                     );
  11867.                     $e->setResponseObject($data);
  11868.                     break;
  11869.                 case 400:
  11870.                     $data AccountingObjectSerializer::deserialize(
  11871.                         $e->getResponseBody(),
  11872.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  11873.                         $e->getResponseHeaders()
  11874.                     );
  11875.                     $e->setResponseObject($data);
  11876.                     break;
  11877.             }
  11878.             throw $e;
  11879.         }
  11880.     }
  11881.     /**
  11882.      * Operation createPurchaseOrderHistoryAsync
  11883.      * Creates a history record for a specific purchase orders
  11884.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  11885.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  11886.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  11887.      * @throws \InvalidArgumentException
  11888.      * @return \GuzzleHttp\Promise\PromiseInterface
  11889.      */
  11890.     public function createPurchaseOrderHistoryAsync($xero_tenant_id$purchase_order_id$history_records)
  11891.     {
  11892.         return $this->createPurchaseOrderHistoryAsyncWithHttpInfo($xero_tenant_id$purchase_order_id$history_records)
  11893.             ->then(
  11894.                 function ($response) {
  11895.                     return $response[0];
  11896.                 }
  11897.             );
  11898.     }
  11899.     /**
  11900.      * Operation createPurchaseOrderHistoryAsyncWithHttpInfo
  11901.      * Creates a history record for a specific purchase orders
  11902.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  11903.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  11904.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  11905.      * @throws \InvalidArgumentException
  11906.      * @return \GuzzleHttp\Promise\PromiseInterface */
  11907.     public function createPurchaseOrderHistoryAsyncWithHttpInfo($xero_tenant_id$purchase_order_id$history_records)
  11908.     {
  11909.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  11910.         $request $this->createPurchaseOrderHistoryRequest($xero_tenant_id$purchase_order_id$history_records);
  11911.         return $this->client
  11912.             ->sendAsync($request$this->createHttpClientOption())
  11913.             ->then(
  11914.                 function ($response) use ($returnType) {
  11915.                     $responseBody $response->getBody();
  11916.                     if ($returnType === '\SplFileObject') {
  11917.                         $content $responseBody//stream goes to serializer
  11918.                     } else {
  11919.                         $content $responseBody->getContents();
  11920.                     }
  11921.                     return [
  11922.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  11923.                         $response->getStatusCode(),
  11924.                         $response->getHeaders()
  11925.                     ];
  11926.                 },
  11927.                 function ($exception) {
  11928.                     $response $exception->getResponse();
  11929.                     $statusCode $response->getStatusCode();
  11930.                     throw new ApiException(
  11931.                         sprintf(
  11932.                             '[%d] Error connecting to the API (%s)',
  11933.                             $statusCode,
  11934.                             $exception->getRequest()->getUri()
  11935.                         ),
  11936.                         $statusCode,
  11937.                         $response->getHeaders(),
  11938.                         $response->getBody()
  11939.                     );
  11940.                 }
  11941.             );
  11942.     }
  11943.     /**
  11944.      * Create request for operation 'createPurchaseOrderHistory'
  11945.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  11946.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  11947.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  11948.      * @throws \InvalidArgumentException
  11949.      * @return \GuzzleHttp\Psr7\Request  */
  11950.     protected function createPurchaseOrderHistoryRequest($xero_tenant_id$purchase_order_id$history_records)
  11951.     {
  11952.         // verify the required parameter 'xero_tenant_id' is set
  11953.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  11954.             throw new \InvalidArgumentException(
  11955.                 'Missing the required parameter $xero_tenant_id when calling createPurchaseOrderHistory'
  11956.             );
  11957.         }
  11958.         // verify the required parameter 'purchase_order_id' is set
  11959.         if ($purchase_order_id === null || (is_array($purchase_order_id) && count($purchase_order_id) === 0)) {
  11960.             throw new \InvalidArgumentException(
  11961.                 'Missing the required parameter $purchase_order_id when calling createPurchaseOrderHistory'
  11962.             );
  11963.         }
  11964.         // verify the required parameter 'history_records' is set
  11965.         if ($history_records === null || (is_array($history_records) && count($history_records) === 0)) {
  11966.             throw new \InvalidArgumentException(
  11967.                 'Missing the required parameter $history_records when calling createPurchaseOrderHistory'
  11968.             );
  11969.         }
  11970.         $resourcePath '/PurchaseOrders/{PurchaseOrderID}/History';
  11971.         $formParams = [];
  11972.         $queryParams = [];
  11973.         $headerParams = [];
  11974.         $httpBody '';
  11975.         $multipart false;
  11976.         // header params
  11977.         if ($xero_tenant_id !== null) {
  11978.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  11979.         }
  11980.         // path params
  11981.         if ($purchase_order_id !== null) {
  11982.             $resourcePath str_replace(
  11983.                 '{' 'PurchaseOrderID' '}',
  11984.                 AccountingObjectSerializer::toPathValue($purchase_order_id),
  11985.                 $resourcePath
  11986.             );
  11987.         }
  11988.         // body params
  11989.         $_tempBody null;
  11990.         if (isset($history_records)) {
  11991.             $_tempBody $history_records;
  11992.         }
  11993.         if ($multipart) {
  11994.             $headers $this->headerSelector->selectHeadersForMultipart(
  11995.                 ['application/json']
  11996.             );
  11997.         } else {
  11998.             $headers $this->headerSelector->selectHeaders(
  11999.                 ['application/json'],
  12000.                 ['application/json']
  12001.             );
  12002.         }
  12003.         // for model (json/xml)
  12004.         if (isset($_tempBody)) {
  12005.             // $_tempBody is the method argument, if present
  12006.             if ($headers['Content-Type'] === 'application/json') {
  12007.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  12008.             } else {
  12009.                 $httpBody $_tempBody;
  12010.             }
  12011.         } elseif (count($formParams) > 0) {
  12012.             if ($multipart) {
  12013.                 $multipartContents = [
  12014.                     [
  12015.                         'Content-type' => 'multipart/form-data',
  12016.                     ]
  12017.                 ];
  12018.                 
  12019.                 // for HTTP post (form)
  12020.                 $httpBody = new MultipartStream($multipartContents);
  12021.             } elseif ($headers['Content-Type'] === 'application/json') {
  12022.                 $httpBody \GuzzleHttp\json_encode($formParams);
  12023.             } else {
  12024.                 // for HTTP post (form)
  12025.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  12026.             }
  12027.         }
  12028.         // this endpoint requires OAuth (access token)
  12029.         if ($this->config->getAccessToken() !== null) {
  12030.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  12031.         }
  12032.         $defaultHeaders = [];
  12033.         if ($this->config->getUserAgent()) {
  12034.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  12035.         }
  12036.         $headers array_merge(
  12037.             $defaultHeaders,
  12038.             $headerParams,
  12039.             $headers
  12040.         );
  12041.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  12042.         return new Request(
  12043.             'PUT',
  12044.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  12045.             $headers,
  12046.             $httpBody
  12047.         );
  12048.     }
  12049.     /**
  12050.      * Operation createPurchaseOrders
  12051.      * Creates one or more purchase orders
  12052.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  12053.      * @param  \XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders $purchase_orders PurchaseOrders with an array of PurchaseOrder object in body of request (required)
  12054.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  12055.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  12056.      * @throws \InvalidArgumentException
  12057.      * @return \XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders|\XeroAPI\XeroPHP\Models\Accounting\Error
  12058.      */
  12059.     public function createPurchaseOrders($xero_tenant_id$purchase_orders$summarize_errors false)
  12060.     {
  12061.         list($response) = $this->createPurchaseOrdersWithHttpInfo($xero_tenant_id$purchase_orders$summarize_errors);
  12062.         return $response;
  12063.     }
  12064.     /**
  12065.      * Operation createPurchaseOrdersWithHttpInfo
  12066.      * Creates one or more purchase orders
  12067.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  12068.      * @param  \XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders $purchase_orders PurchaseOrders with an array of PurchaseOrder object in body of request (required)
  12069.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  12070.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  12071.      * @throws \InvalidArgumentException
  12072.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  12073.      */
  12074.     public function createPurchaseOrdersWithHttpInfo($xero_tenant_id$purchase_orders$summarize_errors false)
  12075.     {
  12076.         $request $this->createPurchaseOrdersRequest($xero_tenant_id$purchase_orders$summarize_errors);
  12077.         try {
  12078.             $options $this->createHttpClientOption();
  12079.             try {
  12080.                 $response $this->client->send($request$options);
  12081.             } catch (RequestException $e) {
  12082.                 throw new ApiException(
  12083.                     "[{$e->getCode()}{$e->getMessage()}",
  12084.                     $e->getCode(),
  12085.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  12086.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  12087.                 );
  12088.             }
  12089.             $statusCode $response->getStatusCode();
  12090.             if ($statusCode 200 || $statusCode 299) {
  12091.                 throw new ApiException(
  12092.                     sprintf(
  12093.                         '[%d] Error connecting to the API (%s)',
  12094.                         $statusCode,
  12095.                         $request->getUri()
  12096.                     ),
  12097.                     $statusCode,
  12098.                     $response->getHeaders(),
  12099.                     $response->getBody()
  12100.                 );
  12101.             }
  12102.             $responseBody $response->getBody();
  12103.             switch($statusCode) {
  12104.                 case 200:
  12105.                     if ('\XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders' === '\SplFileObject') {
  12106.                         $content $responseBody//stream goes to serializer
  12107.                     } else {
  12108.                         $content $responseBody->getContents();
  12109.                     }
  12110.                     return [
  12111.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders', []),
  12112.                         $response->getStatusCode(),
  12113.                         $response->getHeaders()
  12114.                     ];
  12115.                 case 400:
  12116.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  12117.                         $content $responseBody//stream goes to serializer
  12118.                     } else {
  12119.                         $content $responseBody->getContents();
  12120.                     }
  12121.                     return [
  12122.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  12123.                         $response->getStatusCode(),
  12124.                         $response->getHeaders()
  12125.                     ];
  12126.             }
  12127.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders';
  12128.             $responseBody $response->getBody();
  12129.             if ($returnType === '\SplFileObject') {
  12130.                 $content $responseBody//stream goes to serializer
  12131.             } else {
  12132.                 $content $responseBody->getContents();
  12133.             }
  12134.             return [
  12135.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  12136.                 $response->getStatusCode(),
  12137.                 $response->getHeaders()
  12138.             ];
  12139.         } catch (ApiException $e) {
  12140.             switch ($e->getCode()) {
  12141.                 case 200:
  12142.                     $data AccountingObjectSerializer::deserialize(
  12143.                         $e->getResponseBody(),
  12144.                         '\XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders',
  12145.                         $e->getResponseHeaders()
  12146.                     );
  12147.                     $e->setResponseObject($data);
  12148.                     break;
  12149.                 case 400:
  12150.                     $data AccountingObjectSerializer::deserialize(
  12151.                         $e->getResponseBody(),
  12152.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  12153.                         $e->getResponseHeaders()
  12154.                     );
  12155.                     $e->setResponseObject($data);
  12156.                     break;
  12157.             }
  12158.             throw $e;
  12159.         }
  12160.     }
  12161.     /**
  12162.      * Operation createPurchaseOrdersAsync
  12163.      * Creates one or more purchase orders
  12164.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  12165.      * @param  \XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders $purchase_orders PurchaseOrders with an array of PurchaseOrder object in body of request (required)
  12166.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  12167.      * @throws \InvalidArgumentException
  12168.      * @return \GuzzleHttp\Promise\PromiseInterface
  12169.      */
  12170.     public function createPurchaseOrdersAsync($xero_tenant_id$purchase_orders$summarize_errors false)
  12171.     {
  12172.         return $this->createPurchaseOrdersAsyncWithHttpInfo($xero_tenant_id$purchase_orders$summarize_errors)
  12173.             ->then(
  12174.                 function ($response) {
  12175.                     return $response[0];
  12176.                 }
  12177.             );
  12178.     }
  12179.     /**
  12180.      * Operation createPurchaseOrdersAsyncWithHttpInfo
  12181.      * Creates one or more purchase orders
  12182.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  12183.      * @param  \XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders $purchase_orders PurchaseOrders with an array of PurchaseOrder object in body of request (required)
  12184.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  12185.      * @throws \InvalidArgumentException
  12186.      * @return \GuzzleHttp\Promise\PromiseInterface */
  12187.     public function createPurchaseOrdersAsyncWithHttpInfo($xero_tenant_id$purchase_orders$summarize_errors false)
  12188.     {
  12189.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders';
  12190.         $request $this->createPurchaseOrdersRequest($xero_tenant_id$purchase_orders$summarize_errors);
  12191.         return $this->client
  12192.             ->sendAsync($request$this->createHttpClientOption())
  12193.             ->then(
  12194.                 function ($response) use ($returnType) {
  12195.                     $responseBody $response->getBody();
  12196.                     if ($returnType === '\SplFileObject') {
  12197.                         $content $responseBody//stream goes to serializer
  12198.                     } else {
  12199.                         $content $responseBody->getContents();
  12200.                     }
  12201.                     return [
  12202.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  12203.                         $response->getStatusCode(),
  12204.                         $response->getHeaders()
  12205.                     ];
  12206.                 },
  12207.                 function ($exception) {
  12208.                     $response $exception->getResponse();
  12209.                     $statusCode $response->getStatusCode();
  12210.                     throw new ApiException(
  12211.                         sprintf(
  12212.                             '[%d] Error connecting to the API (%s)',
  12213.                             $statusCode,
  12214.                             $exception->getRequest()->getUri()
  12215.                         ),
  12216.                         $statusCode,
  12217.                         $response->getHeaders(),
  12218.                         $response->getBody()
  12219.                     );
  12220.                 }
  12221.             );
  12222.     }
  12223.     /**
  12224.      * Create request for operation 'createPurchaseOrders'
  12225.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  12226.      * @param  \XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders $purchase_orders PurchaseOrders with an array of PurchaseOrder object in body of request (required)
  12227.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  12228.      * @throws \InvalidArgumentException
  12229.      * @return \GuzzleHttp\Psr7\Request  */
  12230.     protected function createPurchaseOrdersRequest($xero_tenant_id$purchase_orders$summarize_errors false)
  12231.     {
  12232.         // verify the required parameter 'xero_tenant_id' is set
  12233.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  12234.             throw new \InvalidArgumentException(
  12235.                 'Missing the required parameter $xero_tenant_id when calling createPurchaseOrders'
  12236.             );
  12237.         }
  12238.         // verify the required parameter 'purchase_orders' is set
  12239.         if ($purchase_orders === null || (is_array($purchase_orders) && count($purchase_orders) === 0)) {
  12240.             throw new \InvalidArgumentException(
  12241.                 'Missing the required parameter $purchase_orders when calling createPurchaseOrders'
  12242.             );
  12243.         }
  12244.         $resourcePath '/PurchaseOrders';
  12245.         $formParams = [];
  12246.         $queryParams = [];
  12247.         $headerParams = [];
  12248.         $httpBody '';
  12249.         $multipart false;
  12250.         // query params
  12251.         if ($summarize_errors !== null) {
  12252.             $queryParams['summarizeErrors'] = $summarize_errors 'true' 'false';
  12253.         }
  12254.         // header params
  12255.         if ($xero_tenant_id !== null) {
  12256.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  12257.         }
  12258.         // body params
  12259.         $_tempBody null;
  12260.         if (isset($purchase_orders)) {
  12261.             $_tempBody $purchase_orders;
  12262.         }
  12263.         if ($multipart) {
  12264.             $headers $this->headerSelector->selectHeadersForMultipart(
  12265.                 ['application/json']
  12266.             );
  12267.         } else {
  12268.             $headers $this->headerSelector->selectHeaders(
  12269.                 ['application/json'],
  12270.                 ['application/json']
  12271.             );
  12272.         }
  12273.         // for model (json/xml)
  12274.         if (isset($_tempBody)) {
  12275.             // $_tempBody is the method argument, if present
  12276.             if ($headers['Content-Type'] === 'application/json') {
  12277.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  12278.             } else {
  12279.                 $httpBody $_tempBody;
  12280.             }
  12281.         } elseif (count($formParams) > 0) {
  12282.             if ($multipart) {
  12283.                 $multipartContents = [
  12284.                     [
  12285.                         'Content-type' => 'multipart/form-data',
  12286.                     ]
  12287.                 ];
  12288.                 
  12289.                 // for HTTP post (form)
  12290.                 $httpBody = new MultipartStream($multipartContents);
  12291.             } elseif ($headers['Content-Type'] === 'application/json') {
  12292.                 $httpBody \GuzzleHttp\json_encode($formParams);
  12293.             } else {
  12294.                 // for HTTP post (form)
  12295.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  12296.             }
  12297.         }
  12298.         // this endpoint requires OAuth (access token)
  12299.         if ($this->config->getAccessToken() !== null) {
  12300.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  12301.         }
  12302.         $defaultHeaders = [];
  12303.         if ($this->config->getUserAgent()) {
  12304.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  12305.         }
  12306.         $headers array_merge(
  12307.             $defaultHeaders,
  12308.             $headerParams,
  12309.             $headers
  12310.         );
  12311.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  12312.         return new Request(
  12313.             'PUT',
  12314.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  12315.             $headers,
  12316.             $httpBody
  12317.         );
  12318.     }
  12319.     /**
  12320.      * Operation createQuoteAttachmentByFileName
  12321.      * Creates attachment for a specific quote
  12322.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  12323.      * @param  string $quote_id Unique identifier for an Quote (required)
  12324.      * @param  string $file_name Name of the attachment (required)
  12325.      * @param  string $body Byte array of file in body of request (required)
  12326.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  12327.      * @throws \InvalidArgumentException
  12328.      * @return \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error
  12329.      */
  12330.     public function createQuoteAttachmentByFileName($xero_tenant_id$quote_id$file_name$body)
  12331.     {
  12332.         list($response) = $this->createQuoteAttachmentByFileNameWithHttpInfo($xero_tenant_id$quote_id$file_name$body);
  12333.         return $response;
  12334.     }
  12335.     /**
  12336.      * Operation createQuoteAttachmentByFileNameWithHttpInfo
  12337.      * Creates attachment for a specific quote
  12338.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  12339.      * @param  string $quote_id Unique identifier for an Quote (required)
  12340.      * @param  string $file_name Name of the attachment (required)
  12341.      * @param  string $body Byte array of file in body of request (required)
  12342.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  12343.      * @throws \InvalidArgumentException
  12344.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  12345.      */
  12346.     public function createQuoteAttachmentByFileNameWithHttpInfo($xero_tenant_id$quote_id$file_name$body)
  12347.     {
  12348.         $request $this->createQuoteAttachmentByFileNameRequest($xero_tenant_id$quote_id$file_name$body);
  12349.         try {
  12350.             $options $this->createHttpClientOption();
  12351.             try {
  12352.                 $response $this->client->send($request$options);
  12353.             } catch (RequestException $e) {
  12354.                 throw new ApiException(
  12355.                     "[{$e->getCode()}{$e->getMessage()}",
  12356.                     $e->getCode(),
  12357.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  12358.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  12359.                 );
  12360.             }
  12361.             $statusCode $response->getStatusCode();
  12362.             if ($statusCode 200 || $statusCode 299) {
  12363.                 throw new ApiException(
  12364.                     sprintf(
  12365.                         '[%d] Error connecting to the API (%s)',
  12366.                         $statusCode,
  12367.                         $request->getUri()
  12368.                     ),
  12369.                     $statusCode,
  12370.                     $response->getHeaders(),
  12371.                     $response->getBody()
  12372.                 );
  12373.             }
  12374.             $responseBody $response->getBody();
  12375.             switch($statusCode) {
  12376.                 case 200:
  12377.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Attachments' === '\SplFileObject') {
  12378.                         $content $responseBody//stream goes to serializer
  12379.                     } else {
  12380.                         $content $responseBody->getContents();
  12381.                     }
  12382.                     return [
  12383.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Attachments', []),
  12384.                         $response->getStatusCode(),
  12385.                         $response->getHeaders()
  12386.                     ];
  12387.                 case 400:
  12388.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  12389.                         $content $responseBody//stream goes to serializer
  12390.                     } else {
  12391.                         $content $responseBody->getContents();
  12392.                     }
  12393.                     return [
  12394.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  12395.                         $response->getStatusCode(),
  12396.                         $response->getHeaders()
  12397.                     ];
  12398.             }
  12399.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  12400.             $responseBody $response->getBody();
  12401.             if ($returnType === '\SplFileObject') {
  12402.                 $content $responseBody//stream goes to serializer
  12403.             } else {
  12404.                 $content $responseBody->getContents();
  12405.             }
  12406.             return [
  12407.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  12408.                 $response->getStatusCode(),
  12409.                 $response->getHeaders()
  12410.             ];
  12411.         } catch (ApiException $e) {
  12412.             switch ($e->getCode()) {
  12413.                 case 200:
  12414.                     $data AccountingObjectSerializer::deserialize(
  12415.                         $e->getResponseBody(),
  12416.                         '\XeroAPI\XeroPHP\Models\Accounting\Attachments',
  12417.                         $e->getResponseHeaders()
  12418.                     );
  12419.                     $e->setResponseObject($data);
  12420.                     break;
  12421.                 case 400:
  12422.                     $data AccountingObjectSerializer::deserialize(
  12423.                         $e->getResponseBody(),
  12424.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  12425.                         $e->getResponseHeaders()
  12426.                     );
  12427.                     $e->setResponseObject($data);
  12428.                     break;
  12429.             }
  12430.             throw $e;
  12431.         }
  12432.     }
  12433.     /**
  12434.      * Operation createQuoteAttachmentByFileNameAsync
  12435.      * Creates attachment for a specific quote
  12436.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  12437.      * @param  string $quote_id Unique identifier for an Quote (required)
  12438.      * @param  string $file_name Name of the attachment (required)
  12439.      * @param  string $body Byte array of file in body of request (required)
  12440.      * @throws \InvalidArgumentException
  12441.      * @return \GuzzleHttp\Promise\PromiseInterface
  12442.      */
  12443.     public function createQuoteAttachmentByFileNameAsync($xero_tenant_id$quote_id$file_name$body)
  12444.     {
  12445.         return $this->createQuoteAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$quote_id$file_name$body)
  12446.             ->then(
  12447.                 function ($response) {
  12448.                     return $response[0];
  12449.                 }
  12450.             );
  12451.     }
  12452.     /**
  12453.      * Operation createQuoteAttachmentByFileNameAsyncWithHttpInfo
  12454.      * Creates attachment for a specific quote
  12455.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  12456.      * @param  string $quote_id Unique identifier for an Quote (required)
  12457.      * @param  string $file_name Name of the attachment (required)
  12458.      * @param  string $body Byte array of file in body of request (required)
  12459.      * @throws \InvalidArgumentException
  12460.      * @return \GuzzleHttp\Promise\PromiseInterface */
  12461.     public function createQuoteAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$quote_id$file_name$body)
  12462.     {
  12463.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  12464.         $request $this->createQuoteAttachmentByFileNameRequest($xero_tenant_id$quote_id$file_name$body);
  12465.         return $this->client
  12466.             ->sendAsync($request$this->createHttpClientOption())
  12467.             ->then(
  12468.                 function ($response) use ($returnType) {
  12469.                     $responseBody $response->getBody();
  12470.                     if ($returnType === '\SplFileObject') {
  12471.                         $content $responseBody//stream goes to serializer
  12472.                     } else {
  12473.                         $content $responseBody->getContents();
  12474.                     }
  12475.                     return [
  12476.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  12477.                         $response->getStatusCode(),
  12478.                         $response->getHeaders()
  12479.                     ];
  12480.                 },
  12481.                 function ($exception) {
  12482.                     $response $exception->getResponse();
  12483.                     $statusCode $response->getStatusCode();
  12484.                     throw new ApiException(
  12485.                         sprintf(
  12486.                             '[%d] Error connecting to the API (%s)',
  12487.                             $statusCode,
  12488.                             $exception->getRequest()->getUri()
  12489.                         ),
  12490.                         $statusCode,
  12491.                         $response->getHeaders(),
  12492.                         $response->getBody()
  12493.                     );
  12494.                 }
  12495.             );
  12496.     }
  12497.     /**
  12498.      * Create request for operation 'createQuoteAttachmentByFileName'
  12499.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  12500.      * @param  string $quote_id Unique identifier for an Quote (required)
  12501.      * @param  string $file_name Name of the attachment (required)
  12502.      * @param  string $body Byte array of file in body of request (required)
  12503.      * @throws \InvalidArgumentException
  12504.      * @return \GuzzleHttp\Psr7\Request  */
  12505.     protected function createQuoteAttachmentByFileNameRequest($xero_tenant_id$quote_id$file_name$body)
  12506.     {
  12507.         // verify the required parameter 'xero_tenant_id' is set
  12508.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  12509.             throw new \InvalidArgumentException(
  12510.                 'Missing the required parameter $xero_tenant_id when calling createQuoteAttachmentByFileName'
  12511.             );
  12512.         }
  12513.         // verify the required parameter 'quote_id' is set
  12514.         if ($quote_id === null || (is_array($quote_id) && count($quote_id) === 0)) {
  12515.             throw new \InvalidArgumentException(
  12516.                 'Missing the required parameter $quote_id when calling createQuoteAttachmentByFileName'
  12517.             );
  12518.         }
  12519.         // verify the required parameter 'file_name' is set
  12520.         if ($file_name === null || (is_array($file_name) && count($file_name) === 0)) {
  12521.             throw new \InvalidArgumentException(
  12522.                 'Missing the required parameter $file_name when calling createQuoteAttachmentByFileName'
  12523.             );
  12524.         }
  12525.         // verify the required parameter 'body' is set
  12526.         if ($body === null || (is_array($body) && count($body) === 0)) {
  12527.             throw new \InvalidArgumentException(
  12528.                 'Missing the required parameter $body when calling createQuoteAttachmentByFileName'
  12529.             );
  12530.         }
  12531.         $resourcePath '/Quotes/{QuoteID}/Attachments/{FileName}';
  12532.         $formParams = [];
  12533.         $queryParams = [];
  12534.         $headerParams = [];
  12535.         $httpBody '';
  12536.         $multipart false;
  12537.         // header params
  12538.         if ($xero_tenant_id !== null) {
  12539.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  12540.         }
  12541.         // path params
  12542.         if ($quote_id !== null) {
  12543.             $resourcePath str_replace(
  12544.                 '{' 'QuoteID' '}',
  12545.                 AccountingObjectSerializer::toPathValue($quote_id),
  12546.                 $resourcePath
  12547.             );
  12548.         }
  12549.         // path params
  12550.         if ($file_name !== null) {
  12551.             $resourcePath str_replace(
  12552.                 '{' 'FileName' '}',
  12553.                 AccountingObjectSerializer::toPathValue($file_name),
  12554.                 $resourcePath
  12555.             );
  12556.         }
  12557.         // body params
  12558.         $_tempBody null;
  12559.         if (isset($body)) {
  12560.             $_tempBody $body;
  12561.         }
  12562.         if ($multipart) {
  12563.             $headers $this->headerSelector->selectHeadersForMultipart(
  12564.                 ['application/json']
  12565.             );
  12566.         } else {
  12567.             $headers $this->headerSelector->selectHeaders(
  12568.                 ['application/json'],
  12569.                 ['application/octet-stream']
  12570.             );
  12571.         }
  12572.         // for model (json/xml)
  12573.         if (isset($_tempBody)) {
  12574.             // $_tempBody is the method argument, if present
  12575.             if ($headers['Content-Type'] === 'application/json') {
  12576.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  12577.             } else {
  12578.                 $httpBody $_tempBody;
  12579.             }
  12580.         } elseif (count($formParams) > 0) {
  12581.             if ($multipart) {
  12582.                 $multipartContents = [
  12583.                     [
  12584.                         'Content-type' => 'multipart/form-data',
  12585.                     ]
  12586.                 ];
  12587.                 
  12588.                 // for HTTP post (form)
  12589.                 $httpBody = new MultipartStream($multipartContents);
  12590.             } elseif ($headers['Content-Type'] === 'application/json') {
  12591.                 $httpBody \GuzzleHttp\json_encode($formParams);
  12592.             } else {
  12593.                 // for HTTP post (form)
  12594.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  12595.             }
  12596.         }
  12597.         // this endpoint requires OAuth (access token)
  12598.         if ($this->config->getAccessToken() !== null) {
  12599.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  12600.         }
  12601.         $defaultHeaders = [];
  12602.         if ($this->config->getUserAgent()) {
  12603.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  12604.         }
  12605.         $headers array_merge(
  12606.             $defaultHeaders,
  12607.             $headerParams,
  12608.             $headers
  12609.         );
  12610.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  12611.         return new Request(
  12612.             'PUT',
  12613.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  12614.             $headers,
  12615.             $httpBody
  12616.         );
  12617.     }
  12618.     /**
  12619.      * Operation createQuoteHistory
  12620.      * Creates a history record for a specific quote
  12621.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  12622.      * @param  string $quote_id Unique identifier for an Quote (required)
  12623.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  12624.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  12625.      * @throws \InvalidArgumentException
  12626.      * @return \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords|\XeroAPI\XeroPHP\Models\Accounting\Error
  12627.      */
  12628.     public function createQuoteHistory($xero_tenant_id$quote_id$history_records)
  12629.     {
  12630.         list($response) = $this->createQuoteHistoryWithHttpInfo($xero_tenant_id$quote_id$history_records);
  12631.         return $response;
  12632.     }
  12633.     /**
  12634.      * Operation createQuoteHistoryWithHttpInfo
  12635.      * Creates a history record for a specific quote
  12636.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  12637.      * @param  string $quote_id Unique identifier for an Quote (required)
  12638.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  12639.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  12640.      * @throws \InvalidArgumentException
  12641.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  12642.      */
  12643.     public function createQuoteHistoryWithHttpInfo($xero_tenant_id$quote_id$history_records)
  12644.     {
  12645.         $request $this->createQuoteHistoryRequest($xero_tenant_id$quote_id$history_records);
  12646.         try {
  12647.             $options $this->createHttpClientOption();
  12648.             try {
  12649.                 $response $this->client->send($request$options);
  12650.             } catch (RequestException $e) {
  12651.                 throw new ApiException(
  12652.                     "[{$e->getCode()}{$e->getMessage()}",
  12653.                     $e->getCode(),
  12654.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  12655.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  12656.                 );
  12657.             }
  12658.             $statusCode $response->getStatusCode();
  12659.             if ($statusCode 200 || $statusCode 299) {
  12660.                 throw new ApiException(
  12661.                     sprintf(
  12662.                         '[%d] Error connecting to the API (%s)',
  12663.                         $statusCode,
  12664.                         $request->getUri()
  12665.                     ),
  12666.                     $statusCode,
  12667.                     $response->getHeaders(),
  12668.                     $response->getBody()
  12669.                 );
  12670.             }
  12671.             $responseBody $response->getBody();
  12672.             switch($statusCode) {
  12673.                 case 200:
  12674.                     if ('\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords' === '\SplFileObject') {
  12675.                         $content $responseBody//stream goes to serializer
  12676.                     } else {
  12677.                         $content $responseBody->getContents();
  12678.                     }
  12679.                     return [
  12680.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords', []),
  12681.                         $response->getStatusCode(),
  12682.                         $response->getHeaders()
  12683.                     ];
  12684.                 case 400:
  12685.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  12686.                         $content $responseBody//stream goes to serializer
  12687.                     } else {
  12688.                         $content $responseBody->getContents();
  12689.                     }
  12690.                     return [
  12691.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  12692.                         $response->getStatusCode(),
  12693.                         $response->getHeaders()
  12694.                     ];
  12695.             }
  12696.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  12697.             $responseBody $response->getBody();
  12698.             if ($returnType === '\SplFileObject') {
  12699.                 $content $responseBody//stream goes to serializer
  12700.             } else {
  12701.                 $content $responseBody->getContents();
  12702.             }
  12703.             return [
  12704.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  12705.                 $response->getStatusCode(),
  12706.                 $response->getHeaders()
  12707.             ];
  12708.         } catch (ApiException $e) {
  12709.             switch ($e->getCode()) {
  12710.                 case 200:
  12711.                     $data AccountingObjectSerializer::deserialize(
  12712.                         $e->getResponseBody(),
  12713.                         '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords',
  12714.                         $e->getResponseHeaders()
  12715.                     );
  12716.                     $e->setResponseObject($data);
  12717.                     break;
  12718.                 case 400:
  12719.                     $data AccountingObjectSerializer::deserialize(
  12720.                         $e->getResponseBody(),
  12721.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  12722.                         $e->getResponseHeaders()
  12723.                     );
  12724.                     $e->setResponseObject($data);
  12725.                     break;
  12726.             }
  12727.             throw $e;
  12728.         }
  12729.     }
  12730.     /**
  12731.      * Operation createQuoteHistoryAsync
  12732.      * Creates a history record for a specific quote
  12733.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  12734.      * @param  string $quote_id Unique identifier for an Quote (required)
  12735.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  12736.      * @throws \InvalidArgumentException
  12737.      * @return \GuzzleHttp\Promise\PromiseInterface
  12738.      */
  12739.     public function createQuoteHistoryAsync($xero_tenant_id$quote_id$history_records)
  12740.     {
  12741.         return $this->createQuoteHistoryAsyncWithHttpInfo($xero_tenant_id$quote_id$history_records)
  12742.             ->then(
  12743.                 function ($response) {
  12744.                     return $response[0];
  12745.                 }
  12746.             );
  12747.     }
  12748.     /**
  12749.      * Operation createQuoteHistoryAsyncWithHttpInfo
  12750.      * Creates a history record for a specific quote
  12751.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  12752.      * @param  string $quote_id Unique identifier for an Quote (required)
  12753.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  12754.      * @throws \InvalidArgumentException
  12755.      * @return \GuzzleHttp\Promise\PromiseInterface */
  12756.     public function createQuoteHistoryAsyncWithHttpInfo($xero_tenant_id$quote_id$history_records)
  12757.     {
  12758.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  12759.         $request $this->createQuoteHistoryRequest($xero_tenant_id$quote_id$history_records);
  12760.         return $this->client
  12761.             ->sendAsync($request$this->createHttpClientOption())
  12762.             ->then(
  12763.                 function ($response) use ($returnType) {
  12764.                     $responseBody $response->getBody();
  12765.                     if ($returnType === '\SplFileObject') {
  12766.                         $content $responseBody//stream goes to serializer
  12767.                     } else {
  12768.                         $content $responseBody->getContents();
  12769.                     }
  12770.                     return [
  12771.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  12772.                         $response->getStatusCode(),
  12773.                         $response->getHeaders()
  12774.                     ];
  12775.                 },
  12776.                 function ($exception) {
  12777.                     $response $exception->getResponse();
  12778.                     $statusCode $response->getStatusCode();
  12779.                     throw new ApiException(
  12780.                         sprintf(
  12781.                             '[%d] Error connecting to the API (%s)',
  12782.                             $statusCode,
  12783.                             $exception->getRequest()->getUri()
  12784.                         ),
  12785.                         $statusCode,
  12786.                         $response->getHeaders(),
  12787.                         $response->getBody()
  12788.                     );
  12789.                 }
  12790.             );
  12791.     }
  12792.     /**
  12793.      * Create request for operation 'createQuoteHistory'
  12794.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  12795.      * @param  string $quote_id Unique identifier for an Quote (required)
  12796.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  12797.      * @throws \InvalidArgumentException
  12798.      * @return \GuzzleHttp\Psr7\Request  */
  12799.     protected function createQuoteHistoryRequest($xero_tenant_id$quote_id$history_records)
  12800.     {
  12801.         // verify the required parameter 'xero_tenant_id' is set
  12802.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  12803.             throw new \InvalidArgumentException(
  12804.                 'Missing the required parameter $xero_tenant_id when calling createQuoteHistory'
  12805.             );
  12806.         }
  12807.         // verify the required parameter 'quote_id' is set
  12808.         if ($quote_id === null || (is_array($quote_id) && count($quote_id) === 0)) {
  12809.             throw new \InvalidArgumentException(
  12810.                 'Missing the required parameter $quote_id when calling createQuoteHistory'
  12811.             );
  12812.         }
  12813.         // verify the required parameter 'history_records' is set
  12814.         if ($history_records === null || (is_array($history_records) && count($history_records) === 0)) {
  12815.             throw new \InvalidArgumentException(
  12816.                 'Missing the required parameter $history_records when calling createQuoteHistory'
  12817.             );
  12818.         }
  12819.         $resourcePath '/Quotes/{QuoteID}/History';
  12820.         $formParams = [];
  12821.         $queryParams = [];
  12822.         $headerParams = [];
  12823.         $httpBody '';
  12824.         $multipart false;
  12825.         // header params
  12826.         if ($xero_tenant_id !== null) {
  12827.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  12828.         }
  12829.         // path params
  12830.         if ($quote_id !== null) {
  12831.             $resourcePath str_replace(
  12832.                 '{' 'QuoteID' '}',
  12833.                 AccountingObjectSerializer::toPathValue($quote_id),
  12834.                 $resourcePath
  12835.             );
  12836.         }
  12837.         // body params
  12838.         $_tempBody null;
  12839.         if (isset($history_records)) {
  12840.             $_tempBody $history_records;
  12841.         }
  12842.         if ($multipart) {
  12843.             $headers $this->headerSelector->selectHeadersForMultipart(
  12844.                 ['application/json']
  12845.             );
  12846.         } else {
  12847.             $headers $this->headerSelector->selectHeaders(
  12848.                 ['application/json'],
  12849.                 ['application/json']
  12850.             );
  12851.         }
  12852.         // for model (json/xml)
  12853.         if (isset($_tempBody)) {
  12854.             // $_tempBody is the method argument, if present
  12855.             if ($headers['Content-Type'] === 'application/json') {
  12856.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  12857.             } else {
  12858.                 $httpBody $_tempBody;
  12859.             }
  12860.         } elseif (count($formParams) > 0) {
  12861.             if ($multipart) {
  12862.                 $multipartContents = [
  12863.                     [
  12864.                         'Content-type' => 'multipart/form-data',
  12865.                     ]
  12866.                 ];
  12867.                 
  12868.                 // for HTTP post (form)
  12869.                 $httpBody = new MultipartStream($multipartContents);
  12870.             } elseif ($headers['Content-Type'] === 'application/json') {
  12871.                 $httpBody \GuzzleHttp\json_encode($formParams);
  12872.             } else {
  12873.                 // for HTTP post (form)
  12874.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  12875.             }
  12876.         }
  12877.         // this endpoint requires OAuth (access token)
  12878.         if ($this->config->getAccessToken() !== null) {
  12879.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  12880.         }
  12881.         $defaultHeaders = [];
  12882.         if ($this->config->getUserAgent()) {
  12883.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  12884.         }
  12885.         $headers array_merge(
  12886.             $defaultHeaders,
  12887.             $headerParams,
  12888.             $headers
  12889.         );
  12890.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  12891.         return new Request(
  12892.             'PUT',
  12893.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  12894.             $headers,
  12895.             $httpBody
  12896.         );
  12897.     }
  12898.     /**
  12899.      * Operation createQuotes
  12900.      * Create one or more quotes
  12901.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  12902.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Quotes $quotes Quotes with an array of Quote object in body of request (required)
  12903.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  12904.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  12905.      * @throws \InvalidArgumentException
  12906.      * @return \XeroAPI\XeroPHP\Models\Accounting\Quotes|\XeroAPI\XeroPHP\Models\Accounting\Error
  12907.      */
  12908.     public function createQuotes($xero_tenant_id$quotes$summarize_errors false)
  12909.     {
  12910.         list($response) = $this->createQuotesWithHttpInfo($xero_tenant_id$quotes$summarize_errors);
  12911.         return $response;
  12912.     }
  12913.     /**
  12914.      * Operation createQuotesWithHttpInfo
  12915.      * Create one or more quotes
  12916.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  12917.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Quotes $quotes Quotes with an array of Quote object in body of request (required)
  12918.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  12919.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  12920.      * @throws \InvalidArgumentException
  12921.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Quotes|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  12922.      */
  12923.     public function createQuotesWithHttpInfo($xero_tenant_id$quotes$summarize_errors false)
  12924.     {
  12925.         $request $this->createQuotesRequest($xero_tenant_id$quotes$summarize_errors);
  12926.         try {
  12927.             $options $this->createHttpClientOption();
  12928.             try {
  12929.                 $response $this->client->send($request$options);
  12930.             } catch (RequestException $e) {
  12931.                 throw new ApiException(
  12932.                     "[{$e->getCode()}{$e->getMessage()}",
  12933.                     $e->getCode(),
  12934.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  12935.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  12936.                 );
  12937.             }
  12938.             $statusCode $response->getStatusCode();
  12939.             if ($statusCode 200 || $statusCode 299) {
  12940.                 throw new ApiException(
  12941.                     sprintf(
  12942.                         '[%d] Error connecting to the API (%s)',
  12943.                         $statusCode,
  12944.                         $request->getUri()
  12945.                     ),
  12946.                     $statusCode,
  12947.                     $response->getHeaders(),
  12948.                     $response->getBody()
  12949.                 );
  12950.             }
  12951.             $responseBody $response->getBody();
  12952.             switch($statusCode) {
  12953.                 case 200:
  12954.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Quotes' === '\SplFileObject') {
  12955.                         $content $responseBody//stream goes to serializer
  12956.                     } else {
  12957.                         $content $responseBody->getContents();
  12958.                     }
  12959.                     return [
  12960.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Quotes', []),
  12961.                         $response->getStatusCode(),
  12962.                         $response->getHeaders()
  12963.                     ];
  12964.                 case 400:
  12965.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  12966.                         $content $responseBody//stream goes to serializer
  12967.                     } else {
  12968.                         $content $responseBody->getContents();
  12969.                     }
  12970.                     return [
  12971.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  12972.                         $response->getStatusCode(),
  12973.                         $response->getHeaders()
  12974.                     ];
  12975.             }
  12976.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Quotes';
  12977.             $responseBody $response->getBody();
  12978.             if ($returnType === '\SplFileObject') {
  12979.                 $content $responseBody//stream goes to serializer
  12980.             } else {
  12981.                 $content $responseBody->getContents();
  12982.             }
  12983.             return [
  12984.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  12985.                 $response->getStatusCode(),
  12986.                 $response->getHeaders()
  12987.             ];
  12988.         } catch (ApiException $e) {
  12989.             switch ($e->getCode()) {
  12990.                 case 200:
  12991.                     $data AccountingObjectSerializer::deserialize(
  12992.                         $e->getResponseBody(),
  12993.                         '\XeroAPI\XeroPHP\Models\Accounting\Quotes',
  12994.                         $e->getResponseHeaders()
  12995.                     );
  12996.                     $e->setResponseObject($data);
  12997.                     break;
  12998.                 case 400:
  12999.                     $data AccountingObjectSerializer::deserialize(
  13000.                         $e->getResponseBody(),
  13001.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  13002.                         $e->getResponseHeaders()
  13003.                     );
  13004.                     $e->setResponseObject($data);
  13005.                     break;
  13006.             }
  13007.             throw $e;
  13008.         }
  13009.     }
  13010.     /**
  13011.      * Operation createQuotesAsync
  13012.      * Create one or more quotes
  13013.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  13014.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Quotes $quotes Quotes with an array of Quote object in body of request (required)
  13015.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  13016.      * @throws \InvalidArgumentException
  13017.      * @return \GuzzleHttp\Promise\PromiseInterface
  13018.      */
  13019.     public function createQuotesAsync($xero_tenant_id$quotes$summarize_errors false)
  13020.     {
  13021.         return $this->createQuotesAsyncWithHttpInfo($xero_tenant_id$quotes$summarize_errors)
  13022.             ->then(
  13023.                 function ($response) {
  13024.                     return $response[0];
  13025.                 }
  13026.             );
  13027.     }
  13028.     /**
  13029.      * Operation createQuotesAsyncWithHttpInfo
  13030.      * Create one or more quotes
  13031.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  13032.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Quotes $quotes Quotes with an array of Quote object in body of request (required)
  13033.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  13034.      * @throws \InvalidArgumentException
  13035.      * @return \GuzzleHttp\Promise\PromiseInterface */
  13036.     public function createQuotesAsyncWithHttpInfo($xero_tenant_id$quotes$summarize_errors false)
  13037.     {
  13038.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Quotes';
  13039.         $request $this->createQuotesRequest($xero_tenant_id$quotes$summarize_errors);
  13040.         return $this->client
  13041.             ->sendAsync($request$this->createHttpClientOption())
  13042.             ->then(
  13043.                 function ($response) use ($returnType) {
  13044.                     $responseBody $response->getBody();
  13045.                     if ($returnType === '\SplFileObject') {
  13046.                         $content $responseBody//stream goes to serializer
  13047.                     } else {
  13048.                         $content $responseBody->getContents();
  13049.                     }
  13050.                     return [
  13051.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  13052.                         $response->getStatusCode(),
  13053.                         $response->getHeaders()
  13054.                     ];
  13055.                 },
  13056.                 function ($exception) {
  13057.                     $response $exception->getResponse();
  13058.                     $statusCode $response->getStatusCode();
  13059.                     throw new ApiException(
  13060.                         sprintf(
  13061.                             '[%d] Error connecting to the API (%s)',
  13062.                             $statusCode,
  13063.                             $exception->getRequest()->getUri()
  13064.                         ),
  13065.                         $statusCode,
  13066.                         $response->getHeaders(),
  13067.                         $response->getBody()
  13068.                     );
  13069.                 }
  13070.             );
  13071.     }
  13072.     /**
  13073.      * Create request for operation 'createQuotes'
  13074.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  13075.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Quotes $quotes Quotes with an array of Quote object in body of request (required)
  13076.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  13077.      * @throws \InvalidArgumentException
  13078.      * @return \GuzzleHttp\Psr7\Request  */
  13079.     protected function createQuotesRequest($xero_tenant_id$quotes$summarize_errors false)
  13080.     {
  13081.         // verify the required parameter 'xero_tenant_id' is set
  13082.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  13083.             throw new \InvalidArgumentException(
  13084.                 'Missing the required parameter $xero_tenant_id when calling createQuotes'
  13085.             );
  13086.         }
  13087.         // verify the required parameter 'quotes' is set
  13088.         if ($quotes === null || (is_array($quotes) && count($quotes) === 0)) {
  13089.             throw new \InvalidArgumentException(
  13090.                 'Missing the required parameter $quotes when calling createQuotes'
  13091.             );
  13092.         }
  13093.         $resourcePath '/Quotes';
  13094.         $formParams = [];
  13095.         $queryParams = [];
  13096.         $headerParams = [];
  13097.         $httpBody '';
  13098.         $multipart false;
  13099.         // query params
  13100.         if ($summarize_errors !== null) {
  13101.             $queryParams['summarizeErrors'] = $summarize_errors 'true' 'false';
  13102.         }
  13103.         // header params
  13104.         if ($xero_tenant_id !== null) {
  13105.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  13106.         }
  13107.         // body params
  13108.         $_tempBody null;
  13109.         if (isset($quotes)) {
  13110.             $_tempBody $quotes;
  13111.         }
  13112.         if ($multipart) {
  13113.             $headers $this->headerSelector->selectHeadersForMultipart(
  13114.                 ['application/json']
  13115.             );
  13116.         } else {
  13117.             $headers $this->headerSelector->selectHeaders(
  13118.                 ['application/json'],
  13119.                 ['application/json']
  13120.             );
  13121.         }
  13122.         // for model (json/xml)
  13123.         if (isset($_tempBody)) {
  13124.             // $_tempBody is the method argument, if present
  13125.             if ($headers['Content-Type'] === 'application/json') {
  13126.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  13127.             } else {
  13128.                 $httpBody $_tempBody;
  13129.             }
  13130.         } elseif (count($formParams) > 0) {
  13131.             if ($multipart) {
  13132.                 $multipartContents = [
  13133.                     [
  13134.                         'Content-type' => 'multipart/form-data',
  13135.                     ]
  13136.                 ];
  13137.                 
  13138.                 // for HTTP post (form)
  13139.                 $httpBody = new MultipartStream($multipartContents);
  13140.             } elseif ($headers['Content-Type'] === 'application/json') {
  13141.                 $httpBody \GuzzleHttp\json_encode($formParams);
  13142.             } else {
  13143.                 // for HTTP post (form)
  13144.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  13145.             }
  13146.         }
  13147.         // this endpoint requires OAuth (access token)
  13148.         if ($this->config->getAccessToken() !== null) {
  13149.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  13150.         }
  13151.         $defaultHeaders = [];
  13152.         if ($this->config->getUserAgent()) {
  13153.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  13154.         }
  13155.         $headers array_merge(
  13156.             $defaultHeaders,
  13157.             $headerParams,
  13158.             $headers
  13159.         );
  13160.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  13161.         return new Request(
  13162.             'PUT',
  13163.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  13164.             $headers,
  13165.             $httpBody
  13166.         );
  13167.     }
  13168.     /**
  13169.      * Operation createReceipt
  13170.      * Creates draft expense claim receipts for any user
  13171.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  13172.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Receipts $receipts Receipts with an array of Receipt object in body of request (required)
  13173.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  13174.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  13175.      * @throws \InvalidArgumentException
  13176.      * @return \XeroAPI\XeroPHP\Models\Accounting\Receipts|\XeroAPI\XeroPHP\Models\Accounting\Error
  13177.      */
  13178.     public function createReceipt($xero_tenant_id$receipts$unitdp null)
  13179.     {
  13180.         list($response) = $this->createReceiptWithHttpInfo($xero_tenant_id$receipts$unitdp);
  13181.         return $response;
  13182.     }
  13183.     /**
  13184.      * Operation createReceiptWithHttpInfo
  13185.      * Creates draft expense claim receipts for any user
  13186.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  13187.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Receipts $receipts Receipts with an array of Receipt object in body of request (required)
  13188.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  13189.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  13190.      * @throws \InvalidArgumentException
  13191.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Receipts|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  13192.      */
  13193.     public function createReceiptWithHttpInfo($xero_tenant_id$receipts$unitdp null)
  13194.     {
  13195.         $request $this->createReceiptRequest($xero_tenant_id$receipts$unitdp);
  13196.         try {
  13197.             $options $this->createHttpClientOption();
  13198.             try {
  13199.                 $response $this->client->send($request$options);
  13200.             } catch (RequestException $e) {
  13201.                 throw new ApiException(
  13202.                     "[{$e->getCode()}{$e->getMessage()}",
  13203.                     $e->getCode(),
  13204.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  13205.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  13206.                 );
  13207.             }
  13208.             $statusCode $response->getStatusCode();
  13209.             if ($statusCode 200 || $statusCode 299) {
  13210.                 throw new ApiException(
  13211.                     sprintf(
  13212.                         '[%d] Error connecting to the API (%s)',
  13213.                         $statusCode,
  13214.                         $request->getUri()
  13215.                     ),
  13216.                     $statusCode,
  13217.                     $response->getHeaders(),
  13218.                     $response->getBody()
  13219.                 );
  13220.             }
  13221.             $responseBody $response->getBody();
  13222.             switch($statusCode) {
  13223.                 case 200:
  13224.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Receipts' === '\SplFileObject') {
  13225.                         $content $responseBody//stream goes to serializer
  13226.                     } else {
  13227.                         $content $responseBody->getContents();
  13228.                     }
  13229.                     return [
  13230.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Receipts', []),
  13231.                         $response->getStatusCode(),
  13232.                         $response->getHeaders()
  13233.                     ];
  13234.                 case 400:
  13235.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  13236.                         $content $responseBody//stream goes to serializer
  13237.                     } else {
  13238.                         $content $responseBody->getContents();
  13239.                     }
  13240.                     return [
  13241.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  13242.                         $response->getStatusCode(),
  13243.                         $response->getHeaders()
  13244.                     ];
  13245.             }
  13246.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Receipts';
  13247.             $responseBody $response->getBody();
  13248.             if ($returnType === '\SplFileObject') {
  13249.                 $content $responseBody//stream goes to serializer
  13250.             } else {
  13251.                 $content $responseBody->getContents();
  13252.             }
  13253.             return [
  13254.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  13255.                 $response->getStatusCode(),
  13256.                 $response->getHeaders()
  13257.             ];
  13258.         } catch (ApiException $e) {
  13259.             switch ($e->getCode()) {
  13260.                 case 200:
  13261.                     $data AccountingObjectSerializer::deserialize(
  13262.                         $e->getResponseBody(),
  13263.                         '\XeroAPI\XeroPHP\Models\Accounting\Receipts',
  13264.                         $e->getResponseHeaders()
  13265.                     );
  13266.                     $e->setResponseObject($data);
  13267.                     break;
  13268.                 case 400:
  13269.                     $data AccountingObjectSerializer::deserialize(
  13270.                         $e->getResponseBody(),
  13271.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  13272.                         $e->getResponseHeaders()
  13273.                     );
  13274.                     $e->setResponseObject($data);
  13275.                     break;
  13276.             }
  13277.             throw $e;
  13278.         }
  13279.     }
  13280.     /**
  13281.      * Operation createReceiptAsync
  13282.      * Creates draft expense claim receipts for any user
  13283.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  13284.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Receipts $receipts Receipts with an array of Receipt object in body of request (required)
  13285.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  13286.      * @throws \InvalidArgumentException
  13287.      * @return \GuzzleHttp\Promise\PromiseInterface
  13288.      */
  13289.     public function createReceiptAsync($xero_tenant_id$receipts$unitdp null)
  13290.     {
  13291.         return $this->createReceiptAsyncWithHttpInfo($xero_tenant_id$receipts$unitdp)
  13292.             ->then(
  13293.                 function ($response) {
  13294.                     return $response[0];
  13295.                 }
  13296.             );
  13297.     }
  13298.     /**
  13299.      * Operation createReceiptAsyncWithHttpInfo
  13300.      * Creates draft expense claim receipts for any user
  13301.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  13302.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Receipts $receipts Receipts with an array of Receipt object in body of request (required)
  13303.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  13304.      * @throws \InvalidArgumentException
  13305.      * @return \GuzzleHttp\Promise\PromiseInterface */
  13306.     public function createReceiptAsyncWithHttpInfo($xero_tenant_id$receipts$unitdp null)
  13307.     {
  13308.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Receipts';
  13309.         $request $this->createReceiptRequest($xero_tenant_id$receipts$unitdp);
  13310.         return $this->client
  13311.             ->sendAsync($request$this->createHttpClientOption())
  13312.             ->then(
  13313.                 function ($response) use ($returnType) {
  13314.                     $responseBody $response->getBody();
  13315.                     if ($returnType === '\SplFileObject') {
  13316.                         $content $responseBody//stream goes to serializer
  13317.                     } else {
  13318.                         $content $responseBody->getContents();
  13319.                     }
  13320.                     return [
  13321.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  13322.                         $response->getStatusCode(),
  13323.                         $response->getHeaders()
  13324.                     ];
  13325.                 },
  13326.                 function ($exception) {
  13327.                     $response $exception->getResponse();
  13328.                     $statusCode $response->getStatusCode();
  13329.                     throw new ApiException(
  13330.                         sprintf(
  13331.                             '[%d] Error connecting to the API (%s)',
  13332.                             $statusCode,
  13333.                             $exception->getRequest()->getUri()
  13334.                         ),
  13335.                         $statusCode,
  13336.                         $response->getHeaders(),
  13337.                         $response->getBody()
  13338.                     );
  13339.                 }
  13340.             );
  13341.     }
  13342.     /**
  13343.      * Create request for operation 'createReceipt'
  13344.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  13345.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Receipts $receipts Receipts with an array of Receipt object in body of request (required)
  13346.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  13347.      * @throws \InvalidArgumentException
  13348.      * @return \GuzzleHttp\Psr7\Request  */
  13349.     protected function createReceiptRequest($xero_tenant_id$receipts$unitdp null)
  13350.     {
  13351.         // verify the required parameter 'xero_tenant_id' is set
  13352.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  13353.             throw new \InvalidArgumentException(
  13354.                 'Missing the required parameter $xero_tenant_id when calling createReceipt'
  13355.             );
  13356.         }
  13357.         // verify the required parameter 'receipts' is set
  13358.         if ($receipts === null || (is_array($receipts) && count($receipts) === 0)) {
  13359.             throw new \InvalidArgumentException(
  13360.                 'Missing the required parameter $receipts when calling createReceipt'
  13361.             );
  13362.         }
  13363.         $resourcePath '/Receipts';
  13364.         $formParams = [];
  13365.         $queryParams = [];
  13366.         $headerParams = [];
  13367.         $httpBody '';
  13368.         $multipart false;
  13369.         // query params
  13370.         if ($unitdp !== null) {
  13371.             $queryParams['unitdp'] = AccountingObjectSerializer::toQueryValue($unitdp);
  13372.         }
  13373.         // header params
  13374.         if ($xero_tenant_id !== null) {
  13375.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  13376.         }
  13377.         // body params
  13378.         $_tempBody null;
  13379.         if (isset($receipts)) {
  13380.             $_tempBody $receipts;
  13381.         }
  13382.         if ($multipart) {
  13383.             $headers $this->headerSelector->selectHeadersForMultipart(
  13384.                 ['application/json']
  13385.             );
  13386.         } else {
  13387.             $headers $this->headerSelector->selectHeaders(
  13388.                 ['application/json'],
  13389.                 ['application/json']
  13390.             );
  13391.         }
  13392.         // for model (json/xml)
  13393.         if (isset($_tempBody)) {
  13394.             // $_tempBody is the method argument, if present
  13395.             if ($headers['Content-Type'] === 'application/json') {
  13396.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  13397.             } else {
  13398.                 $httpBody $_tempBody;
  13399.             }
  13400.         } elseif (count($formParams) > 0) {
  13401.             if ($multipart) {
  13402.                 $multipartContents = [
  13403.                     [
  13404.                         'Content-type' => 'multipart/form-data',
  13405.                     ]
  13406.                 ];
  13407.                 
  13408.                 // for HTTP post (form)
  13409.                 $httpBody = new MultipartStream($multipartContents);
  13410.             } elseif ($headers['Content-Type'] === 'application/json') {
  13411.                 $httpBody \GuzzleHttp\json_encode($formParams);
  13412.             } else {
  13413.                 // for HTTP post (form)
  13414.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  13415.             }
  13416.         }
  13417.         // this endpoint requires OAuth (access token)
  13418.         if ($this->config->getAccessToken() !== null) {
  13419.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  13420.         }
  13421.         $defaultHeaders = [];
  13422.         if ($this->config->getUserAgent()) {
  13423.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  13424.         }
  13425.         $headers array_merge(
  13426.             $defaultHeaders,
  13427.             $headerParams,
  13428.             $headers
  13429.         );
  13430.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  13431.         return new Request(
  13432.             'PUT',
  13433.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  13434.             $headers,
  13435.             $httpBody
  13436.         );
  13437.     }
  13438.     /**
  13439.      * Operation createReceiptAttachmentByFileName
  13440.      * Creates an attachment on a specific expense claim receipts by file name
  13441.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  13442.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  13443.      * @param  string $file_name Name of the attachment (required)
  13444.      * @param  string $body Byte array of file in body of request (required)
  13445.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  13446.      * @throws \InvalidArgumentException
  13447.      * @return \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error
  13448.      */
  13449.     public function createReceiptAttachmentByFileName($xero_tenant_id$receipt_id$file_name$body)
  13450.     {
  13451.         list($response) = $this->createReceiptAttachmentByFileNameWithHttpInfo($xero_tenant_id$receipt_id$file_name$body);
  13452.         return $response;
  13453.     }
  13454.     /**
  13455.      * Operation createReceiptAttachmentByFileNameWithHttpInfo
  13456.      * Creates an attachment on a specific expense claim receipts by file name
  13457.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  13458.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  13459.      * @param  string $file_name Name of the attachment (required)
  13460.      * @param  string $body Byte array of file in body of request (required)
  13461.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  13462.      * @throws \InvalidArgumentException
  13463.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  13464.      */
  13465.     public function createReceiptAttachmentByFileNameWithHttpInfo($xero_tenant_id$receipt_id$file_name$body)
  13466.     {
  13467.         $request $this->createReceiptAttachmentByFileNameRequest($xero_tenant_id$receipt_id$file_name$body);
  13468.         try {
  13469.             $options $this->createHttpClientOption();
  13470.             try {
  13471.                 $response $this->client->send($request$options);
  13472.             } catch (RequestException $e) {
  13473.                 throw new ApiException(
  13474.                     "[{$e->getCode()}{$e->getMessage()}",
  13475.                     $e->getCode(),
  13476.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  13477.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  13478.                 );
  13479.             }
  13480.             $statusCode $response->getStatusCode();
  13481.             if ($statusCode 200 || $statusCode 299) {
  13482.                 throw new ApiException(
  13483.                     sprintf(
  13484.                         '[%d] Error connecting to the API (%s)',
  13485.                         $statusCode,
  13486.                         $request->getUri()
  13487.                     ),
  13488.                     $statusCode,
  13489.                     $response->getHeaders(),
  13490.                     $response->getBody()
  13491.                 );
  13492.             }
  13493.             $responseBody $response->getBody();
  13494.             switch($statusCode) {
  13495.                 case 200:
  13496.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Attachments' === '\SplFileObject') {
  13497.                         $content $responseBody//stream goes to serializer
  13498.                     } else {
  13499.                         $content $responseBody->getContents();
  13500.                     }
  13501.                     return [
  13502.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Attachments', []),
  13503.                         $response->getStatusCode(),
  13504.                         $response->getHeaders()
  13505.                     ];
  13506.                 case 400:
  13507.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  13508.                         $content $responseBody//stream goes to serializer
  13509.                     } else {
  13510.                         $content $responseBody->getContents();
  13511.                     }
  13512.                     return [
  13513.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  13514.                         $response->getStatusCode(),
  13515.                         $response->getHeaders()
  13516.                     ];
  13517.             }
  13518.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  13519.             $responseBody $response->getBody();
  13520.             if ($returnType === '\SplFileObject') {
  13521.                 $content $responseBody//stream goes to serializer
  13522.             } else {
  13523.                 $content $responseBody->getContents();
  13524.             }
  13525.             return [
  13526.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  13527.                 $response->getStatusCode(),
  13528.                 $response->getHeaders()
  13529.             ];
  13530.         } catch (ApiException $e) {
  13531.             switch ($e->getCode()) {
  13532.                 case 200:
  13533.                     $data AccountingObjectSerializer::deserialize(
  13534.                         $e->getResponseBody(),
  13535.                         '\XeroAPI\XeroPHP\Models\Accounting\Attachments',
  13536.                         $e->getResponseHeaders()
  13537.                     );
  13538.                     $e->setResponseObject($data);
  13539.                     break;
  13540.                 case 400:
  13541.                     $data AccountingObjectSerializer::deserialize(
  13542.                         $e->getResponseBody(),
  13543.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  13544.                         $e->getResponseHeaders()
  13545.                     );
  13546.                     $e->setResponseObject($data);
  13547.                     break;
  13548.             }
  13549.             throw $e;
  13550.         }
  13551.     }
  13552.     /**
  13553.      * Operation createReceiptAttachmentByFileNameAsync
  13554.      * Creates an attachment on a specific expense claim receipts by file name
  13555.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  13556.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  13557.      * @param  string $file_name Name of the attachment (required)
  13558.      * @param  string $body Byte array of file in body of request (required)
  13559.      * @throws \InvalidArgumentException
  13560.      * @return \GuzzleHttp\Promise\PromiseInterface
  13561.      */
  13562.     public function createReceiptAttachmentByFileNameAsync($xero_tenant_id$receipt_id$file_name$body)
  13563.     {
  13564.         return $this->createReceiptAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$receipt_id$file_name$body)
  13565.             ->then(
  13566.                 function ($response) {
  13567.                     return $response[0];
  13568.                 }
  13569.             );
  13570.     }
  13571.     /**
  13572.      * Operation createReceiptAttachmentByFileNameAsyncWithHttpInfo
  13573.      * Creates an attachment on a specific expense claim receipts by file name
  13574.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  13575.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  13576.      * @param  string $file_name Name of the attachment (required)
  13577.      * @param  string $body Byte array of file in body of request (required)
  13578.      * @throws \InvalidArgumentException
  13579.      * @return \GuzzleHttp\Promise\PromiseInterface */
  13580.     public function createReceiptAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$receipt_id$file_name$body)
  13581.     {
  13582.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  13583.         $request $this->createReceiptAttachmentByFileNameRequest($xero_tenant_id$receipt_id$file_name$body);
  13584.         return $this->client
  13585.             ->sendAsync($request$this->createHttpClientOption())
  13586.             ->then(
  13587.                 function ($response) use ($returnType) {
  13588.                     $responseBody $response->getBody();
  13589.                     if ($returnType === '\SplFileObject') {
  13590.                         $content $responseBody//stream goes to serializer
  13591.                     } else {
  13592.                         $content $responseBody->getContents();
  13593.                     }
  13594.                     return [
  13595.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  13596.                         $response->getStatusCode(),
  13597.                         $response->getHeaders()
  13598.                     ];
  13599.                 },
  13600.                 function ($exception) {
  13601.                     $response $exception->getResponse();
  13602.                     $statusCode $response->getStatusCode();
  13603.                     throw new ApiException(
  13604.                         sprintf(
  13605.                             '[%d] Error connecting to the API (%s)',
  13606.                             $statusCode,
  13607.                             $exception->getRequest()->getUri()
  13608.                         ),
  13609.                         $statusCode,
  13610.                         $response->getHeaders(),
  13611.                         $response->getBody()
  13612.                     );
  13613.                 }
  13614.             );
  13615.     }
  13616.     /**
  13617.      * Create request for operation 'createReceiptAttachmentByFileName'
  13618.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  13619.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  13620.      * @param  string $file_name Name of the attachment (required)
  13621.      * @param  string $body Byte array of file in body of request (required)
  13622.      * @throws \InvalidArgumentException
  13623.      * @return \GuzzleHttp\Psr7\Request  */
  13624.     protected function createReceiptAttachmentByFileNameRequest($xero_tenant_id$receipt_id$file_name$body)
  13625.     {
  13626.         // verify the required parameter 'xero_tenant_id' is set
  13627.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  13628.             throw new \InvalidArgumentException(
  13629.                 'Missing the required parameter $xero_tenant_id when calling createReceiptAttachmentByFileName'
  13630.             );
  13631.         }
  13632.         // verify the required parameter 'receipt_id' is set
  13633.         if ($receipt_id === null || (is_array($receipt_id) && count($receipt_id) === 0)) {
  13634.             throw new \InvalidArgumentException(
  13635.                 'Missing the required parameter $receipt_id when calling createReceiptAttachmentByFileName'
  13636.             );
  13637.         }
  13638.         // verify the required parameter 'file_name' is set
  13639.         if ($file_name === null || (is_array($file_name) && count($file_name) === 0)) {
  13640.             throw new \InvalidArgumentException(
  13641.                 'Missing the required parameter $file_name when calling createReceiptAttachmentByFileName'
  13642.             );
  13643.         }
  13644.         // verify the required parameter 'body' is set
  13645.         if ($body === null || (is_array($body) && count($body) === 0)) {
  13646.             throw new \InvalidArgumentException(
  13647.                 'Missing the required parameter $body when calling createReceiptAttachmentByFileName'
  13648.             );
  13649.         }
  13650.         $resourcePath '/Receipts/{ReceiptID}/Attachments/{FileName}';
  13651.         $formParams = [];
  13652.         $queryParams = [];
  13653.         $headerParams = [];
  13654.         $httpBody '';
  13655.         $multipart false;
  13656.         // header params
  13657.         if ($xero_tenant_id !== null) {
  13658.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  13659.         }
  13660.         // path params
  13661.         if ($receipt_id !== null) {
  13662.             $resourcePath str_replace(
  13663.                 '{' 'ReceiptID' '}',
  13664.                 AccountingObjectSerializer::toPathValue($receipt_id),
  13665.                 $resourcePath
  13666.             );
  13667.         }
  13668.         // path params
  13669.         if ($file_name !== null) {
  13670.             $resourcePath str_replace(
  13671.                 '{' 'FileName' '}',
  13672.                 AccountingObjectSerializer::toPathValue($file_name),
  13673.                 $resourcePath
  13674.             );
  13675.         }
  13676.         // body params
  13677.         $_tempBody null;
  13678.         if (isset($body)) {
  13679.             $_tempBody $body;
  13680.         }
  13681.         if ($multipart) {
  13682.             $headers $this->headerSelector->selectHeadersForMultipart(
  13683.                 ['application/json']
  13684.             );
  13685.         } else {
  13686.             $headers $this->headerSelector->selectHeaders(
  13687.                 ['application/json'],
  13688.                 ['application/octet-stream']
  13689.             );
  13690.         }
  13691.         // for model (json/xml)
  13692.         if (isset($_tempBody)) {
  13693.             // $_tempBody is the method argument, if present
  13694.             if ($headers['Content-Type'] === 'application/json') {
  13695.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  13696.             } else {
  13697.                 $httpBody $_tempBody;
  13698.             }
  13699.         } elseif (count($formParams) > 0) {
  13700.             if ($multipart) {
  13701.                 $multipartContents = [
  13702.                     [
  13703.                         'Content-type' => 'multipart/form-data',
  13704.                     ]
  13705.                 ];
  13706.                 
  13707.                 // for HTTP post (form)
  13708.                 $httpBody = new MultipartStream($multipartContents);
  13709.             } elseif ($headers['Content-Type'] === 'application/json') {
  13710.                 $httpBody \GuzzleHttp\json_encode($formParams);
  13711.             } else {
  13712.                 // for HTTP post (form)
  13713.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  13714.             }
  13715.         }
  13716.         // this endpoint requires OAuth (access token)
  13717.         if ($this->config->getAccessToken() !== null) {
  13718.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  13719.         }
  13720.         $defaultHeaders = [];
  13721.         if ($this->config->getUserAgent()) {
  13722.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  13723.         }
  13724.         $headers array_merge(
  13725.             $defaultHeaders,
  13726.             $headerParams,
  13727.             $headers
  13728.         );
  13729.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  13730.         return new Request(
  13731.             'PUT',
  13732.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  13733.             $headers,
  13734.             $httpBody
  13735.         );
  13736.     }
  13737.     /**
  13738.      * Operation createReceiptHistory
  13739.      * Creates a history record for a specific receipt
  13740.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  13741.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  13742.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  13743.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  13744.      * @throws \InvalidArgumentException
  13745.      * @return \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords|\XeroAPI\XeroPHP\Models\Accounting\Error
  13746.      */
  13747.     public function createReceiptHistory($xero_tenant_id$receipt_id$history_records)
  13748.     {
  13749.         list($response) = $this->createReceiptHistoryWithHttpInfo($xero_tenant_id$receipt_id$history_records);
  13750.         return $response;
  13751.     }
  13752.     /**
  13753.      * Operation createReceiptHistoryWithHttpInfo
  13754.      * Creates a history record for a specific receipt
  13755.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  13756.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  13757.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  13758.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  13759.      * @throws \InvalidArgumentException
  13760.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  13761.      */
  13762.     public function createReceiptHistoryWithHttpInfo($xero_tenant_id$receipt_id$history_records)
  13763.     {
  13764.         $request $this->createReceiptHistoryRequest($xero_tenant_id$receipt_id$history_records);
  13765.         try {
  13766.             $options $this->createHttpClientOption();
  13767.             try {
  13768.                 $response $this->client->send($request$options);
  13769.             } catch (RequestException $e) {
  13770.                 throw new ApiException(
  13771.                     "[{$e->getCode()}{$e->getMessage()}",
  13772.                     $e->getCode(),
  13773.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  13774.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  13775.                 );
  13776.             }
  13777.             $statusCode $response->getStatusCode();
  13778.             if ($statusCode 200 || $statusCode 299) {
  13779.                 throw new ApiException(
  13780.                     sprintf(
  13781.                         '[%d] Error connecting to the API (%s)',
  13782.                         $statusCode,
  13783.                         $request->getUri()
  13784.                     ),
  13785.                     $statusCode,
  13786.                     $response->getHeaders(),
  13787.                     $response->getBody()
  13788.                 );
  13789.             }
  13790.             $responseBody $response->getBody();
  13791.             switch($statusCode) {
  13792.                 case 200:
  13793.                     if ('\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords' === '\SplFileObject') {
  13794.                         $content $responseBody//stream goes to serializer
  13795.                     } else {
  13796.                         $content $responseBody->getContents();
  13797.                     }
  13798.                     return [
  13799.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords', []),
  13800.                         $response->getStatusCode(),
  13801.                         $response->getHeaders()
  13802.                     ];
  13803.                 case 400:
  13804.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  13805.                         $content $responseBody//stream goes to serializer
  13806.                     } else {
  13807.                         $content $responseBody->getContents();
  13808.                     }
  13809.                     return [
  13810.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  13811.                         $response->getStatusCode(),
  13812.                         $response->getHeaders()
  13813.                     ];
  13814.             }
  13815.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  13816.             $responseBody $response->getBody();
  13817.             if ($returnType === '\SplFileObject') {
  13818.                 $content $responseBody//stream goes to serializer
  13819.             } else {
  13820.                 $content $responseBody->getContents();
  13821.             }
  13822.             return [
  13823.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  13824.                 $response->getStatusCode(),
  13825.                 $response->getHeaders()
  13826.             ];
  13827.         } catch (ApiException $e) {
  13828.             switch ($e->getCode()) {
  13829.                 case 200:
  13830.                     $data AccountingObjectSerializer::deserialize(
  13831.                         $e->getResponseBody(),
  13832.                         '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords',
  13833.                         $e->getResponseHeaders()
  13834.                     );
  13835.                     $e->setResponseObject($data);
  13836.                     break;
  13837.                 case 400:
  13838.                     $data AccountingObjectSerializer::deserialize(
  13839.                         $e->getResponseBody(),
  13840.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  13841.                         $e->getResponseHeaders()
  13842.                     );
  13843.                     $e->setResponseObject($data);
  13844.                     break;
  13845.             }
  13846.             throw $e;
  13847.         }
  13848.     }
  13849.     /**
  13850.      * Operation createReceiptHistoryAsync
  13851.      * Creates a history record for a specific receipt
  13852.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  13853.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  13854.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  13855.      * @throws \InvalidArgumentException
  13856.      * @return \GuzzleHttp\Promise\PromiseInterface
  13857.      */
  13858.     public function createReceiptHistoryAsync($xero_tenant_id$receipt_id$history_records)
  13859.     {
  13860.         return $this->createReceiptHistoryAsyncWithHttpInfo($xero_tenant_id$receipt_id$history_records)
  13861.             ->then(
  13862.                 function ($response) {
  13863.                     return $response[0];
  13864.                 }
  13865.             );
  13866.     }
  13867.     /**
  13868.      * Operation createReceiptHistoryAsyncWithHttpInfo
  13869.      * Creates a history record for a specific receipt
  13870.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  13871.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  13872.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  13873.      * @throws \InvalidArgumentException
  13874.      * @return \GuzzleHttp\Promise\PromiseInterface */
  13875.     public function createReceiptHistoryAsyncWithHttpInfo($xero_tenant_id$receipt_id$history_records)
  13876.     {
  13877.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  13878.         $request $this->createReceiptHistoryRequest($xero_tenant_id$receipt_id$history_records);
  13879.         return $this->client
  13880.             ->sendAsync($request$this->createHttpClientOption())
  13881.             ->then(
  13882.                 function ($response) use ($returnType) {
  13883.                     $responseBody $response->getBody();
  13884.                     if ($returnType === '\SplFileObject') {
  13885.                         $content $responseBody//stream goes to serializer
  13886.                     } else {
  13887.                         $content $responseBody->getContents();
  13888.                     }
  13889.                     return [
  13890.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  13891.                         $response->getStatusCode(),
  13892.                         $response->getHeaders()
  13893.                     ];
  13894.                 },
  13895.                 function ($exception) {
  13896.                     $response $exception->getResponse();
  13897.                     $statusCode $response->getStatusCode();
  13898.                     throw new ApiException(
  13899.                         sprintf(
  13900.                             '[%d] Error connecting to the API (%s)',
  13901.                             $statusCode,
  13902.                             $exception->getRequest()->getUri()
  13903.                         ),
  13904.                         $statusCode,
  13905.                         $response->getHeaders(),
  13906.                         $response->getBody()
  13907.                     );
  13908.                 }
  13909.             );
  13910.     }
  13911.     /**
  13912.      * Create request for operation 'createReceiptHistory'
  13913.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  13914.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  13915.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  13916.      * @throws \InvalidArgumentException
  13917.      * @return \GuzzleHttp\Psr7\Request  */
  13918.     protected function createReceiptHistoryRequest($xero_tenant_id$receipt_id$history_records)
  13919.     {
  13920.         // verify the required parameter 'xero_tenant_id' is set
  13921.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  13922.             throw new \InvalidArgumentException(
  13923.                 'Missing the required parameter $xero_tenant_id when calling createReceiptHistory'
  13924.             );
  13925.         }
  13926.         // verify the required parameter 'receipt_id' is set
  13927.         if ($receipt_id === null || (is_array($receipt_id) && count($receipt_id) === 0)) {
  13928.             throw new \InvalidArgumentException(
  13929.                 'Missing the required parameter $receipt_id when calling createReceiptHistory'
  13930.             );
  13931.         }
  13932.         // verify the required parameter 'history_records' is set
  13933.         if ($history_records === null || (is_array($history_records) && count($history_records) === 0)) {
  13934.             throw new \InvalidArgumentException(
  13935.                 'Missing the required parameter $history_records when calling createReceiptHistory'
  13936.             );
  13937.         }
  13938.         $resourcePath '/Receipts/{ReceiptID}/History';
  13939.         $formParams = [];
  13940.         $queryParams = [];
  13941.         $headerParams = [];
  13942.         $httpBody '';
  13943.         $multipart false;
  13944.         // header params
  13945.         if ($xero_tenant_id !== null) {
  13946.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  13947.         }
  13948.         // path params
  13949.         if ($receipt_id !== null) {
  13950.             $resourcePath str_replace(
  13951.                 '{' 'ReceiptID' '}',
  13952.                 AccountingObjectSerializer::toPathValue($receipt_id),
  13953.                 $resourcePath
  13954.             );
  13955.         }
  13956.         // body params
  13957.         $_tempBody null;
  13958.         if (isset($history_records)) {
  13959.             $_tempBody $history_records;
  13960.         }
  13961.         if ($multipart) {
  13962.             $headers $this->headerSelector->selectHeadersForMultipart(
  13963.                 ['application/json']
  13964.             );
  13965.         } else {
  13966.             $headers $this->headerSelector->selectHeaders(
  13967.                 ['application/json'],
  13968.                 ['application/json']
  13969.             );
  13970.         }
  13971.         // for model (json/xml)
  13972.         if (isset($_tempBody)) {
  13973.             // $_tempBody is the method argument, if present
  13974.             if ($headers['Content-Type'] === 'application/json') {
  13975.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  13976.             } else {
  13977.                 $httpBody $_tempBody;
  13978.             }
  13979.         } elseif (count($formParams) > 0) {
  13980.             if ($multipart) {
  13981.                 $multipartContents = [
  13982.                     [
  13983.                         'Content-type' => 'multipart/form-data',
  13984.                     ]
  13985.                 ];
  13986.                 
  13987.                 // for HTTP post (form)
  13988.                 $httpBody = new MultipartStream($multipartContents);
  13989.             } elseif ($headers['Content-Type'] === 'application/json') {
  13990.                 $httpBody \GuzzleHttp\json_encode($formParams);
  13991.             } else {
  13992.                 // for HTTP post (form)
  13993.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  13994.             }
  13995.         }
  13996.         // this endpoint requires OAuth (access token)
  13997.         if ($this->config->getAccessToken() !== null) {
  13998.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  13999.         }
  14000.         $defaultHeaders = [];
  14001.         if ($this->config->getUserAgent()) {
  14002.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  14003.         }
  14004.         $headers array_merge(
  14005.             $defaultHeaders,
  14006.             $headerParams,
  14007.             $headers
  14008.         );
  14009.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  14010.         return new Request(
  14011.             'PUT',
  14012.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  14013.             $headers,
  14014.             $httpBody
  14015.         );
  14016.     }
  14017.     /**
  14018.      * Operation createRepeatingInvoiceAttachmentByFileName
  14019.      * Creates an attachment from a specific repeating invoices by file name
  14020.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  14021.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  14022.      * @param  string $file_name Name of the attachment (required)
  14023.      * @param  string $body Byte array of file in body of request (required)
  14024.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  14025.      * @throws \InvalidArgumentException
  14026.      * @return \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error
  14027.      */
  14028.     public function createRepeatingInvoiceAttachmentByFileName($xero_tenant_id$repeating_invoice_id$file_name$body)
  14029.     {
  14030.         list($response) = $this->createRepeatingInvoiceAttachmentByFileNameWithHttpInfo($xero_tenant_id$repeating_invoice_id$file_name$body);
  14031.         return $response;
  14032.     }
  14033.     /**
  14034.      * Operation createRepeatingInvoiceAttachmentByFileNameWithHttpInfo
  14035.      * Creates an attachment from a specific repeating invoices by file name
  14036.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  14037.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  14038.      * @param  string $file_name Name of the attachment (required)
  14039.      * @param  string $body Byte array of file in body of request (required)
  14040.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  14041.      * @throws \InvalidArgumentException
  14042.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  14043.      */
  14044.     public function createRepeatingInvoiceAttachmentByFileNameWithHttpInfo($xero_tenant_id$repeating_invoice_id$file_name$body)
  14045.     {
  14046.         $request $this->createRepeatingInvoiceAttachmentByFileNameRequest($xero_tenant_id$repeating_invoice_id$file_name$body);
  14047.         try {
  14048.             $options $this->createHttpClientOption();
  14049.             try {
  14050.                 $response $this->client->send($request$options);
  14051.             } catch (RequestException $e) {
  14052.                 throw new ApiException(
  14053.                     "[{$e->getCode()}{$e->getMessage()}",
  14054.                     $e->getCode(),
  14055.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  14056.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  14057.                 );
  14058.             }
  14059.             $statusCode $response->getStatusCode();
  14060.             if ($statusCode 200 || $statusCode 299) {
  14061.                 throw new ApiException(
  14062.                     sprintf(
  14063.                         '[%d] Error connecting to the API (%s)',
  14064.                         $statusCode,
  14065.                         $request->getUri()
  14066.                     ),
  14067.                     $statusCode,
  14068.                     $response->getHeaders(),
  14069.                     $response->getBody()
  14070.                 );
  14071.             }
  14072.             $responseBody $response->getBody();
  14073.             switch($statusCode) {
  14074.                 case 200:
  14075.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Attachments' === '\SplFileObject') {
  14076.                         $content $responseBody//stream goes to serializer
  14077.                     } else {
  14078.                         $content $responseBody->getContents();
  14079.                     }
  14080.                     return [
  14081.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Attachments', []),
  14082.                         $response->getStatusCode(),
  14083.                         $response->getHeaders()
  14084.                     ];
  14085.                 case 400:
  14086.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  14087.                         $content $responseBody//stream goes to serializer
  14088.                     } else {
  14089.                         $content $responseBody->getContents();
  14090.                     }
  14091.                     return [
  14092.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  14093.                         $response->getStatusCode(),
  14094.                         $response->getHeaders()
  14095.                     ];
  14096.             }
  14097.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  14098.             $responseBody $response->getBody();
  14099.             if ($returnType === '\SplFileObject') {
  14100.                 $content $responseBody//stream goes to serializer
  14101.             } else {
  14102.                 $content $responseBody->getContents();
  14103.             }
  14104.             return [
  14105.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  14106.                 $response->getStatusCode(),
  14107.                 $response->getHeaders()
  14108.             ];
  14109.         } catch (ApiException $e) {
  14110.             switch ($e->getCode()) {
  14111.                 case 200:
  14112.                     $data AccountingObjectSerializer::deserialize(
  14113.                         $e->getResponseBody(),
  14114.                         '\XeroAPI\XeroPHP\Models\Accounting\Attachments',
  14115.                         $e->getResponseHeaders()
  14116.                     );
  14117.                     $e->setResponseObject($data);
  14118.                     break;
  14119.                 case 400:
  14120.                     $data AccountingObjectSerializer::deserialize(
  14121.                         $e->getResponseBody(),
  14122.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  14123.                         $e->getResponseHeaders()
  14124.                     );
  14125.                     $e->setResponseObject($data);
  14126.                     break;
  14127.             }
  14128.             throw $e;
  14129.         }
  14130.     }
  14131.     /**
  14132.      * Operation createRepeatingInvoiceAttachmentByFileNameAsync
  14133.      * Creates an attachment from a specific repeating invoices by file name
  14134.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  14135.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  14136.      * @param  string $file_name Name of the attachment (required)
  14137.      * @param  string $body Byte array of file in body of request (required)
  14138.      * @throws \InvalidArgumentException
  14139.      * @return \GuzzleHttp\Promise\PromiseInterface
  14140.      */
  14141.     public function createRepeatingInvoiceAttachmentByFileNameAsync($xero_tenant_id$repeating_invoice_id$file_name$body)
  14142.     {
  14143.         return $this->createRepeatingInvoiceAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$repeating_invoice_id$file_name$body)
  14144.             ->then(
  14145.                 function ($response) {
  14146.                     return $response[0];
  14147.                 }
  14148.             );
  14149.     }
  14150.     /**
  14151.      * Operation createRepeatingInvoiceAttachmentByFileNameAsyncWithHttpInfo
  14152.      * Creates an attachment from a specific repeating invoices by file name
  14153.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  14154.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  14155.      * @param  string $file_name Name of the attachment (required)
  14156.      * @param  string $body Byte array of file in body of request (required)
  14157.      * @throws \InvalidArgumentException
  14158.      * @return \GuzzleHttp\Promise\PromiseInterface */
  14159.     public function createRepeatingInvoiceAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$repeating_invoice_id$file_name$body)
  14160.     {
  14161.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  14162.         $request $this->createRepeatingInvoiceAttachmentByFileNameRequest($xero_tenant_id$repeating_invoice_id$file_name$body);
  14163.         return $this->client
  14164.             ->sendAsync($request$this->createHttpClientOption())
  14165.             ->then(
  14166.                 function ($response) use ($returnType) {
  14167.                     $responseBody $response->getBody();
  14168.                     if ($returnType === '\SplFileObject') {
  14169.                         $content $responseBody//stream goes to serializer
  14170.                     } else {
  14171.                         $content $responseBody->getContents();
  14172.                     }
  14173.                     return [
  14174.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  14175.                         $response->getStatusCode(),
  14176.                         $response->getHeaders()
  14177.                     ];
  14178.                 },
  14179.                 function ($exception) {
  14180.                     $response $exception->getResponse();
  14181.                     $statusCode $response->getStatusCode();
  14182.                     throw new ApiException(
  14183.                         sprintf(
  14184.                             '[%d] Error connecting to the API (%s)',
  14185.                             $statusCode,
  14186.                             $exception->getRequest()->getUri()
  14187.                         ),
  14188.                         $statusCode,
  14189.                         $response->getHeaders(),
  14190.                         $response->getBody()
  14191.                     );
  14192.                 }
  14193.             );
  14194.     }
  14195.     /**
  14196.      * Create request for operation 'createRepeatingInvoiceAttachmentByFileName'
  14197.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  14198.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  14199.      * @param  string $file_name Name of the attachment (required)
  14200.      * @param  string $body Byte array of file in body of request (required)
  14201.      * @throws \InvalidArgumentException
  14202.      * @return \GuzzleHttp\Psr7\Request  */
  14203.     protected function createRepeatingInvoiceAttachmentByFileNameRequest($xero_tenant_id$repeating_invoice_id$file_name$body)
  14204.     {
  14205.         // verify the required parameter 'xero_tenant_id' is set
  14206.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  14207.             throw new \InvalidArgumentException(
  14208.                 'Missing the required parameter $xero_tenant_id when calling createRepeatingInvoiceAttachmentByFileName'
  14209.             );
  14210.         }
  14211.         // verify the required parameter 'repeating_invoice_id' is set
  14212.         if ($repeating_invoice_id === null || (is_array($repeating_invoice_id) && count($repeating_invoice_id) === 0)) {
  14213.             throw new \InvalidArgumentException(
  14214.                 'Missing the required parameter $repeating_invoice_id when calling createRepeatingInvoiceAttachmentByFileName'
  14215.             );
  14216.         }
  14217.         // verify the required parameter 'file_name' is set
  14218.         if ($file_name === null || (is_array($file_name) && count($file_name) === 0)) {
  14219.             throw new \InvalidArgumentException(
  14220.                 'Missing the required parameter $file_name when calling createRepeatingInvoiceAttachmentByFileName'
  14221.             );
  14222.         }
  14223.         // verify the required parameter 'body' is set
  14224.         if ($body === null || (is_array($body) && count($body) === 0)) {
  14225.             throw new \InvalidArgumentException(
  14226.                 'Missing the required parameter $body when calling createRepeatingInvoiceAttachmentByFileName'
  14227.             );
  14228.         }
  14229.         $resourcePath '/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}';
  14230.         $formParams = [];
  14231.         $queryParams = [];
  14232.         $headerParams = [];
  14233.         $httpBody '';
  14234.         $multipart false;
  14235.         // header params
  14236.         if ($xero_tenant_id !== null) {
  14237.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  14238.         }
  14239.         // path params
  14240.         if ($repeating_invoice_id !== null) {
  14241.             $resourcePath str_replace(
  14242.                 '{' 'RepeatingInvoiceID' '}',
  14243.                 AccountingObjectSerializer::toPathValue($repeating_invoice_id),
  14244.                 $resourcePath
  14245.             );
  14246.         }
  14247.         // path params
  14248.         if ($file_name !== null) {
  14249.             $resourcePath str_replace(
  14250.                 '{' 'FileName' '}',
  14251.                 AccountingObjectSerializer::toPathValue($file_name),
  14252.                 $resourcePath
  14253.             );
  14254.         }
  14255.         // body params
  14256.         $_tempBody null;
  14257.         if (isset($body)) {
  14258.             $_tempBody $body;
  14259.         }
  14260.         if ($multipart) {
  14261.             $headers $this->headerSelector->selectHeadersForMultipart(
  14262.                 ['application/json']
  14263.             );
  14264.         } else {
  14265.             $headers $this->headerSelector->selectHeaders(
  14266.                 ['application/json'],
  14267.                 ['application/octet-stream']
  14268.             );
  14269.         }
  14270.         // for model (json/xml)
  14271.         if (isset($_tempBody)) {
  14272.             // $_tempBody is the method argument, if present
  14273.             if ($headers['Content-Type'] === 'application/json') {
  14274.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  14275.             } else {
  14276.                 $httpBody $_tempBody;
  14277.             }
  14278.         } elseif (count($formParams) > 0) {
  14279.             if ($multipart) {
  14280.                 $multipartContents = [
  14281.                     [
  14282.                         'Content-type' => 'multipart/form-data',
  14283.                     ]
  14284.                 ];
  14285.                 
  14286.                 // for HTTP post (form)
  14287.                 $httpBody = new MultipartStream($multipartContents);
  14288.             } elseif ($headers['Content-Type'] === 'application/json') {
  14289.                 $httpBody \GuzzleHttp\json_encode($formParams);
  14290.             } else {
  14291.                 // for HTTP post (form)
  14292.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  14293.             }
  14294.         }
  14295.         // this endpoint requires OAuth (access token)
  14296.         if ($this->config->getAccessToken() !== null) {
  14297.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  14298.         }
  14299.         $defaultHeaders = [];
  14300.         if ($this->config->getUserAgent()) {
  14301.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  14302.         }
  14303.         $headers array_merge(
  14304.             $defaultHeaders,
  14305.             $headerParams,
  14306.             $headers
  14307.         );
  14308.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  14309.         return new Request(
  14310.             'PUT',
  14311.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  14312.             $headers,
  14313.             $httpBody
  14314.         );
  14315.     }
  14316.     /**
  14317.      * Operation createRepeatingInvoiceHistory
  14318.      * Creates a  history record for a specific repeating invoice
  14319.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  14320.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  14321.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  14322.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  14323.      * @throws \InvalidArgumentException
  14324.      * @return \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords|\XeroAPI\XeroPHP\Models\Accounting\Error
  14325.      */
  14326.     public function createRepeatingInvoiceHistory($xero_tenant_id$repeating_invoice_id$history_records)
  14327.     {
  14328.         list($response) = $this->createRepeatingInvoiceHistoryWithHttpInfo($xero_tenant_id$repeating_invoice_id$history_records);
  14329.         return $response;
  14330.     }
  14331.     /**
  14332.      * Operation createRepeatingInvoiceHistoryWithHttpInfo
  14333.      * Creates a  history record for a specific repeating invoice
  14334.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  14335.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  14336.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  14337.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  14338.      * @throws \InvalidArgumentException
  14339.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  14340.      */
  14341.     public function createRepeatingInvoiceHistoryWithHttpInfo($xero_tenant_id$repeating_invoice_id$history_records)
  14342.     {
  14343.         $request $this->createRepeatingInvoiceHistoryRequest($xero_tenant_id$repeating_invoice_id$history_records);
  14344.         try {
  14345.             $options $this->createHttpClientOption();
  14346.             try {
  14347.                 $response $this->client->send($request$options);
  14348.             } catch (RequestException $e) {
  14349.                 throw new ApiException(
  14350.                     "[{$e->getCode()}{$e->getMessage()}",
  14351.                     $e->getCode(),
  14352.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  14353.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  14354.                 );
  14355.             }
  14356.             $statusCode $response->getStatusCode();
  14357.             if ($statusCode 200 || $statusCode 299) {
  14358.                 throw new ApiException(
  14359.                     sprintf(
  14360.                         '[%d] Error connecting to the API (%s)',
  14361.                         $statusCode,
  14362.                         $request->getUri()
  14363.                     ),
  14364.                     $statusCode,
  14365.                     $response->getHeaders(),
  14366.                     $response->getBody()
  14367.                 );
  14368.             }
  14369.             $responseBody $response->getBody();
  14370.             switch($statusCode) {
  14371.                 case 200:
  14372.                     if ('\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords' === '\SplFileObject') {
  14373.                         $content $responseBody//stream goes to serializer
  14374.                     } else {
  14375.                         $content $responseBody->getContents();
  14376.                     }
  14377.                     return [
  14378.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords', []),
  14379.                         $response->getStatusCode(),
  14380.                         $response->getHeaders()
  14381.                     ];
  14382.                 case 400:
  14383.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  14384.                         $content $responseBody//stream goes to serializer
  14385.                     } else {
  14386.                         $content $responseBody->getContents();
  14387.                     }
  14388.                     return [
  14389.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  14390.                         $response->getStatusCode(),
  14391.                         $response->getHeaders()
  14392.                     ];
  14393.             }
  14394.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  14395.             $responseBody $response->getBody();
  14396.             if ($returnType === '\SplFileObject') {
  14397.                 $content $responseBody//stream goes to serializer
  14398.             } else {
  14399.                 $content $responseBody->getContents();
  14400.             }
  14401.             return [
  14402.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  14403.                 $response->getStatusCode(),
  14404.                 $response->getHeaders()
  14405.             ];
  14406.         } catch (ApiException $e) {
  14407.             switch ($e->getCode()) {
  14408.                 case 200:
  14409.                     $data AccountingObjectSerializer::deserialize(
  14410.                         $e->getResponseBody(),
  14411.                         '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords',
  14412.                         $e->getResponseHeaders()
  14413.                     );
  14414.                     $e->setResponseObject($data);
  14415.                     break;
  14416.                 case 400:
  14417.                     $data AccountingObjectSerializer::deserialize(
  14418.                         $e->getResponseBody(),
  14419.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  14420.                         $e->getResponseHeaders()
  14421.                     );
  14422.                     $e->setResponseObject($data);
  14423.                     break;
  14424.             }
  14425.             throw $e;
  14426.         }
  14427.     }
  14428.     /**
  14429.      * Operation createRepeatingInvoiceHistoryAsync
  14430.      * Creates a  history record for a specific repeating invoice
  14431.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  14432.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  14433.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  14434.      * @throws \InvalidArgumentException
  14435.      * @return \GuzzleHttp\Promise\PromiseInterface
  14436.      */
  14437.     public function createRepeatingInvoiceHistoryAsync($xero_tenant_id$repeating_invoice_id$history_records)
  14438.     {
  14439.         return $this->createRepeatingInvoiceHistoryAsyncWithHttpInfo($xero_tenant_id$repeating_invoice_id$history_records)
  14440.             ->then(
  14441.                 function ($response) {
  14442.                     return $response[0];
  14443.                 }
  14444.             );
  14445.     }
  14446.     /**
  14447.      * Operation createRepeatingInvoiceHistoryAsyncWithHttpInfo
  14448.      * Creates a  history record for a specific repeating invoice
  14449.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  14450.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  14451.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  14452.      * @throws \InvalidArgumentException
  14453.      * @return \GuzzleHttp\Promise\PromiseInterface */
  14454.     public function createRepeatingInvoiceHistoryAsyncWithHttpInfo($xero_tenant_id$repeating_invoice_id$history_records)
  14455.     {
  14456.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  14457.         $request $this->createRepeatingInvoiceHistoryRequest($xero_tenant_id$repeating_invoice_id$history_records);
  14458.         return $this->client
  14459.             ->sendAsync($request$this->createHttpClientOption())
  14460.             ->then(
  14461.                 function ($response) use ($returnType) {
  14462.                     $responseBody $response->getBody();
  14463.                     if ($returnType === '\SplFileObject') {
  14464.                         $content $responseBody//stream goes to serializer
  14465.                     } else {
  14466.                         $content $responseBody->getContents();
  14467.                     }
  14468.                     return [
  14469.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  14470.                         $response->getStatusCode(),
  14471.                         $response->getHeaders()
  14472.                     ];
  14473.                 },
  14474.                 function ($exception) {
  14475.                     $response $exception->getResponse();
  14476.                     $statusCode $response->getStatusCode();
  14477.                     throw new ApiException(
  14478.                         sprintf(
  14479.                             '[%d] Error connecting to the API (%s)',
  14480.                             $statusCode,
  14481.                             $exception->getRequest()->getUri()
  14482.                         ),
  14483.                         $statusCode,
  14484.                         $response->getHeaders(),
  14485.                         $response->getBody()
  14486.                     );
  14487.                 }
  14488.             );
  14489.     }
  14490.     /**
  14491.      * Create request for operation 'createRepeatingInvoiceHistory'
  14492.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  14493.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  14494.      * @param  \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords $history_records HistoryRecords containing an array of HistoryRecord objects in body of request (required)
  14495.      * @throws \InvalidArgumentException
  14496.      * @return \GuzzleHttp\Psr7\Request  */
  14497.     protected function createRepeatingInvoiceHistoryRequest($xero_tenant_id$repeating_invoice_id$history_records)
  14498.     {
  14499.         // verify the required parameter 'xero_tenant_id' is set
  14500.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  14501.             throw new \InvalidArgumentException(
  14502.                 'Missing the required parameter $xero_tenant_id when calling createRepeatingInvoiceHistory'
  14503.             );
  14504.         }
  14505.         // verify the required parameter 'repeating_invoice_id' is set
  14506.         if ($repeating_invoice_id === null || (is_array($repeating_invoice_id) && count($repeating_invoice_id) === 0)) {
  14507.             throw new \InvalidArgumentException(
  14508.                 'Missing the required parameter $repeating_invoice_id when calling createRepeatingInvoiceHistory'
  14509.             );
  14510.         }
  14511.         // verify the required parameter 'history_records' is set
  14512.         if ($history_records === null || (is_array($history_records) && count($history_records) === 0)) {
  14513.             throw new \InvalidArgumentException(
  14514.                 'Missing the required parameter $history_records when calling createRepeatingInvoiceHistory'
  14515.             );
  14516.         }
  14517.         $resourcePath '/RepeatingInvoices/{RepeatingInvoiceID}/History';
  14518.         $formParams = [];
  14519.         $queryParams = [];
  14520.         $headerParams = [];
  14521.         $httpBody '';
  14522.         $multipart false;
  14523.         // header params
  14524.         if ($xero_tenant_id !== null) {
  14525.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  14526.         }
  14527.         // path params
  14528.         if ($repeating_invoice_id !== null) {
  14529.             $resourcePath str_replace(
  14530.                 '{' 'RepeatingInvoiceID' '}',
  14531.                 AccountingObjectSerializer::toPathValue($repeating_invoice_id),
  14532.                 $resourcePath
  14533.             );
  14534.         }
  14535.         // body params
  14536.         $_tempBody null;
  14537.         if (isset($history_records)) {
  14538.             $_tempBody $history_records;
  14539.         }
  14540.         if ($multipart) {
  14541.             $headers $this->headerSelector->selectHeadersForMultipart(
  14542.                 ['application/json']
  14543.             );
  14544.         } else {
  14545.             $headers $this->headerSelector->selectHeaders(
  14546.                 ['application/json'],
  14547.                 ['application/json']
  14548.             );
  14549.         }
  14550.         // for model (json/xml)
  14551.         if (isset($_tempBody)) {
  14552.             // $_tempBody is the method argument, if present
  14553.             if ($headers['Content-Type'] === 'application/json') {
  14554.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  14555.             } else {
  14556.                 $httpBody $_tempBody;
  14557.             }
  14558.         } elseif (count($formParams) > 0) {
  14559.             if ($multipart) {
  14560.                 $multipartContents = [
  14561.                     [
  14562.                         'Content-type' => 'multipart/form-data',
  14563.                     ]
  14564.                 ];
  14565.                 
  14566.                 // for HTTP post (form)
  14567.                 $httpBody = new MultipartStream($multipartContents);
  14568.             } elseif ($headers['Content-Type'] === 'application/json') {
  14569.                 $httpBody \GuzzleHttp\json_encode($formParams);
  14570.             } else {
  14571.                 // for HTTP post (form)
  14572.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  14573.             }
  14574.         }
  14575.         // this endpoint requires OAuth (access token)
  14576.         if ($this->config->getAccessToken() !== null) {
  14577.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  14578.         }
  14579.         $defaultHeaders = [];
  14580.         if ($this->config->getUserAgent()) {
  14581.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  14582.         }
  14583.         $headers array_merge(
  14584.             $defaultHeaders,
  14585.             $headerParams,
  14586.             $headers
  14587.         );
  14588.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  14589.         return new Request(
  14590.             'PUT',
  14591.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  14592.             $headers,
  14593.             $httpBody
  14594.         );
  14595.     }
  14596.     /**
  14597.      * Operation createRepeatingInvoices
  14598.      * Creates one or more repeating invoice templates
  14599.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  14600.      * @param  \XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices $repeating_invoices RepeatingInvoices with an array of repeating invoice objects in body of request (required)
  14601.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  14602.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  14603.      * @throws \InvalidArgumentException
  14604.      * @return \XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices|\XeroAPI\XeroPHP\Models\Accounting\Error
  14605.      */
  14606.     public function createRepeatingInvoices($xero_tenant_id$repeating_invoices$summarize_errors false)
  14607.     {
  14608.         list($response) = $this->createRepeatingInvoicesWithHttpInfo($xero_tenant_id$repeating_invoices$summarize_errors);
  14609.         return $response;
  14610.     }
  14611.     /**
  14612.      * Operation createRepeatingInvoicesWithHttpInfo
  14613.      * Creates one or more repeating invoice templates
  14614.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  14615.      * @param  \XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices $repeating_invoices RepeatingInvoices with an array of repeating invoice objects in body of request (required)
  14616.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  14617.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  14618.      * @throws \InvalidArgumentException
  14619.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  14620.      */
  14621.     public function createRepeatingInvoicesWithHttpInfo($xero_tenant_id$repeating_invoices$summarize_errors false)
  14622.     {
  14623.         $request $this->createRepeatingInvoicesRequest($xero_tenant_id$repeating_invoices$summarize_errors);
  14624.         try {
  14625.             $options $this->createHttpClientOption();
  14626.             try {
  14627.                 $response $this->client->send($request$options);
  14628.             } catch (RequestException $e) {
  14629.                 throw new ApiException(
  14630.                     "[{$e->getCode()}{$e->getMessage()}",
  14631.                     $e->getCode(),
  14632.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  14633.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  14634.                 );
  14635.             }
  14636.             $statusCode $response->getStatusCode();
  14637.             if ($statusCode 200 || $statusCode 299) {
  14638.                 throw new ApiException(
  14639.                     sprintf(
  14640.                         '[%d] Error connecting to the API (%s)',
  14641.                         $statusCode,
  14642.                         $request->getUri()
  14643.                     ),
  14644.                     $statusCode,
  14645.                     $response->getHeaders(),
  14646.                     $response->getBody()
  14647.                 );
  14648.             }
  14649.             $responseBody $response->getBody();
  14650.             switch($statusCode) {
  14651.                 case 200:
  14652.                     if ('\XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices' === '\SplFileObject') {
  14653.                         $content $responseBody//stream goes to serializer
  14654.                     } else {
  14655.                         $content $responseBody->getContents();
  14656.                     }
  14657.                     return [
  14658.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices', []),
  14659.                         $response->getStatusCode(),
  14660.                         $response->getHeaders()
  14661.                     ];
  14662.                 case 400:
  14663.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  14664.                         $content $responseBody//stream goes to serializer
  14665.                     } else {
  14666.                         $content $responseBody->getContents();
  14667.                     }
  14668.                     return [
  14669.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  14670.                         $response->getStatusCode(),
  14671.                         $response->getHeaders()
  14672.                     ];
  14673.             }
  14674.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices';
  14675.             $responseBody $response->getBody();
  14676.             if ($returnType === '\SplFileObject') {
  14677.                 $content $responseBody//stream goes to serializer
  14678.             } else {
  14679.                 $content $responseBody->getContents();
  14680.             }
  14681.             return [
  14682.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  14683.                 $response->getStatusCode(),
  14684.                 $response->getHeaders()
  14685.             ];
  14686.         } catch (ApiException $e) {
  14687.             switch ($e->getCode()) {
  14688.                 case 200:
  14689.                     $data AccountingObjectSerializer::deserialize(
  14690.                         $e->getResponseBody(),
  14691.                         '\XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices',
  14692.                         $e->getResponseHeaders()
  14693.                     );
  14694.                     $e->setResponseObject($data);
  14695.                     break;
  14696.                 case 400:
  14697.                     $data AccountingObjectSerializer::deserialize(
  14698.                         $e->getResponseBody(),
  14699.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  14700.                         $e->getResponseHeaders()
  14701.                     );
  14702.                     $e->setResponseObject($data);
  14703.                     break;
  14704.             }
  14705.             throw $e;
  14706.         }
  14707.     }
  14708.     /**
  14709.      * Operation createRepeatingInvoicesAsync
  14710.      * Creates one or more repeating invoice templates
  14711.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  14712.      * @param  \XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices $repeating_invoices RepeatingInvoices with an array of repeating invoice objects in body of request (required)
  14713.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  14714.      * @throws \InvalidArgumentException
  14715.      * @return \GuzzleHttp\Promise\PromiseInterface
  14716.      */
  14717.     public function createRepeatingInvoicesAsync($xero_tenant_id$repeating_invoices$summarize_errors false)
  14718.     {
  14719.         return $this->createRepeatingInvoicesAsyncWithHttpInfo($xero_tenant_id$repeating_invoices$summarize_errors)
  14720.             ->then(
  14721.                 function ($response) {
  14722.                     return $response[0];
  14723.                 }
  14724.             );
  14725.     }
  14726.     /**
  14727.      * Operation createRepeatingInvoicesAsyncWithHttpInfo
  14728.      * Creates one or more repeating invoice templates
  14729.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  14730.      * @param  \XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices $repeating_invoices RepeatingInvoices with an array of repeating invoice objects in body of request (required)
  14731.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  14732.      * @throws \InvalidArgumentException
  14733.      * @return \GuzzleHttp\Promise\PromiseInterface */
  14734.     public function createRepeatingInvoicesAsyncWithHttpInfo($xero_tenant_id$repeating_invoices$summarize_errors false)
  14735.     {
  14736.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices';
  14737.         $request $this->createRepeatingInvoicesRequest($xero_tenant_id$repeating_invoices$summarize_errors);
  14738.         return $this->client
  14739.             ->sendAsync($request$this->createHttpClientOption())
  14740.             ->then(
  14741.                 function ($response) use ($returnType) {
  14742.                     $responseBody $response->getBody();
  14743.                     if ($returnType === '\SplFileObject') {
  14744.                         $content $responseBody//stream goes to serializer
  14745.                     } else {
  14746.                         $content $responseBody->getContents();
  14747.                     }
  14748.                     return [
  14749.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  14750.                         $response->getStatusCode(),
  14751.                         $response->getHeaders()
  14752.                     ];
  14753.                 },
  14754.                 function ($exception) {
  14755.                     $response $exception->getResponse();
  14756.                     $statusCode $response->getStatusCode();
  14757.                     throw new ApiException(
  14758.                         sprintf(
  14759.                             '[%d] Error connecting to the API (%s)',
  14760.                             $statusCode,
  14761.                             $exception->getRequest()->getUri()
  14762.                         ),
  14763.                         $statusCode,
  14764.                         $response->getHeaders(),
  14765.                         $response->getBody()
  14766.                     );
  14767.                 }
  14768.             );
  14769.     }
  14770.     /**
  14771.      * Create request for operation 'createRepeatingInvoices'
  14772.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  14773.      * @param  \XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices $repeating_invoices RepeatingInvoices with an array of repeating invoice objects in body of request (required)
  14774.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  14775.      * @throws \InvalidArgumentException
  14776.      * @return \GuzzleHttp\Psr7\Request  */
  14777.     protected function createRepeatingInvoicesRequest($xero_tenant_id$repeating_invoices$summarize_errors false)
  14778.     {
  14779.         // verify the required parameter 'xero_tenant_id' is set
  14780.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  14781.             throw new \InvalidArgumentException(
  14782.                 'Missing the required parameter $xero_tenant_id when calling createRepeatingInvoices'
  14783.             );
  14784.         }
  14785.         // verify the required parameter 'repeating_invoices' is set
  14786.         if ($repeating_invoices === null || (is_array($repeating_invoices) && count($repeating_invoices) === 0)) {
  14787.             throw new \InvalidArgumentException(
  14788.                 'Missing the required parameter $repeating_invoices when calling createRepeatingInvoices'
  14789.             );
  14790.         }
  14791.         $resourcePath '/RepeatingInvoices';
  14792.         $formParams = [];
  14793.         $queryParams = [];
  14794.         $headerParams = [];
  14795.         $httpBody '';
  14796.         $multipart false;
  14797.         // query params
  14798.         if ($summarize_errors !== null) {
  14799.             $queryParams['summarizeErrors'] = $summarize_errors 'true' 'false';
  14800.         }
  14801.         // header params
  14802.         if ($xero_tenant_id !== null) {
  14803.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  14804.         }
  14805.         // body params
  14806.         $_tempBody null;
  14807.         if (isset($repeating_invoices)) {
  14808.             $_tempBody $repeating_invoices;
  14809.         }
  14810.         if ($multipart) {
  14811.             $headers $this->headerSelector->selectHeadersForMultipart(
  14812.                 ['application/json']
  14813.             );
  14814.         } else {
  14815.             $headers $this->headerSelector->selectHeaders(
  14816.                 ['application/json'],
  14817.                 ['application/json']
  14818.             );
  14819.         }
  14820.         // for model (json/xml)
  14821.         if (isset($_tempBody)) {
  14822.             // $_tempBody is the method argument, if present
  14823.             if ($headers['Content-Type'] === 'application/json') {
  14824.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  14825.             } else {
  14826.                 $httpBody $_tempBody;
  14827.             }
  14828.         } elseif (count($formParams) > 0) {
  14829.             if ($multipart) {
  14830.                 $multipartContents = [
  14831.                     [
  14832.                         'Content-type' => 'multipart/form-data',
  14833.                     ]
  14834.                 ];
  14835.                 
  14836.                 // for HTTP post (form)
  14837.                 $httpBody = new MultipartStream($multipartContents);
  14838.             } elseif ($headers['Content-Type'] === 'application/json') {
  14839.                 $httpBody \GuzzleHttp\json_encode($formParams);
  14840.             } else {
  14841.                 // for HTTP post (form)
  14842.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  14843.             }
  14844.         }
  14845.         // this endpoint requires OAuth (access token)
  14846.         if ($this->config->getAccessToken() !== null) {
  14847.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  14848.         }
  14849.         $defaultHeaders = [];
  14850.         if ($this->config->getUserAgent()) {
  14851.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  14852.         }
  14853.         $headers array_merge(
  14854.             $defaultHeaders,
  14855.             $headerParams,
  14856.             $headers
  14857.         );
  14858.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  14859.         return new Request(
  14860.             'PUT',
  14861.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  14862.             $headers,
  14863.             $httpBody
  14864.         );
  14865.     }
  14866.     /**
  14867.      * Operation createTaxRates
  14868.      * Creates one or more tax rates
  14869.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  14870.      * @param  \XeroAPI\XeroPHP\Models\Accounting\TaxRates $tax_rates TaxRates array with TaxRate object in body of request (required)
  14871.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  14872.      * @throws \InvalidArgumentException
  14873.      * @return \XeroAPI\XeroPHP\Models\Accounting\TaxRates|\XeroAPI\XeroPHP\Models\Accounting\Error
  14874.      */
  14875.     public function createTaxRates($xero_tenant_id$tax_rates)
  14876.     {
  14877.         list($response) = $this->createTaxRatesWithHttpInfo($xero_tenant_id$tax_rates);
  14878.         return $response;
  14879.     }
  14880.     /**
  14881.      * Operation createTaxRatesWithHttpInfo
  14882.      * Creates one or more tax rates
  14883.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  14884.      * @param  \XeroAPI\XeroPHP\Models\Accounting\TaxRates $tax_rates TaxRates array with TaxRate object in body of request (required)
  14885.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  14886.      * @throws \InvalidArgumentException
  14887.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\TaxRates|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  14888.      */
  14889.     public function createTaxRatesWithHttpInfo($xero_tenant_id$tax_rates)
  14890.     {
  14891.         $request $this->createTaxRatesRequest($xero_tenant_id$tax_rates);
  14892.         try {
  14893.             $options $this->createHttpClientOption();
  14894.             try {
  14895.                 $response $this->client->send($request$options);
  14896.             } catch (RequestException $e) {
  14897.                 throw new ApiException(
  14898.                     "[{$e->getCode()}{$e->getMessage()}",
  14899.                     $e->getCode(),
  14900.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  14901.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  14902.                 );
  14903.             }
  14904.             $statusCode $response->getStatusCode();
  14905.             if ($statusCode 200 || $statusCode 299) {
  14906.                 throw new ApiException(
  14907.                     sprintf(
  14908.                         '[%d] Error connecting to the API (%s)',
  14909.                         $statusCode,
  14910.                         $request->getUri()
  14911.                     ),
  14912.                     $statusCode,
  14913.                     $response->getHeaders(),
  14914.                     $response->getBody()
  14915.                 );
  14916.             }
  14917.             $responseBody $response->getBody();
  14918.             switch($statusCode) {
  14919.                 case 200:
  14920.                     if ('\XeroAPI\XeroPHP\Models\Accounting\TaxRates' === '\SplFileObject') {
  14921.                         $content $responseBody//stream goes to serializer
  14922.                     } else {
  14923.                         $content $responseBody->getContents();
  14924.                     }
  14925.                     return [
  14926.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\TaxRates', []),
  14927.                         $response->getStatusCode(),
  14928.                         $response->getHeaders()
  14929.                     ];
  14930.                 case 400:
  14931.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  14932.                         $content $responseBody//stream goes to serializer
  14933.                     } else {
  14934.                         $content $responseBody->getContents();
  14935.                     }
  14936.                     return [
  14937.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  14938.                         $response->getStatusCode(),
  14939.                         $response->getHeaders()
  14940.                     ];
  14941.             }
  14942.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\TaxRates';
  14943.             $responseBody $response->getBody();
  14944.             if ($returnType === '\SplFileObject') {
  14945.                 $content $responseBody//stream goes to serializer
  14946.             } else {
  14947.                 $content $responseBody->getContents();
  14948.             }
  14949.             return [
  14950.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  14951.                 $response->getStatusCode(),
  14952.                 $response->getHeaders()
  14953.             ];
  14954.         } catch (ApiException $e) {
  14955.             switch ($e->getCode()) {
  14956.                 case 200:
  14957.                     $data AccountingObjectSerializer::deserialize(
  14958.                         $e->getResponseBody(),
  14959.                         '\XeroAPI\XeroPHP\Models\Accounting\TaxRates',
  14960.                         $e->getResponseHeaders()
  14961.                     );
  14962.                     $e->setResponseObject($data);
  14963.                     break;
  14964.                 case 400:
  14965.                     $data AccountingObjectSerializer::deserialize(
  14966.                         $e->getResponseBody(),
  14967.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  14968.                         $e->getResponseHeaders()
  14969.                     );
  14970.                     $e->setResponseObject($data);
  14971.                     break;
  14972.             }
  14973.             throw $e;
  14974.         }
  14975.     }
  14976.     /**
  14977.      * Operation createTaxRatesAsync
  14978.      * Creates one or more tax rates
  14979.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  14980.      * @param  \XeroAPI\XeroPHP\Models\Accounting\TaxRates $tax_rates TaxRates array with TaxRate object in body of request (required)
  14981.      * @throws \InvalidArgumentException
  14982.      * @return \GuzzleHttp\Promise\PromiseInterface
  14983.      */
  14984.     public function createTaxRatesAsync($xero_tenant_id$tax_rates)
  14985.     {
  14986.         return $this->createTaxRatesAsyncWithHttpInfo($xero_tenant_id$tax_rates)
  14987.             ->then(
  14988.                 function ($response) {
  14989.                     return $response[0];
  14990.                 }
  14991.             );
  14992.     }
  14993.     /**
  14994.      * Operation createTaxRatesAsyncWithHttpInfo
  14995.      * Creates one or more tax rates
  14996.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  14997.      * @param  \XeroAPI\XeroPHP\Models\Accounting\TaxRates $tax_rates TaxRates array with TaxRate object in body of request (required)
  14998.      * @throws \InvalidArgumentException
  14999.      * @return \GuzzleHttp\Promise\PromiseInterface */
  15000.     public function createTaxRatesAsyncWithHttpInfo($xero_tenant_id$tax_rates)
  15001.     {
  15002.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\TaxRates';
  15003.         $request $this->createTaxRatesRequest($xero_tenant_id$tax_rates);
  15004.         return $this->client
  15005.             ->sendAsync($request$this->createHttpClientOption())
  15006.             ->then(
  15007.                 function ($response) use ($returnType) {
  15008.                     $responseBody $response->getBody();
  15009.                     if ($returnType === '\SplFileObject') {
  15010.                         $content $responseBody//stream goes to serializer
  15011.                     } else {
  15012.                         $content $responseBody->getContents();
  15013.                     }
  15014.                     return [
  15015.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  15016.                         $response->getStatusCode(),
  15017.                         $response->getHeaders()
  15018.                     ];
  15019.                 },
  15020.                 function ($exception) {
  15021.                     $response $exception->getResponse();
  15022.                     $statusCode $response->getStatusCode();
  15023.                     throw new ApiException(
  15024.                         sprintf(
  15025.                             '[%d] Error connecting to the API (%s)',
  15026.                             $statusCode,
  15027.                             $exception->getRequest()->getUri()
  15028.                         ),
  15029.                         $statusCode,
  15030.                         $response->getHeaders(),
  15031.                         $response->getBody()
  15032.                     );
  15033.                 }
  15034.             );
  15035.     }
  15036.     /**
  15037.      * Create request for operation 'createTaxRates'
  15038.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  15039.      * @param  \XeroAPI\XeroPHP\Models\Accounting\TaxRates $tax_rates TaxRates array with TaxRate object in body of request (required)
  15040.      * @throws \InvalidArgumentException
  15041.      * @return \GuzzleHttp\Psr7\Request  */
  15042.     protected function createTaxRatesRequest($xero_tenant_id$tax_rates)
  15043.     {
  15044.         // verify the required parameter 'xero_tenant_id' is set
  15045.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  15046.             throw new \InvalidArgumentException(
  15047.                 'Missing the required parameter $xero_tenant_id when calling createTaxRates'
  15048.             );
  15049.         }
  15050.         // verify the required parameter 'tax_rates' is set
  15051.         if ($tax_rates === null || (is_array($tax_rates) && count($tax_rates) === 0)) {
  15052.             throw new \InvalidArgumentException(
  15053.                 'Missing the required parameter $tax_rates when calling createTaxRates'
  15054.             );
  15055.         }
  15056.         $resourcePath '/TaxRates';
  15057.         $formParams = [];
  15058.         $queryParams = [];
  15059.         $headerParams = [];
  15060.         $httpBody '';
  15061.         $multipart false;
  15062.         // header params
  15063.         if ($xero_tenant_id !== null) {
  15064.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  15065.         }
  15066.         // body params
  15067.         $_tempBody null;
  15068.         if (isset($tax_rates)) {
  15069.             $_tempBody $tax_rates;
  15070.         }
  15071.         if ($multipart) {
  15072.             $headers $this->headerSelector->selectHeadersForMultipart(
  15073.                 ['application/json']
  15074.             );
  15075.         } else {
  15076.             $headers $this->headerSelector->selectHeaders(
  15077.                 ['application/json'],
  15078.                 ['application/json']
  15079.             );
  15080.         }
  15081.         // for model (json/xml)
  15082.         if (isset($_tempBody)) {
  15083.             // $_tempBody is the method argument, if present
  15084.             if ($headers['Content-Type'] === 'application/json') {
  15085.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  15086.             } else {
  15087.                 $httpBody $_tempBody;
  15088.             }
  15089.         } elseif (count($formParams) > 0) {
  15090.             if ($multipart) {
  15091.                 $multipartContents = [
  15092.                     [
  15093.                         'Content-type' => 'multipart/form-data',
  15094.                     ]
  15095.                 ];
  15096.                 
  15097.                 // for HTTP post (form)
  15098.                 $httpBody = new MultipartStream($multipartContents);
  15099.             } elseif ($headers['Content-Type'] === 'application/json') {
  15100.                 $httpBody \GuzzleHttp\json_encode($formParams);
  15101.             } else {
  15102.                 // for HTTP post (form)
  15103.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  15104.             }
  15105.         }
  15106.         // this endpoint requires OAuth (access token)
  15107.         if ($this->config->getAccessToken() !== null) {
  15108.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  15109.         }
  15110.         $defaultHeaders = [];
  15111.         if ($this->config->getUserAgent()) {
  15112.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  15113.         }
  15114.         $headers array_merge(
  15115.             $defaultHeaders,
  15116.             $headerParams,
  15117.             $headers
  15118.         );
  15119.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  15120.         return new Request(
  15121.             'PUT',
  15122.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  15123.             $headers,
  15124.             $httpBody
  15125.         );
  15126.     }
  15127.     /**
  15128.      * Operation createTrackingCategory
  15129.      * Create tracking categories
  15130.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  15131.      * @param  \XeroAPI\XeroPHP\Models\Accounting\TrackingCategory $tracking_category TrackingCategory object in body of request (required)
  15132.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  15133.      * @throws \InvalidArgumentException
  15134.      * @return \XeroAPI\XeroPHP\Models\Accounting\TrackingCategories|\XeroAPI\XeroPHP\Models\Accounting\Error
  15135.      */
  15136.     public function createTrackingCategory($xero_tenant_id$tracking_category)
  15137.     {
  15138.         list($response) = $this->createTrackingCategoryWithHttpInfo($xero_tenant_id$tracking_category);
  15139.         return $response;
  15140.     }
  15141.     /**
  15142.      * Operation createTrackingCategoryWithHttpInfo
  15143.      * Create tracking categories
  15144.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  15145.      * @param  \XeroAPI\XeroPHP\Models\Accounting\TrackingCategory $tracking_category TrackingCategory object in body of request (required)
  15146.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  15147.      * @throws \InvalidArgumentException
  15148.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\TrackingCategories|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  15149.      */
  15150.     public function createTrackingCategoryWithHttpInfo($xero_tenant_id$tracking_category)
  15151.     {
  15152.         $request $this->createTrackingCategoryRequest($xero_tenant_id$tracking_category);
  15153.         try {
  15154.             $options $this->createHttpClientOption();
  15155.             try {
  15156.                 $response $this->client->send($request$options);
  15157.             } catch (RequestException $e) {
  15158.                 throw new ApiException(
  15159.                     "[{$e->getCode()}{$e->getMessage()}",
  15160.                     $e->getCode(),
  15161.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  15162.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  15163.                 );
  15164.             }
  15165.             $statusCode $response->getStatusCode();
  15166.             if ($statusCode 200 || $statusCode 299) {
  15167.                 throw new ApiException(
  15168.                     sprintf(
  15169.                         '[%d] Error connecting to the API (%s)',
  15170.                         $statusCode,
  15171.                         $request->getUri()
  15172.                     ),
  15173.                     $statusCode,
  15174.                     $response->getHeaders(),
  15175.                     $response->getBody()
  15176.                 );
  15177.             }
  15178.             $responseBody $response->getBody();
  15179.             switch($statusCode) {
  15180.                 case 200:
  15181.                     if ('\XeroAPI\XeroPHP\Models\Accounting\TrackingCategories' === '\SplFileObject') {
  15182.                         $content $responseBody//stream goes to serializer
  15183.                     } else {
  15184.                         $content $responseBody->getContents();
  15185.                     }
  15186.                     return [
  15187.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\TrackingCategories', []),
  15188.                         $response->getStatusCode(),
  15189.                         $response->getHeaders()
  15190.                     ];
  15191.                 case 400:
  15192.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  15193.                         $content $responseBody//stream goes to serializer
  15194.                     } else {
  15195.                         $content $responseBody->getContents();
  15196.                     }
  15197.                     return [
  15198.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  15199.                         $response->getStatusCode(),
  15200.                         $response->getHeaders()
  15201.                     ];
  15202.             }
  15203.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\TrackingCategories';
  15204.             $responseBody $response->getBody();
  15205.             if ($returnType === '\SplFileObject') {
  15206.                 $content $responseBody//stream goes to serializer
  15207.             } else {
  15208.                 $content $responseBody->getContents();
  15209.             }
  15210.             return [
  15211.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  15212.                 $response->getStatusCode(),
  15213.                 $response->getHeaders()
  15214.             ];
  15215.         } catch (ApiException $e) {
  15216.             switch ($e->getCode()) {
  15217.                 case 200:
  15218.                     $data AccountingObjectSerializer::deserialize(
  15219.                         $e->getResponseBody(),
  15220.                         '\XeroAPI\XeroPHP\Models\Accounting\TrackingCategories',
  15221.                         $e->getResponseHeaders()
  15222.                     );
  15223.                     $e->setResponseObject($data);
  15224.                     break;
  15225.                 case 400:
  15226.                     $data AccountingObjectSerializer::deserialize(
  15227.                         $e->getResponseBody(),
  15228.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  15229.                         $e->getResponseHeaders()
  15230.                     );
  15231.                     $e->setResponseObject($data);
  15232.                     break;
  15233.             }
  15234.             throw $e;
  15235.         }
  15236.     }
  15237.     /**
  15238.      * Operation createTrackingCategoryAsync
  15239.      * Create tracking categories
  15240.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  15241.      * @param  \XeroAPI\XeroPHP\Models\Accounting\TrackingCategory $tracking_category TrackingCategory object in body of request (required)
  15242.      * @throws \InvalidArgumentException
  15243.      * @return \GuzzleHttp\Promise\PromiseInterface
  15244.      */
  15245.     public function createTrackingCategoryAsync($xero_tenant_id$tracking_category)
  15246.     {
  15247.         return $this->createTrackingCategoryAsyncWithHttpInfo($xero_tenant_id$tracking_category)
  15248.             ->then(
  15249.                 function ($response) {
  15250.                     return $response[0];
  15251.                 }
  15252.             );
  15253.     }
  15254.     /**
  15255.      * Operation createTrackingCategoryAsyncWithHttpInfo
  15256.      * Create tracking categories
  15257.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  15258.      * @param  \XeroAPI\XeroPHP\Models\Accounting\TrackingCategory $tracking_category TrackingCategory object in body of request (required)
  15259.      * @throws \InvalidArgumentException
  15260.      * @return \GuzzleHttp\Promise\PromiseInterface */
  15261.     public function createTrackingCategoryAsyncWithHttpInfo($xero_tenant_id$tracking_category)
  15262.     {
  15263.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\TrackingCategories';
  15264.         $request $this->createTrackingCategoryRequest($xero_tenant_id$tracking_category);
  15265.         return $this->client
  15266.             ->sendAsync($request$this->createHttpClientOption())
  15267.             ->then(
  15268.                 function ($response) use ($returnType) {
  15269.                     $responseBody $response->getBody();
  15270.                     if ($returnType === '\SplFileObject') {
  15271.                         $content $responseBody//stream goes to serializer
  15272.                     } else {
  15273.                         $content $responseBody->getContents();
  15274.                     }
  15275.                     return [
  15276.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  15277.                         $response->getStatusCode(),
  15278.                         $response->getHeaders()
  15279.                     ];
  15280.                 },
  15281.                 function ($exception) {
  15282.                     $response $exception->getResponse();
  15283.                     $statusCode $response->getStatusCode();
  15284.                     throw new ApiException(
  15285.                         sprintf(
  15286.                             '[%d] Error connecting to the API (%s)',
  15287.                             $statusCode,
  15288.                             $exception->getRequest()->getUri()
  15289.                         ),
  15290.                         $statusCode,
  15291.                         $response->getHeaders(),
  15292.                         $response->getBody()
  15293.                     );
  15294.                 }
  15295.             );
  15296.     }
  15297.     /**
  15298.      * Create request for operation 'createTrackingCategory'
  15299.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  15300.      * @param  \XeroAPI\XeroPHP\Models\Accounting\TrackingCategory $tracking_category TrackingCategory object in body of request (required)
  15301.      * @throws \InvalidArgumentException
  15302.      * @return \GuzzleHttp\Psr7\Request  */
  15303.     protected function createTrackingCategoryRequest($xero_tenant_id$tracking_category)
  15304.     {
  15305.         // verify the required parameter 'xero_tenant_id' is set
  15306.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  15307.             throw new \InvalidArgumentException(
  15308.                 'Missing the required parameter $xero_tenant_id when calling createTrackingCategory'
  15309.             );
  15310.         }
  15311.         // verify the required parameter 'tracking_category' is set
  15312.         if ($tracking_category === null || (is_array($tracking_category) && count($tracking_category) === 0)) {
  15313.             throw new \InvalidArgumentException(
  15314.                 'Missing the required parameter $tracking_category when calling createTrackingCategory'
  15315.             );
  15316.         }
  15317.         $resourcePath '/TrackingCategories';
  15318.         $formParams = [];
  15319.         $queryParams = [];
  15320.         $headerParams = [];
  15321.         $httpBody '';
  15322.         $multipart false;
  15323.         // header params
  15324.         if ($xero_tenant_id !== null) {
  15325.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  15326.         }
  15327.         // body params
  15328.         $_tempBody null;
  15329.         if (isset($tracking_category)) {
  15330.             $_tempBody $tracking_category;
  15331.         }
  15332.         if ($multipart) {
  15333.             $headers $this->headerSelector->selectHeadersForMultipart(
  15334.                 ['application/json']
  15335.             );
  15336.         } else {
  15337.             $headers $this->headerSelector->selectHeaders(
  15338.                 ['application/json'],
  15339.                 ['application/json']
  15340.             );
  15341.         }
  15342.         // for model (json/xml)
  15343.         if (isset($_tempBody)) {
  15344.             // $_tempBody is the method argument, if present
  15345.             if ($headers['Content-Type'] === 'application/json') {
  15346.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  15347.             } else {
  15348.                 $httpBody $_tempBody;
  15349.             }
  15350.         } elseif (count($formParams) > 0) {
  15351.             if ($multipart) {
  15352.                 $multipartContents = [
  15353.                     [
  15354.                         'Content-type' => 'multipart/form-data',
  15355.                     ]
  15356.                 ];
  15357.                 
  15358.                 // for HTTP post (form)
  15359.                 $httpBody = new MultipartStream($multipartContents);
  15360.             } elseif ($headers['Content-Type'] === 'application/json') {
  15361.                 $httpBody \GuzzleHttp\json_encode($formParams);
  15362.             } else {
  15363.                 // for HTTP post (form)
  15364.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  15365.             }
  15366.         }
  15367.         // this endpoint requires OAuth (access token)
  15368.         if ($this->config->getAccessToken() !== null) {
  15369.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  15370.         }
  15371.         $defaultHeaders = [];
  15372.         if ($this->config->getUserAgent()) {
  15373.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  15374.         }
  15375.         $headers array_merge(
  15376.             $defaultHeaders,
  15377.             $headerParams,
  15378.             $headers
  15379.         );
  15380.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  15381.         return new Request(
  15382.             'PUT',
  15383.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  15384.             $headers,
  15385.             $httpBody
  15386.         );
  15387.     }
  15388.     /**
  15389.      * Operation createTrackingOptions
  15390.      * Creates options for a specific tracking category
  15391.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  15392.      * @param  string $tracking_category_id Unique identifier for a TrackingCategory (required)
  15393.      * @param  \XeroAPI\XeroPHP\Models\Accounting\TrackingOption $tracking_option TrackingOption object in body of request (required)
  15394.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  15395.      * @throws \InvalidArgumentException
  15396.      * @return \XeroAPI\XeroPHP\Models\Accounting\TrackingOptions|\XeroAPI\XeroPHP\Models\Accounting\Error
  15397.      */
  15398.     public function createTrackingOptions($xero_tenant_id$tracking_category_id$tracking_option)
  15399.     {
  15400.         list($response) = $this->createTrackingOptionsWithHttpInfo($xero_tenant_id$tracking_category_id$tracking_option);
  15401.         return $response;
  15402.     }
  15403.     /**
  15404.      * Operation createTrackingOptionsWithHttpInfo
  15405.      * Creates options for a specific tracking category
  15406.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  15407.      * @param  string $tracking_category_id Unique identifier for a TrackingCategory (required)
  15408.      * @param  \XeroAPI\XeroPHP\Models\Accounting\TrackingOption $tracking_option TrackingOption object in body of request (required)
  15409.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  15410.      * @throws \InvalidArgumentException
  15411.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\TrackingOptions|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  15412.      */
  15413.     public function createTrackingOptionsWithHttpInfo($xero_tenant_id$tracking_category_id$tracking_option)
  15414.     {
  15415.         $request $this->createTrackingOptionsRequest($xero_tenant_id$tracking_category_id$tracking_option);
  15416.         try {
  15417.             $options $this->createHttpClientOption();
  15418.             try {
  15419.                 $response $this->client->send($request$options);
  15420.             } catch (RequestException $e) {
  15421.                 throw new ApiException(
  15422.                     "[{$e->getCode()}{$e->getMessage()}",
  15423.                     $e->getCode(),
  15424.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  15425.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  15426.                 );
  15427.             }
  15428.             $statusCode $response->getStatusCode();
  15429.             if ($statusCode 200 || $statusCode 299) {
  15430.                 throw new ApiException(
  15431.                     sprintf(
  15432.                         '[%d] Error connecting to the API (%s)',
  15433.                         $statusCode,
  15434.                         $request->getUri()
  15435.                     ),
  15436.                     $statusCode,
  15437.                     $response->getHeaders(),
  15438.                     $response->getBody()
  15439.                 );
  15440.             }
  15441.             $responseBody $response->getBody();
  15442.             switch($statusCode) {
  15443.                 case 200:
  15444.                     if ('\XeroAPI\XeroPHP\Models\Accounting\TrackingOptions' === '\SplFileObject') {
  15445.                         $content $responseBody//stream goes to serializer
  15446.                     } else {
  15447.                         $content $responseBody->getContents();
  15448.                     }
  15449.                     return [
  15450.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\TrackingOptions', []),
  15451.                         $response->getStatusCode(),
  15452.                         $response->getHeaders()
  15453.                     ];
  15454.                 case 400:
  15455.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  15456.                         $content $responseBody//stream goes to serializer
  15457.                     } else {
  15458.                         $content $responseBody->getContents();
  15459.                     }
  15460.                     return [
  15461.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  15462.                         $response->getStatusCode(),
  15463.                         $response->getHeaders()
  15464.                     ];
  15465.             }
  15466.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\TrackingOptions';
  15467.             $responseBody $response->getBody();
  15468.             if ($returnType === '\SplFileObject') {
  15469.                 $content $responseBody//stream goes to serializer
  15470.             } else {
  15471.                 $content $responseBody->getContents();
  15472.             }
  15473.             return [
  15474.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  15475.                 $response->getStatusCode(),
  15476.                 $response->getHeaders()
  15477.             ];
  15478.         } catch (ApiException $e) {
  15479.             switch ($e->getCode()) {
  15480.                 case 200:
  15481.                     $data AccountingObjectSerializer::deserialize(
  15482.                         $e->getResponseBody(),
  15483.                         '\XeroAPI\XeroPHP\Models\Accounting\TrackingOptions',
  15484.                         $e->getResponseHeaders()
  15485.                     );
  15486.                     $e->setResponseObject($data);
  15487.                     break;
  15488.                 case 400:
  15489.                     $data AccountingObjectSerializer::deserialize(
  15490.                         $e->getResponseBody(),
  15491.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  15492.                         $e->getResponseHeaders()
  15493.                     );
  15494.                     $e->setResponseObject($data);
  15495.                     break;
  15496.             }
  15497.             throw $e;
  15498.         }
  15499.     }
  15500.     /**
  15501.      * Operation createTrackingOptionsAsync
  15502.      * Creates options for a specific tracking category
  15503.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  15504.      * @param  string $tracking_category_id Unique identifier for a TrackingCategory (required)
  15505.      * @param  \XeroAPI\XeroPHP\Models\Accounting\TrackingOption $tracking_option TrackingOption object in body of request (required)
  15506.      * @throws \InvalidArgumentException
  15507.      * @return \GuzzleHttp\Promise\PromiseInterface
  15508.      */
  15509.     public function createTrackingOptionsAsync($xero_tenant_id$tracking_category_id$tracking_option)
  15510.     {
  15511.         return $this->createTrackingOptionsAsyncWithHttpInfo($xero_tenant_id$tracking_category_id$tracking_option)
  15512.             ->then(
  15513.                 function ($response) {
  15514.                     return $response[0];
  15515.                 }
  15516.             );
  15517.     }
  15518.     /**
  15519.      * Operation createTrackingOptionsAsyncWithHttpInfo
  15520.      * Creates options for a specific tracking category
  15521.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  15522.      * @param  string $tracking_category_id Unique identifier for a TrackingCategory (required)
  15523.      * @param  \XeroAPI\XeroPHP\Models\Accounting\TrackingOption $tracking_option TrackingOption object in body of request (required)
  15524.      * @throws \InvalidArgumentException
  15525.      * @return \GuzzleHttp\Promise\PromiseInterface */
  15526.     public function createTrackingOptionsAsyncWithHttpInfo($xero_tenant_id$tracking_category_id$tracking_option)
  15527.     {
  15528.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\TrackingOptions';
  15529.         $request $this->createTrackingOptionsRequest($xero_tenant_id$tracking_category_id$tracking_option);
  15530.         return $this->client
  15531.             ->sendAsync($request$this->createHttpClientOption())
  15532.             ->then(
  15533.                 function ($response) use ($returnType) {
  15534.                     $responseBody $response->getBody();
  15535.                     if ($returnType === '\SplFileObject') {
  15536.                         $content $responseBody//stream goes to serializer
  15537.                     } else {
  15538.                         $content $responseBody->getContents();
  15539.                     }
  15540.                     return [
  15541.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  15542.                         $response->getStatusCode(),
  15543.                         $response->getHeaders()
  15544.                     ];
  15545.                 },
  15546.                 function ($exception) {
  15547.                     $response $exception->getResponse();
  15548.                     $statusCode $response->getStatusCode();
  15549.                     throw new ApiException(
  15550.                         sprintf(
  15551.                             '[%d] Error connecting to the API (%s)',
  15552.                             $statusCode,
  15553.                             $exception->getRequest()->getUri()
  15554.                         ),
  15555.                         $statusCode,
  15556.                         $response->getHeaders(),
  15557.                         $response->getBody()
  15558.                     );
  15559.                 }
  15560.             );
  15561.     }
  15562.     /**
  15563.      * Create request for operation 'createTrackingOptions'
  15564.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  15565.      * @param  string $tracking_category_id Unique identifier for a TrackingCategory (required)
  15566.      * @param  \XeroAPI\XeroPHP\Models\Accounting\TrackingOption $tracking_option TrackingOption object in body of request (required)
  15567.      * @throws \InvalidArgumentException
  15568.      * @return \GuzzleHttp\Psr7\Request  */
  15569.     protected function createTrackingOptionsRequest($xero_tenant_id$tracking_category_id$tracking_option)
  15570.     {
  15571.         // verify the required parameter 'xero_tenant_id' is set
  15572.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  15573.             throw new \InvalidArgumentException(
  15574.                 'Missing the required parameter $xero_tenant_id when calling createTrackingOptions'
  15575.             );
  15576.         }
  15577.         // verify the required parameter 'tracking_category_id' is set
  15578.         if ($tracking_category_id === null || (is_array($tracking_category_id) && count($tracking_category_id) === 0)) {
  15579.             throw new \InvalidArgumentException(
  15580.                 'Missing the required parameter $tracking_category_id when calling createTrackingOptions'
  15581.             );
  15582.         }
  15583.         // verify the required parameter 'tracking_option' is set
  15584.         if ($tracking_option === null || (is_array($tracking_option) && count($tracking_option) === 0)) {
  15585.             throw new \InvalidArgumentException(
  15586.                 'Missing the required parameter $tracking_option when calling createTrackingOptions'
  15587.             );
  15588.         }
  15589.         $resourcePath '/TrackingCategories/{TrackingCategoryID}/Options';
  15590.         $formParams = [];
  15591.         $queryParams = [];
  15592.         $headerParams = [];
  15593.         $httpBody '';
  15594.         $multipart false;
  15595.         // header params
  15596.         if ($xero_tenant_id !== null) {
  15597.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  15598.         }
  15599.         // path params
  15600.         if ($tracking_category_id !== null) {
  15601.             $resourcePath str_replace(
  15602.                 '{' 'TrackingCategoryID' '}',
  15603.                 AccountingObjectSerializer::toPathValue($tracking_category_id),
  15604.                 $resourcePath
  15605.             );
  15606.         }
  15607.         // body params
  15608.         $_tempBody null;
  15609.         if (isset($tracking_option)) {
  15610.             $_tempBody $tracking_option;
  15611.         }
  15612.         if ($multipart) {
  15613.             $headers $this->headerSelector->selectHeadersForMultipart(
  15614.                 ['application/json']
  15615.             );
  15616.         } else {
  15617.             $headers $this->headerSelector->selectHeaders(
  15618.                 ['application/json'],
  15619.                 ['application/json']
  15620.             );
  15621.         }
  15622.         // for model (json/xml)
  15623.         if (isset($_tempBody)) {
  15624.             // $_tempBody is the method argument, if present
  15625.             if ($headers['Content-Type'] === 'application/json') {
  15626.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  15627.             } else {
  15628.                 $httpBody $_tempBody;
  15629.             }
  15630.         } elseif (count($formParams) > 0) {
  15631.             if ($multipart) {
  15632.                 $multipartContents = [
  15633.                     [
  15634.                         'Content-type' => 'multipart/form-data',
  15635.                     ]
  15636.                 ];
  15637.                 
  15638.                 // for HTTP post (form)
  15639.                 $httpBody = new MultipartStream($multipartContents);
  15640.             } elseif ($headers['Content-Type'] === 'application/json') {
  15641.                 $httpBody \GuzzleHttp\json_encode($formParams);
  15642.             } else {
  15643.                 // for HTTP post (form)
  15644.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  15645.             }
  15646.         }
  15647.         // this endpoint requires OAuth (access token)
  15648.         if ($this->config->getAccessToken() !== null) {
  15649.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  15650.         }
  15651.         $defaultHeaders = [];
  15652.         if ($this->config->getUserAgent()) {
  15653.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  15654.         }
  15655.         $headers array_merge(
  15656.             $defaultHeaders,
  15657.             $headerParams,
  15658.             $headers
  15659.         );
  15660.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  15661.         return new Request(
  15662.             'PUT',
  15663.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  15664.             $headers,
  15665.             $httpBody
  15666.         );
  15667.     }
  15668.     /**
  15669.      * Operation deleteAccount
  15670.      * Deletes a chart of accounts
  15671.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  15672.      * @param  string $account_id Unique identifier for Account object (required)
  15673.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  15674.      * @throws \InvalidArgumentException
  15675.      * @return \XeroAPI\XeroPHP\Models\Accounting\Accounts|\XeroAPI\XeroPHP\Models\Accounting\Error
  15676.      */
  15677.     public function deleteAccount($xero_tenant_id$account_id)
  15678.     {
  15679.         list($response) = $this->deleteAccountWithHttpInfo($xero_tenant_id$account_id);
  15680.         return $response;
  15681.     }
  15682.     /**
  15683.      * Operation deleteAccountWithHttpInfo
  15684.      * Deletes a chart of accounts
  15685.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  15686.      * @param  string $account_id Unique identifier for Account object (required)
  15687.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  15688.      * @throws \InvalidArgumentException
  15689.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Accounts|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  15690.      */
  15691.     public function deleteAccountWithHttpInfo($xero_tenant_id$account_id)
  15692.     {
  15693.         $request $this->deleteAccountRequest($xero_tenant_id$account_id);
  15694.         try {
  15695.             $options $this->createHttpClientOption();
  15696.             try {
  15697.                 $response $this->client->send($request$options);
  15698.             } catch (RequestException $e) {
  15699.                 throw new ApiException(
  15700.                     "[{$e->getCode()}{$e->getMessage()}",
  15701.                     $e->getCode(),
  15702.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  15703.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  15704.                 );
  15705.             }
  15706.             $statusCode $response->getStatusCode();
  15707.             if ($statusCode 200 || $statusCode 299) {
  15708.                 throw new ApiException(
  15709.                     sprintf(
  15710.                         '[%d] Error connecting to the API (%s)',
  15711.                         $statusCode,
  15712.                         $request->getUri()
  15713.                     ),
  15714.                     $statusCode,
  15715.                     $response->getHeaders(),
  15716.                     $response->getBody()
  15717.                 );
  15718.             }
  15719.             $responseBody $response->getBody();
  15720.             switch($statusCode) {
  15721.                 case 200:
  15722.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Accounts' === '\SplFileObject') {
  15723.                         $content $responseBody//stream goes to serializer
  15724.                     } else {
  15725.                         $content $responseBody->getContents();
  15726.                     }
  15727.                     return [
  15728.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Accounts', []),
  15729.                         $response->getStatusCode(),
  15730.                         $response->getHeaders()
  15731.                     ];
  15732.                 case 400:
  15733.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  15734.                         $content $responseBody//stream goes to serializer
  15735.                     } else {
  15736.                         $content $responseBody->getContents();
  15737.                     }
  15738.                     return [
  15739.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  15740.                         $response->getStatusCode(),
  15741.                         $response->getHeaders()
  15742.                     ];
  15743.             }
  15744.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Accounts';
  15745.             $responseBody $response->getBody();
  15746.             if ($returnType === '\SplFileObject') {
  15747.                 $content $responseBody//stream goes to serializer
  15748.             } else {
  15749.                 $content $responseBody->getContents();
  15750.             }
  15751.             return [
  15752.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  15753.                 $response->getStatusCode(),
  15754.                 $response->getHeaders()
  15755.             ];
  15756.         } catch (ApiException $e) {
  15757.             switch ($e->getCode()) {
  15758.                 case 200:
  15759.                     $data AccountingObjectSerializer::deserialize(
  15760.                         $e->getResponseBody(),
  15761.                         '\XeroAPI\XeroPHP\Models\Accounting\Accounts',
  15762.                         $e->getResponseHeaders()
  15763.                     );
  15764.                     $e->setResponseObject($data);
  15765.                     break;
  15766.                 case 400:
  15767.                     $data AccountingObjectSerializer::deserialize(
  15768.                         $e->getResponseBody(),
  15769.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  15770.                         $e->getResponseHeaders()
  15771.                     );
  15772.                     $e->setResponseObject($data);
  15773.                     break;
  15774.             }
  15775.             throw $e;
  15776.         }
  15777.     }
  15778.     /**
  15779.      * Operation deleteAccountAsync
  15780.      * Deletes a chart of accounts
  15781.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  15782.      * @param  string $account_id Unique identifier for Account object (required)
  15783.      * @throws \InvalidArgumentException
  15784.      * @return \GuzzleHttp\Promise\PromiseInterface
  15785.      */
  15786.     public function deleteAccountAsync($xero_tenant_id$account_id)
  15787.     {
  15788.         return $this->deleteAccountAsyncWithHttpInfo($xero_tenant_id$account_id)
  15789.             ->then(
  15790.                 function ($response) {
  15791.                     return $response[0];
  15792.                 }
  15793.             );
  15794.     }
  15795.     /**
  15796.      * Operation deleteAccountAsyncWithHttpInfo
  15797.      * Deletes a chart of accounts
  15798.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  15799.      * @param  string $account_id Unique identifier for Account object (required)
  15800.      * @throws \InvalidArgumentException
  15801.      * @return \GuzzleHttp\Promise\PromiseInterface */
  15802.     public function deleteAccountAsyncWithHttpInfo($xero_tenant_id$account_id)
  15803.     {
  15804.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Accounts';
  15805.         $request $this->deleteAccountRequest($xero_tenant_id$account_id);
  15806.         return $this->client
  15807.             ->sendAsync($request$this->createHttpClientOption())
  15808.             ->then(
  15809.                 function ($response) use ($returnType) {
  15810.                     $responseBody $response->getBody();
  15811.                     if ($returnType === '\SplFileObject') {
  15812.                         $content $responseBody//stream goes to serializer
  15813.                     } else {
  15814.                         $content $responseBody->getContents();
  15815.                     }
  15816.                     return [
  15817.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  15818.                         $response->getStatusCode(),
  15819.                         $response->getHeaders()
  15820.                     ];
  15821.                 },
  15822.                 function ($exception) {
  15823.                     $response $exception->getResponse();
  15824.                     $statusCode $response->getStatusCode();
  15825.                     throw new ApiException(
  15826.                         sprintf(
  15827.                             '[%d] Error connecting to the API (%s)',
  15828.                             $statusCode,
  15829.                             $exception->getRequest()->getUri()
  15830.                         ),
  15831.                         $statusCode,
  15832.                         $response->getHeaders(),
  15833.                         $response->getBody()
  15834.                     );
  15835.                 }
  15836.             );
  15837.     }
  15838.     /**
  15839.      * Create request for operation 'deleteAccount'
  15840.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  15841.      * @param  string $account_id Unique identifier for Account object (required)
  15842.      * @throws \InvalidArgumentException
  15843.      * @return \GuzzleHttp\Psr7\Request  */
  15844.     protected function deleteAccountRequest($xero_tenant_id$account_id)
  15845.     {
  15846.         // verify the required parameter 'xero_tenant_id' is set
  15847.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  15848.             throw new \InvalidArgumentException(
  15849.                 'Missing the required parameter $xero_tenant_id when calling deleteAccount'
  15850.             );
  15851.         }
  15852.         // verify the required parameter 'account_id' is set
  15853.         if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
  15854.             throw new \InvalidArgumentException(
  15855.                 'Missing the required parameter $account_id when calling deleteAccount'
  15856.             );
  15857.         }
  15858.         $resourcePath '/Accounts/{AccountID}';
  15859.         $formParams = [];
  15860.         $queryParams = [];
  15861.         $headerParams = [];
  15862.         $httpBody '';
  15863.         $multipart false;
  15864.         // header params
  15865.         if ($xero_tenant_id !== null) {
  15866.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  15867.         }
  15868.         // path params
  15869.         if ($account_id !== null) {
  15870.             $resourcePath str_replace(
  15871.                 '{' 'AccountID' '}',
  15872.                 AccountingObjectSerializer::toPathValue($account_id),
  15873.                 $resourcePath
  15874.             );
  15875.         }
  15876.         // body params
  15877.         $_tempBody null;
  15878.         if ($multipart) {
  15879.             $headers $this->headerSelector->selectHeadersForMultipart(
  15880.                 ['application/json']
  15881.             );
  15882.         } else {
  15883.             $headers $this->headerSelector->selectHeaders(
  15884.                 ['application/json'],
  15885.                 []
  15886.             );
  15887.         }
  15888.         // for model (json/xml)
  15889.         if (isset($_tempBody)) {
  15890.             // $_tempBody is the method argument, if present
  15891.             if ($headers['Content-Type'] === 'application/json') {
  15892.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  15893.             } else {
  15894.                 $httpBody $_tempBody;
  15895.             }
  15896.         } elseif (count($formParams) > 0) {
  15897.             if ($multipart) {
  15898.                 $multipartContents = [
  15899.                     [
  15900.                         'Content-type' => 'multipart/form-data',
  15901.                     ]
  15902.                 ];
  15903.                 
  15904.                 // for HTTP post (form)
  15905.                 $httpBody = new MultipartStream($multipartContents);
  15906.             } elseif ($headers['Content-Type'] === 'application/json') {
  15907.                 $httpBody \GuzzleHttp\json_encode($formParams);
  15908.             } else {
  15909.                 // for HTTP post (form)
  15910.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  15911.             }
  15912.         }
  15913.         // this endpoint requires OAuth (access token)
  15914.         if ($this->config->getAccessToken() !== null) {
  15915.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  15916.         }
  15917.         $defaultHeaders = [];
  15918.         if ($this->config->getUserAgent()) {
  15919.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  15920.         }
  15921.         $headers array_merge(
  15922.             $defaultHeaders,
  15923.             $headerParams,
  15924.             $headers
  15925.         );
  15926.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  15927.         return new Request(
  15928.             'DELETE',
  15929.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  15930.             $headers,
  15931.             $httpBody
  15932.         );
  15933.     }
  15934.     /**
  15935.      * Operation deleteBatchPayment
  15936.      * Updates a specific batch payment for invoices and credit notes
  15937.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  15938.      * @param  \XeroAPI\XeroPHP\Models\Accounting\BatchPaymentDelete $batch_payment_delete batch_payment_delete (required)
  15939.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  15940.      * @throws \InvalidArgumentException
  15941.      * @return \XeroAPI\XeroPHP\Models\Accounting\BatchPayments|\XeroAPI\XeroPHP\Models\Accounting\Error
  15942.      */
  15943.     public function deleteBatchPayment($xero_tenant_id$batch_payment_delete)
  15944.     {
  15945.         list($response) = $this->deleteBatchPaymentWithHttpInfo($xero_tenant_id$batch_payment_delete);
  15946.         return $response;
  15947.     }
  15948.     /**
  15949.      * Operation deleteBatchPaymentWithHttpInfo
  15950.      * Updates a specific batch payment for invoices and credit notes
  15951.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  15952.      * @param  \XeroAPI\XeroPHP\Models\Accounting\BatchPaymentDelete $batch_payment_delete (required)
  15953.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  15954.      * @throws \InvalidArgumentException
  15955.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\BatchPayments|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  15956.      */
  15957.     public function deleteBatchPaymentWithHttpInfo($xero_tenant_id$batch_payment_delete)
  15958.     {
  15959.         $request $this->deleteBatchPaymentRequest($xero_tenant_id$batch_payment_delete);
  15960.         try {
  15961.             $options $this->createHttpClientOption();
  15962.             try {
  15963.                 $response $this->client->send($request$options);
  15964.             } catch (RequestException $e) {
  15965.                 throw new ApiException(
  15966.                     "[{$e->getCode()}{$e->getMessage()}",
  15967.                     $e->getCode(),
  15968.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  15969.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  15970.                 );
  15971.             }
  15972.             $statusCode $response->getStatusCode();
  15973.             if ($statusCode 200 || $statusCode 299) {
  15974.                 throw new ApiException(
  15975.                     sprintf(
  15976.                         '[%d] Error connecting to the API (%s)',
  15977.                         $statusCode,
  15978.                         $request->getUri()
  15979.                     ),
  15980.                     $statusCode,
  15981.                     $response->getHeaders(),
  15982.                     $response->getBody()
  15983.                 );
  15984.             }
  15985.             $responseBody $response->getBody();
  15986.             switch($statusCode) {
  15987.                 case 200:
  15988.                     if ('\XeroAPI\XeroPHP\Models\Accounting\BatchPayments' === '\SplFileObject') {
  15989.                         $content $responseBody//stream goes to serializer
  15990.                     } else {
  15991.                         $content $responseBody->getContents();
  15992.                     }
  15993.                     return [
  15994.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\BatchPayments', []),
  15995.                         $response->getStatusCode(),
  15996.                         $response->getHeaders()
  15997.                     ];
  15998.                 case 400:
  15999.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  16000.                         $content $responseBody//stream goes to serializer
  16001.                     } else {
  16002.                         $content $responseBody->getContents();
  16003.                     }
  16004.                     return [
  16005.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  16006.                         $response->getStatusCode(),
  16007.                         $response->getHeaders()
  16008.                     ];
  16009.             }
  16010.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\BatchPayments';
  16011.             $responseBody $response->getBody();
  16012.             if ($returnType === '\SplFileObject') {
  16013.                 $content $responseBody//stream goes to serializer
  16014.             } else {
  16015.                 $content $responseBody->getContents();
  16016.             }
  16017.             return [
  16018.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  16019.                 $response->getStatusCode(),
  16020.                 $response->getHeaders()
  16021.             ];
  16022.         } catch (ApiException $e) {
  16023.             switch ($e->getCode()) {
  16024.                 case 200:
  16025.                     $data AccountingObjectSerializer::deserialize(
  16026.                         $e->getResponseBody(),
  16027.                         '\XeroAPI\XeroPHP\Models\Accounting\BatchPayments',
  16028.                         $e->getResponseHeaders()
  16029.                     );
  16030.                     $e->setResponseObject($data);
  16031.                     break;
  16032.                 case 400:
  16033.                     $data AccountingObjectSerializer::deserialize(
  16034.                         $e->getResponseBody(),
  16035.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  16036.                         $e->getResponseHeaders()
  16037.                     );
  16038.                     $e->setResponseObject($data);
  16039.                     break;
  16040.             }
  16041.             throw $e;
  16042.         }
  16043.     }
  16044.     /**
  16045.      * Operation deleteBatchPaymentAsync
  16046.      * Updates a specific batch payment for invoices and credit notes
  16047.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  16048.      * @param  \XeroAPI\XeroPHP\Models\Accounting\BatchPaymentDelete $batch_payment_delete (required)
  16049.      * @throws \InvalidArgumentException
  16050.      * @return \GuzzleHttp\Promise\PromiseInterface
  16051.      */
  16052.     public function deleteBatchPaymentAsync($xero_tenant_id$batch_payment_delete)
  16053.     {
  16054.         return $this->deleteBatchPaymentAsyncWithHttpInfo($xero_tenant_id$batch_payment_delete)
  16055.             ->then(
  16056.                 function ($response) {
  16057.                     return $response[0];
  16058.                 }
  16059.             );
  16060.     }
  16061.     /**
  16062.      * Operation deleteBatchPaymentAsyncWithHttpInfo
  16063.      * Updates a specific batch payment for invoices and credit notes
  16064.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  16065.      * @param  \XeroAPI\XeroPHP\Models\Accounting\BatchPaymentDelete $batch_payment_delete (required)
  16066.      * @throws \InvalidArgumentException
  16067.      * @return \GuzzleHttp\Promise\PromiseInterface */
  16068.     public function deleteBatchPaymentAsyncWithHttpInfo($xero_tenant_id$batch_payment_delete)
  16069.     {
  16070.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\BatchPayments';
  16071.         $request $this->deleteBatchPaymentRequest($xero_tenant_id$batch_payment_delete);
  16072.         return $this->client
  16073.             ->sendAsync($request$this->createHttpClientOption())
  16074.             ->then(
  16075.                 function ($response) use ($returnType) {
  16076.                     $responseBody $response->getBody();
  16077.                     if ($returnType === '\SplFileObject') {
  16078.                         $content $responseBody//stream goes to serializer
  16079.                     } else {
  16080.                         $content $responseBody->getContents();
  16081.                     }
  16082.                     return [
  16083.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  16084.                         $response->getStatusCode(),
  16085.                         $response->getHeaders()
  16086.                     ];
  16087.                 },
  16088.                 function ($exception) {
  16089.                     $response $exception->getResponse();
  16090.                     $statusCode $response->getStatusCode();
  16091.                     throw new ApiException(
  16092.                         sprintf(
  16093.                             '[%d] Error connecting to the API (%s)',
  16094.                             $statusCode,
  16095.                             $exception->getRequest()->getUri()
  16096.                         ),
  16097.                         $statusCode,
  16098.                         $response->getHeaders(),
  16099.                         $response->getBody()
  16100.                     );
  16101.                 }
  16102.             );
  16103.     }
  16104.     /**
  16105.      * Create request for operation 'deleteBatchPayment'
  16106.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  16107.      * @param  \XeroAPI\XeroPHP\Models\Accounting\BatchPaymentDelete $batch_payment_delete (required)
  16108.      * @throws \InvalidArgumentException
  16109.      * @return \GuzzleHttp\Psr7\Request  */
  16110.     protected function deleteBatchPaymentRequest($xero_tenant_id$batch_payment_delete)
  16111.     {
  16112.         // verify the required parameter 'xero_tenant_id' is set
  16113.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  16114.             throw new \InvalidArgumentException(
  16115.                 'Missing the required parameter $xero_tenant_id when calling deleteBatchPayment'
  16116.             );
  16117.         }
  16118.         // verify the required parameter 'batch_payment_delete' is set
  16119.         if ($batch_payment_delete === null || (is_array($batch_payment_delete) && count($batch_payment_delete) === 0)) {
  16120.             throw new \InvalidArgumentException(
  16121.                 'Missing the required parameter $batch_payment_delete when calling deleteBatchPayment'
  16122.             );
  16123.         }
  16124.         $resourcePath '/BatchPayments';
  16125.         $formParams = [];
  16126.         $queryParams = [];
  16127.         $headerParams = [];
  16128.         $httpBody '';
  16129.         $multipart false;
  16130.         // header params
  16131.         if ($xero_tenant_id !== null) {
  16132.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  16133.         }
  16134.         // body params
  16135.         $_tempBody null;
  16136.         if (isset($batch_payment_delete)) {
  16137.             $_tempBody $batch_payment_delete;
  16138.         }
  16139.         if ($multipart) {
  16140.             $headers $this->headerSelector->selectHeadersForMultipart(
  16141.                 ['application/json']
  16142.             );
  16143.         } else {
  16144.             $headers $this->headerSelector->selectHeaders(
  16145.                 ['application/json'],
  16146.                 ['application/json']
  16147.             );
  16148.         }
  16149.         // for model (json/xml)
  16150.         if (isset($_tempBody)) {
  16151.             // $_tempBody is the method argument, if present
  16152.             if ($headers['Content-Type'] === 'application/json') {
  16153.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  16154.             } else {
  16155.                 $httpBody $_tempBody;
  16156.             }
  16157.         } elseif (count($formParams) > 0) {
  16158.             if ($multipart) {
  16159.                 $multipartContents = [
  16160.                     [
  16161.                         'Content-type' => 'multipart/form-data',
  16162.                     ]
  16163.                 ];
  16164.                 
  16165.                 // for HTTP post (form)
  16166.                 $httpBody = new MultipartStream($multipartContents);
  16167.             } elseif ($headers['Content-Type'] === 'application/json') {
  16168.                 $httpBody \GuzzleHttp\json_encode($formParams);
  16169.             } else {
  16170.                 // for HTTP post (form)
  16171.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  16172.             }
  16173.         }
  16174.         // this endpoint requires OAuth (access token)
  16175.         if ($this->config->getAccessToken() !== null) {
  16176.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  16177.         }
  16178.         $defaultHeaders = [];
  16179.         if ($this->config->getUserAgent()) {
  16180.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  16181.         }
  16182.         $headers array_merge(
  16183.             $defaultHeaders,
  16184.             $headerParams,
  16185.             $headers
  16186.         );
  16187.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  16188.         return new Request(
  16189.             'POST',
  16190.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  16191.             $headers,
  16192.             $httpBody
  16193.         );
  16194.     }
  16195.     /**
  16196.      * Operation deleteBatchPaymentByUrlParam
  16197.      * Updates a specific batch payment for invoices and credit notes
  16198.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  16199.      * @param  string $batch_payment_id Unique identifier for BatchPayment (required)
  16200.      * @param  \XeroAPI\XeroPHP\Models\Accounting\BatchPaymentDeleteByUrlParam $batch_payment_delete_by_url_param batch_payment_delete_by_url_param (required)
  16201.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  16202.      * @throws \InvalidArgumentException
  16203.      * @return \XeroAPI\XeroPHP\Models\Accounting\BatchPayments|\XeroAPI\XeroPHP\Models\Accounting\Error
  16204.      */
  16205.     public function deleteBatchPaymentByUrlParam($xero_tenant_id$batch_payment_id$batch_payment_delete_by_url_param)
  16206.     {
  16207.         list($response) = $this->deleteBatchPaymentByUrlParamWithHttpInfo($xero_tenant_id$batch_payment_id$batch_payment_delete_by_url_param);
  16208.         return $response;
  16209.     }
  16210.     /**
  16211.      * Operation deleteBatchPaymentByUrlParamWithHttpInfo
  16212.      * Updates a specific batch payment for invoices and credit notes
  16213.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  16214.      * @param  string $batch_payment_id Unique identifier for BatchPayment (required)
  16215.      * @param  \XeroAPI\XeroPHP\Models\Accounting\BatchPaymentDeleteByUrlParam $batch_payment_delete_by_url_param (required)
  16216.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  16217.      * @throws \InvalidArgumentException
  16218.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\BatchPayments|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  16219.      */
  16220.     public function deleteBatchPaymentByUrlParamWithHttpInfo($xero_tenant_id$batch_payment_id$batch_payment_delete_by_url_param)
  16221.     {
  16222.         $request $this->deleteBatchPaymentByUrlParamRequest($xero_tenant_id$batch_payment_id$batch_payment_delete_by_url_param);
  16223.         try {
  16224.             $options $this->createHttpClientOption();
  16225.             try {
  16226.                 $response $this->client->send($request$options);
  16227.             } catch (RequestException $e) {
  16228.                 throw new ApiException(
  16229.                     "[{$e->getCode()}{$e->getMessage()}",
  16230.                     $e->getCode(),
  16231.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  16232.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  16233.                 );
  16234.             }
  16235.             $statusCode $response->getStatusCode();
  16236.             if ($statusCode 200 || $statusCode 299) {
  16237.                 throw new ApiException(
  16238.                     sprintf(
  16239.                         '[%d] Error connecting to the API (%s)',
  16240.                         $statusCode,
  16241.                         $request->getUri()
  16242.                     ),
  16243.                     $statusCode,
  16244.                     $response->getHeaders(),
  16245.                     $response->getBody()
  16246.                 );
  16247.             }
  16248.             $responseBody $response->getBody();
  16249.             switch($statusCode) {
  16250.                 case 200:
  16251.                     if ('\XeroAPI\XeroPHP\Models\Accounting\BatchPayments' === '\SplFileObject') {
  16252.                         $content $responseBody//stream goes to serializer
  16253.                     } else {
  16254.                         $content $responseBody->getContents();
  16255.                     }
  16256.                     return [
  16257.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\BatchPayments', []),
  16258.                         $response->getStatusCode(),
  16259.                         $response->getHeaders()
  16260.                     ];
  16261.                 case 400:
  16262.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  16263.                         $content $responseBody//stream goes to serializer
  16264.                     } else {
  16265.                         $content $responseBody->getContents();
  16266.                     }
  16267.                     return [
  16268.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  16269.                         $response->getStatusCode(),
  16270.                         $response->getHeaders()
  16271.                     ];
  16272.             }
  16273.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\BatchPayments';
  16274.             $responseBody $response->getBody();
  16275.             if ($returnType === '\SplFileObject') {
  16276.                 $content $responseBody//stream goes to serializer
  16277.             } else {
  16278.                 $content $responseBody->getContents();
  16279.             }
  16280.             return [
  16281.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  16282.                 $response->getStatusCode(),
  16283.                 $response->getHeaders()
  16284.             ];
  16285.         } catch (ApiException $e) {
  16286.             switch ($e->getCode()) {
  16287.                 case 200:
  16288.                     $data AccountingObjectSerializer::deserialize(
  16289.                         $e->getResponseBody(),
  16290.                         '\XeroAPI\XeroPHP\Models\Accounting\BatchPayments',
  16291.                         $e->getResponseHeaders()
  16292.                     );
  16293.                     $e->setResponseObject($data);
  16294.                     break;
  16295.                 case 400:
  16296.                     $data AccountingObjectSerializer::deserialize(
  16297.                         $e->getResponseBody(),
  16298.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  16299.                         $e->getResponseHeaders()
  16300.                     );
  16301.                     $e->setResponseObject($data);
  16302.                     break;
  16303.             }
  16304.             throw $e;
  16305.         }
  16306.     }
  16307.     /**
  16308.      * Operation deleteBatchPaymentByUrlParamAsync
  16309.      * Updates a specific batch payment for invoices and credit notes
  16310.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  16311.      * @param  string $batch_payment_id Unique identifier for BatchPayment (required)
  16312.      * @param  \XeroAPI\XeroPHP\Models\Accounting\BatchPaymentDeleteByUrlParam $batch_payment_delete_by_url_param (required)
  16313.      * @throws \InvalidArgumentException
  16314.      * @return \GuzzleHttp\Promise\PromiseInterface
  16315.      */
  16316.     public function deleteBatchPaymentByUrlParamAsync($xero_tenant_id$batch_payment_id$batch_payment_delete_by_url_param)
  16317.     {
  16318.         return $this->deleteBatchPaymentByUrlParamAsyncWithHttpInfo($xero_tenant_id$batch_payment_id$batch_payment_delete_by_url_param)
  16319.             ->then(
  16320.                 function ($response) {
  16321.                     return $response[0];
  16322.                 }
  16323.             );
  16324.     }
  16325.     /**
  16326.      * Operation deleteBatchPaymentByUrlParamAsyncWithHttpInfo
  16327.      * Updates a specific batch payment for invoices and credit notes
  16328.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  16329.      * @param  string $batch_payment_id Unique identifier for BatchPayment (required)
  16330.      * @param  \XeroAPI\XeroPHP\Models\Accounting\BatchPaymentDeleteByUrlParam $batch_payment_delete_by_url_param (required)
  16331.      * @throws \InvalidArgumentException
  16332.      * @return \GuzzleHttp\Promise\PromiseInterface */
  16333.     public function deleteBatchPaymentByUrlParamAsyncWithHttpInfo($xero_tenant_id$batch_payment_id$batch_payment_delete_by_url_param)
  16334.     {
  16335.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\BatchPayments';
  16336.         $request $this->deleteBatchPaymentByUrlParamRequest($xero_tenant_id$batch_payment_id$batch_payment_delete_by_url_param);
  16337.         return $this->client
  16338.             ->sendAsync($request$this->createHttpClientOption())
  16339.             ->then(
  16340.                 function ($response) use ($returnType) {
  16341.                     $responseBody $response->getBody();
  16342.                     if ($returnType === '\SplFileObject') {
  16343.                         $content $responseBody//stream goes to serializer
  16344.                     } else {
  16345.                         $content $responseBody->getContents();
  16346.                     }
  16347.                     return [
  16348.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  16349.                         $response->getStatusCode(),
  16350.                         $response->getHeaders()
  16351.                     ];
  16352.                 },
  16353.                 function ($exception) {
  16354.                     $response $exception->getResponse();
  16355.                     $statusCode $response->getStatusCode();
  16356.                     throw new ApiException(
  16357.                         sprintf(
  16358.                             '[%d] Error connecting to the API (%s)',
  16359.                             $statusCode,
  16360.                             $exception->getRequest()->getUri()
  16361.                         ),
  16362.                         $statusCode,
  16363.                         $response->getHeaders(),
  16364.                         $response->getBody()
  16365.                     );
  16366.                 }
  16367.             );
  16368.     }
  16369.     /**
  16370.      * Create request for operation 'deleteBatchPaymentByUrlParam'
  16371.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  16372.      * @param  string $batch_payment_id Unique identifier for BatchPayment (required)
  16373.      * @param  \XeroAPI\XeroPHP\Models\Accounting\BatchPaymentDeleteByUrlParam $batch_payment_delete_by_url_param (required)
  16374.      * @throws \InvalidArgumentException
  16375.      * @return \GuzzleHttp\Psr7\Request  */
  16376.     protected function deleteBatchPaymentByUrlParamRequest($xero_tenant_id$batch_payment_id$batch_payment_delete_by_url_param)
  16377.     {
  16378.         // verify the required parameter 'xero_tenant_id' is set
  16379.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  16380.             throw new \InvalidArgumentException(
  16381.                 'Missing the required parameter $xero_tenant_id when calling deleteBatchPaymentByUrlParam'
  16382.             );
  16383.         }
  16384.         // verify the required parameter 'batch_payment_id' is set
  16385.         if ($batch_payment_id === null || (is_array($batch_payment_id) && count($batch_payment_id) === 0)) {
  16386.             throw new \InvalidArgumentException(
  16387.                 'Missing the required parameter $batch_payment_id when calling deleteBatchPaymentByUrlParam'
  16388.             );
  16389.         }
  16390.         // verify the required parameter 'batch_payment_delete_by_url_param' is set
  16391.         if ($batch_payment_delete_by_url_param === null || (is_array($batch_payment_delete_by_url_param) && count($batch_payment_delete_by_url_param) === 0)) {
  16392.             throw new \InvalidArgumentException(
  16393.                 'Missing the required parameter $batch_payment_delete_by_url_param when calling deleteBatchPaymentByUrlParam'
  16394.             );
  16395.         }
  16396.         $resourcePath '/BatchPayments/{BatchPaymentID}';
  16397.         $formParams = [];
  16398.         $queryParams = [];
  16399.         $headerParams = [];
  16400.         $httpBody '';
  16401.         $multipart false;
  16402.         // header params
  16403.         if ($xero_tenant_id !== null) {
  16404.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  16405.         }
  16406.         // path params
  16407.         if ($batch_payment_id !== null) {
  16408.             $resourcePath str_replace(
  16409.                 '{' 'BatchPaymentID' '}',
  16410.                 AccountingObjectSerializer::toPathValue($batch_payment_id),
  16411.                 $resourcePath
  16412.             );
  16413.         }
  16414.         // body params
  16415.         $_tempBody null;
  16416.         if (isset($batch_payment_delete_by_url_param)) {
  16417.             $_tempBody $batch_payment_delete_by_url_param;
  16418.         }
  16419.         if ($multipart) {
  16420.             $headers $this->headerSelector->selectHeadersForMultipart(
  16421.                 ['application/json']
  16422.             );
  16423.         } else {
  16424.             $headers $this->headerSelector->selectHeaders(
  16425.                 ['application/json'],
  16426.                 ['application/json']
  16427.             );
  16428.         }
  16429.         // for model (json/xml)
  16430.         if (isset($_tempBody)) {
  16431.             // $_tempBody is the method argument, if present
  16432.             if ($headers['Content-Type'] === 'application/json') {
  16433.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  16434.             } else {
  16435.                 $httpBody $_tempBody;
  16436.             }
  16437.         } elseif (count($formParams) > 0) {
  16438.             if ($multipart) {
  16439.                 $multipartContents = [
  16440.                     [
  16441.                         'Content-type' => 'multipart/form-data',
  16442.                     ]
  16443.                 ];
  16444.                 
  16445.                 // for HTTP post (form)
  16446.                 $httpBody = new MultipartStream($multipartContents);
  16447.             } elseif ($headers['Content-Type'] === 'application/json') {
  16448.                 $httpBody \GuzzleHttp\json_encode($formParams);
  16449.             } else {
  16450.                 // for HTTP post (form)
  16451.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  16452.             }
  16453.         }
  16454.         // this endpoint requires OAuth (access token)
  16455.         if ($this->config->getAccessToken() !== null) {
  16456.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  16457.         }
  16458.         $defaultHeaders = [];
  16459.         if ($this->config->getUserAgent()) {
  16460.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  16461.         }
  16462.         $headers array_merge(
  16463.             $defaultHeaders,
  16464.             $headerParams,
  16465.             $headers
  16466.         );
  16467.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  16468.         return new Request(
  16469.             'POST',
  16470.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  16471.             $headers,
  16472.             $httpBody
  16473.         );
  16474.     }
  16475.     /**
  16476.      * Operation deleteContactGroupContact
  16477.      * Deletes a specific contact from a contact group using a unique contact Id
  16478.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  16479.      * @param  string $contact_group_id Unique identifier for a Contact Group (required)
  16480.      * @param  string $contact_id Unique identifier for a Contact (required)
  16481.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  16482.      * @throws \InvalidArgumentException
  16483.      * @return void
  16484.      */
  16485.     public function deleteContactGroupContact($xero_tenant_id$contact_group_id$contact_id)
  16486.     {
  16487.         $this->deleteContactGroupContactWithHttpInfo($xero_tenant_id$contact_group_id$contact_id);
  16488.     }
  16489.     /**
  16490.      * Operation deleteContactGroupContactWithHttpInfo
  16491.      * Deletes a specific contact from a contact group using a unique contact Id
  16492.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  16493.      * @param  string $contact_group_id Unique identifier for a Contact Group (required)
  16494.      * @param  string $contact_id Unique identifier for a Contact (required)
  16495.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  16496.      * @throws \InvalidArgumentException
  16497.      * @return array of null, HTTP status code, HTTP response headers (array of strings)
  16498.      */
  16499.     public function deleteContactGroupContactWithHttpInfo($xero_tenant_id$contact_group_id$contact_id)
  16500.     {
  16501.         $request $this->deleteContactGroupContactRequest($xero_tenant_id$contact_group_id$contact_id);
  16502.         try {
  16503.             $options $this->createHttpClientOption();
  16504.             try {
  16505.                 $response $this->client->send($request$options);
  16506.             } catch (RequestException $e) {
  16507.                 throw new ApiException(
  16508.                     "[{$e->getCode()}{$e->getMessage()}",
  16509.                     $e->getCode(),
  16510.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  16511.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  16512.                 );
  16513.             }
  16514.             $statusCode $response->getStatusCode();
  16515.             if ($statusCode 200 || $statusCode 299) {
  16516.                 throw new ApiException(
  16517.                     sprintf(
  16518.                         '[%d] Error connecting to the API (%s)',
  16519.                         $statusCode,
  16520.                         $request->getUri()
  16521.                     ),
  16522.                     $statusCode,
  16523.                     $response->getHeaders(),
  16524.                     $response->getBody()
  16525.                 );
  16526.             }
  16527.             return [null$statusCode$response->getHeaders()];
  16528.         } catch (ApiException $e) {
  16529.             switch ($e->getCode()) {
  16530.                 case 400:
  16531.                     $data AccountingObjectSerializer::deserialize(
  16532.                         $e->getResponseBody(),
  16533.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  16534.                         $e->getResponseHeaders()
  16535.                     );
  16536.                     $e->setResponseObject($data);
  16537.                     break;
  16538.             }
  16539.             throw $e;
  16540.         }
  16541.     }
  16542.     /**
  16543.      * Operation deleteContactGroupContactAsync
  16544.      * Deletes a specific contact from a contact group using a unique contact Id
  16545.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  16546.      * @param  string $contact_group_id Unique identifier for a Contact Group (required)
  16547.      * @param  string $contact_id Unique identifier for a Contact (required)
  16548.      * @throws \InvalidArgumentException
  16549.      * @return \GuzzleHttp\Promise\PromiseInterface
  16550.      */
  16551.     public function deleteContactGroupContactAsync($xero_tenant_id$contact_group_id$contact_id)
  16552.     {
  16553.         return $this->deleteContactGroupContactAsyncWithHttpInfo($xero_tenant_id$contact_group_id$contact_id)
  16554.             ->then(
  16555.                 function ($response) {
  16556.                     return $response[0];
  16557.                 }
  16558.             );
  16559.     }
  16560.     /**
  16561.      * Operation deleteContactGroupContactAsyncWithHttpInfo
  16562.      * Deletes a specific contact from a contact group using a unique contact Id
  16563.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  16564.      * @param  string $contact_group_id Unique identifier for a Contact Group (required)
  16565.      * @param  string $contact_id Unique identifier for a Contact (required)
  16566.      * @throws \InvalidArgumentException
  16567.      * @return \GuzzleHttp\Promise\PromiseInterface */
  16568.     public function deleteContactGroupContactAsyncWithHttpInfo($xero_tenant_id$contact_group_id$contact_id)
  16569.     {
  16570.         $returnType '';
  16571.         $request $this->deleteContactGroupContactRequest($xero_tenant_id$contact_group_id$contact_id);
  16572.         return $this->client
  16573.             ->sendAsync($request$this->createHttpClientOption())
  16574.             ->then(
  16575.                 function ($response) use ($returnType) {
  16576.                     return [null$response->getStatusCode(), $response->getHeaders()];
  16577.                 },
  16578.                 function ($exception) {
  16579.                     $response $exception->getResponse();
  16580.                     $statusCode $response->getStatusCode();
  16581.                     throw new ApiException(
  16582.                         sprintf(
  16583.                             '[%d] Error connecting to the API (%s)',
  16584.                             $statusCode,
  16585.                             $exception->getRequest()->getUri()
  16586.                         ),
  16587.                         $statusCode,
  16588.                         $response->getHeaders(),
  16589.                         $response->getBody()
  16590.                     );
  16591.                 }
  16592.             );
  16593.     }
  16594.     /**
  16595.      * Create request for operation 'deleteContactGroupContact'
  16596.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  16597.      * @param  string $contact_group_id Unique identifier for a Contact Group (required)
  16598.      * @param  string $contact_id Unique identifier for a Contact (required)
  16599.      * @throws \InvalidArgumentException
  16600.      * @return \GuzzleHttp\Psr7\Request  */
  16601.     protected function deleteContactGroupContactRequest($xero_tenant_id$contact_group_id$contact_id)
  16602.     {
  16603.         // verify the required parameter 'xero_tenant_id' is set
  16604.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  16605.             throw new \InvalidArgumentException(
  16606.                 'Missing the required parameter $xero_tenant_id when calling deleteContactGroupContact'
  16607.             );
  16608.         }
  16609.         // verify the required parameter 'contact_group_id' is set
  16610.         if ($contact_group_id === null || (is_array($contact_group_id) && count($contact_group_id) === 0)) {
  16611.             throw new \InvalidArgumentException(
  16612.                 'Missing the required parameter $contact_group_id when calling deleteContactGroupContact'
  16613.             );
  16614.         }
  16615.         // verify the required parameter 'contact_id' is set
  16616.         if ($contact_id === null || (is_array($contact_id) && count($contact_id) === 0)) {
  16617.             throw new \InvalidArgumentException(
  16618.                 'Missing the required parameter $contact_id when calling deleteContactGroupContact'
  16619.             );
  16620.         }
  16621.         $resourcePath '/ContactGroups/{ContactGroupID}/Contacts/{ContactID}';
  16622.         $formParams = [];
  16623.         $queryParams = [];
  16624.         $headerParams = [];
  16625.         $httpBody '';
  16626.         $multipart false;
  16627.         // header params
  16628.         if ($xero_tenant_id !== null) {
  16629.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  16630.         }
  16631.         // path params
  16632.         if ($contact_group_id !== null) {
  16633.             $resourcePath str_replace(
  16634.                 '{' 'ContactGroupID' '}',
  16635.                 AccountingObjectSerializer::toPathValue($contact_group_id),
  16636.                 $resourcePath
  16637.             );
  16638.         }
  16639.         // path params
  16640.         if ($contact_id !== null) {
  16641.             $resourcePath str_replace(
  16642.                 '{' 'ContactID' '}',
  16643.                 AccountingObjectSerializer::toPathValue($contact_id),
  16644.                 $resourcePath
  16645.             );
  16646.         }
  16647.         // body params
  16648.         $_tempBody null;
  16649.         if ($multipart) {
  16650.             $headers $this->headerSelector->selectHeadersForMultipart(
  16651.                 ['application/json']
  16652.             );
  16653.         } else {
  16654.             $headers $this->headerSelector->selectHeaders(
  16655.                 ['application/json'],
  16656.                 []
  16657.             );
  16658.         }
  16659.         // for model (json/xml)
  16660.         if (isset($_tempBody)) {
  16661.             // $_tempBody is the method argument, if present
  16662.             if ($headers['Content-Type'] === 'application/json') {
  16663.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  16664.             } else {
  16665.                 $httpBody $_tempBody;
  16666.             }
  16667.         } elseif (count($formParams) > 0) {
  16668.             if ($multipart) {
  16669.                 $multipartContents = [
  16670.                     [
  16671.                         'Content-type' => 'multipart/form-data',
  16672.                     ]
  16673.                 ];
  16674.                 
  16675.                 // for HTTP post (form)
  16676.                 $httpBody = new MultipartStream($multipartContents);
  16677.             } elseif ($headers['Content-Type'] === 'application/json') {
  16678.                 $httpBody \GuzzleHttp\json_encode($formParams);
  16679.             } else {
  16680.                 // for HTTP post (form)
  16681.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  16682.             }
  16683.         }
  16684.         // this endpoint requires OAuth (access token)
  16685.         if ($this->config->getAccessToken() !== null) {
  16686.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  16687.         }
  16688.         $defaultHeaders = [];
  16689.         if ($this->config->getUserAgent()) {
  16690.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  16691.         }
  16692.         $headers array_merge(
  16693.             $defaultHeaders,
  16694.             $headerParams,
  16695.             $headers
  16696.         );
  16697.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  16698.         return new Request(
  16699.             'DELETE',
  16700.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  16701.             $headers,
  16702.             $httpBody
  16703.         );
  16704.     }
  16705.     /**
  16706.      * Operation deleteContactGroupContacts
  16707.      * Deletes all contacts from a specific contact group
  16708.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  16709.      * @param  string $contact_group_id Unique identifier for a Contact Group (required)
  16710.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  16711.      * @throws \InvalidArgumentException
  16712.      * @return void
  16713.      */
  16714.     public function deleteContactGroupContacts($xero_tenant_id$contact_group_id)
  16715.     {
  16716.         $this->deleteContactGroupContactsWithHttpInfo($xero_tenant_id$contact_group_id);
  16717.     }
  16718.     /**
  16719.      * Operation deleteContactGroupContactsWithHttpInfo
  16720.      * Deletes all contacts from a specific contact group
  16721.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  16722.      * @param  string $contact_group_id Unique identifier for a Contact Group (required)
  16723.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  16724.      * @throws \InvalidArgumentException
  16725.      * @return array of null, HTTP status code, HTTP response headers (array of strings)
  16726.      */
  16727.     public function deleteContactGroupContactsWithHttpInfo($xero_tenant_id$contact_group_id)
  16728.     {
  16729.         $request $this->deleteContactGroupContactsRequest($xero_tenant_id$contact_group_id);
  16730.         try {
  16731.             $options $this->createHttpClientOption();
  16732.             try {
  16733.                 $response $this->client->send($request$options);
  16734.             } catch (RequestException $e) {
  16735.                 throw new ApiException(
  16736.                     "[{$e->getCode()}{$e->getMessage()}",
  16737.                     $e->getCode(),
  16738.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  16739.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  16740.                 );
  16741.             }
  16742.             $statusCode $response->getStatusCode();
  16743.             if ($statusCode 200 || $statusCode 299) {
  16744.                 throw new ApiException(
  16745.                     sprintf(
  16746.                         '[%d] Error connecting to the API (%s)',
  16747.                         $statusCode,
  16748.                         $request->getUri()
  16749.                     ),
  16750.                     $statusCode,
  16751.                     $response->getHeaders(),
  16752.                     $response->getBody()
  16753.                 );
  16754.             }
  16755.             return [null$statusCode$response->getHeaders()];
  16756.         } catch (ApiException $e) {
  16757.             switch ($e->getCode()) {
  16758.             }
  16759.             throw $e;
  16760.         }
  16761.     }
  16762.     /**
  16763.      * Operation deleteContactGroupContactsAsync
  16764.      * Deletes all contacts from a specific contact group
  16765.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  16766.      * @param  string $contact_group_id Unique identifier for a Contact Group (required)
  16767.      * @throws \InvalidArgumentException
  16768.      * @return \GuzzleHttp\Promise\PromiseInterface
  16769.      */
  16770.     public function deleteContactGroupContactsAsync($xero_tenant_id$contact_group_id)
  16771.     {
  16772.         return $this->deleteContactGroupContactsAsyncWithHttpInfo($xero_tenant_id$contact_group_id)
  16773.             ->then(
  16774.                 function ($response) {
  16775.                     return $response[0];
  16776.                 }
  16777.             );
  16778.     }
  16779.     /**
  16780.      * Operation deleteContactGroupContactsAsyncWithHttpInfo
  16781.      * Deletes all contacts from a specific contact group
  16782.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  16783.      * @param  string $contact_group_id Unique identifier for a Contact Group (required)
  16784.      * @throws \InvalidArgumentException
  16785.      * @return \GuzzleHttp\Promise\PromiseInterface */
  16786.     public function deleteContactGroupContactsAsyncWithHttpInfo($xero_tenant_id$contact_group_id)
  16787.     {
  16788.         $returnType '';
  16789.         $request $this->deleteContactGroupContactsRequest($xero_tenant_id$contact_group_id);
  16790.         return $this->client
  16791.             ->sendAsync($request$this->createHttpClientOption())
  16792.             ->then(
  16793.                 function ($response) use ($returnType) {
  16794.                     return [null$response->getStatusCode(), $response->getHeaders()];
  16795.                 },
  16796.                 function ($exception) {
  16797.                     $response $exception->getResponse();
  16798.                     $statusCode $response->getStatusCode();
  16799.                     throw new ApiException(
  16800.                         sprintf(
  16801.                             '[%d] Error connecting to the API (%s)',
  16802.                             $statusCode,
  16803.                             $exception->getRequest()->getUri()
  16804.                         ),
  16805.                         $statusCode,
  16806.                         $response->getHeaders(),
  16807.                         $response->getBody()
  16808.                     );
  16809.                 }
  16810.             );
  16811.     }
  16812.     /**
  16813.      * Create request for operation 'deleteContactGroupContacts'
  16814.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  16815.      * @param  string $contact_group_id Unique identifier for a Contact Group (required)
  16816.      * @throws \InvalidArgumentException
  16817.      * @return \GuzzleHttp\Psr7\Request  */
  16818.     protected function deleteContactGroupContactsRequest($xero_tenant_id$contact_group_id)
  16819.     {
  16820.         // verify the required parameter 'xero_tenant_id' is set
  16821.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  16822.             throw new \InvalidArgumentException(
  16823.                 'Missing the required parameter $xero_tenant_id when calling deleteContactGroupContacts'
  16824.             );
  16825.         }
  16826.         // verify the required parameter 'contact_group_id' is set
  16827.         if ($contact_group_id === null || (is_array($contact_group_id) && count($contact_group_id) === 0)) {
  16828.             throw new \InvalidArgumentException(
  16829.                 'Missing the required parameter $contact_group_id when calling deleteContactGroupContacts'
  16830.             );
  16831.         }
  16832.         $resourcePath '/ContactGroups/{ContactGroupID}/Contacts';
  16833.         $formParams = [];
  16834.         $queryParams = [];
  16835.         $headerParams = [];
  16836.         $httpBody '';
  16837.         $multipart false;
  16838.         // header params
  16839.         if ($xero_tenant_id !== null) {
  16840.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  16841.         }
  16842.         // path params
  16843.         if ($contact_group_id !== null) {
  16844.             $resourcePath str_replace(
  16845.                 '{' 'ContactGroupID' '}',
  16846.                 AccountingObjectSerializer::toPathValue($contact_group_id),
  16847.                 $resourcePath
  16848.             );
  16849.         }
  16850.         // body params
  16851.         $_tempBody null;
  16852.         if ($multipart) {
  16853.             $headers $this->headerSelector->selectHeadersForMultipart(
  16854.                 []
  16855.             );
  16856.         } else {
  16857.             $headers $this->headerSelector->selectHeaders(
  16858.                 [],
  16859.                 []
  16860.             );
  16861.         }
  16862.         // for model (json/xml)
  16863.         if (isset($_tempBody)) {
  16864.             // $_tempBody is the method argument, if present
  16865.             if ($headers['Content-Type'] === 'application/json') {
  16866.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  16867.             } else {
  16868.                 $httpBody $_tempBody;
  16869.             }
  16870.         } elseif (count($formParams) > 0) {
  16871.             if ($multipart) {
  16872.                 $multipartContents = [
  16873.                     [
  16874.                         'Content-type' => 'multipart/form-data',
  16875.                     ]
  16876.                 ];
  16877.                 
  16878.                 // for HTTP post (form)
  16879.                 $httpBody = new MultipartStream($multipartContents);
  16880.             } elseif ($headers['Content-Type'] === 'application/json') {
  16881.                 $httpBody \GuzzleHttp\json_encode($formParams);
  16882.             } else {
  16883.                 // for HTTP post (form)
  16884.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  16885.             }
  16886.         }
  16887.         // this endpoint requires OAuth (access token)
  16888.         if ($this->config->getAccessToken() !== null) {
  16889.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  16890.         }
  16891.         $defaultHeaders = [];
  16892.         if ($this->config->getUserAgent()) {
  16893.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  16894.         }
  16895.         $headers array_merge(
  16896.             $defaultHeaders,
  16897.             $headerParams,
  16898.             $headers
  16899.         );
  16900.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  16901.         return new Request(
  16902.             'DELETE',
  16903.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  16904.             $headers,
  16905.             $httpBody
  16906.         );
  16907.     }
  16908.     /**
  16909.      * Operation deleteItem
  16910.      * Deletes a specific item
  16911.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  16912.      * @param  string $item_id Unique identifier for an Item (required)
  16913.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  16914.      * @throws \InvalidArgumentException
  16915.      * @return void
  16916.      */
  16917.     public function deleteItem($xero_tenant_id$item_id)
  16918.     {
  16919.         $this->deleteItemWithHttpInfo($xero_tenant_id$item_id);
  16920.     }
  16921.     /**
  16922.      * Operation deleteItemWithHttpInfo
  16923.      * Deletes a specific item
  16924.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  16925.      * @param  string $item_id Unique identifier for an Item (required)
  16926.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  16927.      * @throws \InvalidArgumentException
  16928.      * @return array of null, HTTP status code, HTTP response headers (array of strings)
  16929.      */
  16930.     public function deleteItemWithHttpInfo($xero_tenant_id$item_id)
  16931.     {
  16932.         $request $this->deleteItemRequest($xero_tenant_id$item_id);
  16933.         try {
  16934.             $options $this->createHttpClientOption();
  16935.             try {
  16936.                 $response $this->client->send($request$options);
  16937.             } catch (RequestException $e) {
  16938.                 throw new ApiException(
  16939.                     "[{$e->getCode()}{$e->getMessage()}",
  16940.                     $e->getCode(),
  16941.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  16942.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  16943.                 );
  16944.             }
  16945.             $statusCode $response->getStatusCode();
  16946.             if ($statusCode 200 || $statusCode 299) {
  16947.                 throw new ApiException(
  16948.                     sprintf(
  16949.                         '[%d] Error connecting to the API (%s)',
  16950.                         $statusCode,
  16951.                         $request->getUri()
  16952.                     ),
  16953.                     $statusCode,
  16954.                     $response->getHeaders(),
  16955.                     $response->getBody()
  16956.                 );
  16957.             }
  16958.             return [null$statusCode$response->getHeaders()];
  16959.         } catch (ApiException $e) {
  16960.             switch ($e->getCode()) {
  16961.                 case 400:
  16962.                     $data AccountingObjectSerializer::deserialize(
  16963.                         $e->getResponseBody(),
  16964.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  16965.                         $e->getResponseHeaders()
  16966.                     );
  16967.                     $e->setResponseObject($data);
  16968.                     break;
  16969.             }
  16970.             throw $e;
  16971.         }
  16972.     }
  16973.     /**
  16974.      * Operation deleteItemAsync
  16975.      * Deletes a specific item
  16976.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  16977.      * @param  string $item_id Unique identifier for an Item (required)
  16978.      * @throws \InvalidArgumentException
  16979.      * @return \GuzzleHttp\Promise\PromiseInterface
  16980.      */
  16981.     public function deleteItemAsync($xero_tenant_id$item_id)
  16982.     {
  16983.         return $this->deleteItemAsyncWithHttpInfo($xero_tenant_id$item_id)
  16984.             ->then(
  16985.                 function ($response) {
  16986.                     return $response[0];
  16987.                 }
  16988.             );
  16989.     }
  16990.     /**
  16991.      * Operation deleteItemAsyncWithHttpInfo
  16992.      * Deletes a specific item
  16993.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  16994.      * @param  string $item_id Unique identifier for an Item (required)
  16995.      * @throws \InvalidArgumentException
  16996.      * @return \GuzzleHttp\Promise\PromiseInterface */
  16997.     public function deleteItemAsyncWithHttpInfo($xero_tenant_id$item_id)
  16998.     {
  16999.         $returnType '';
  17000.         $request $this->deleteItemRequest($xero_tenant_id$item_id);
  17001.         return $this->client
  17002.             ->sendAsync($request$this->createHttpClientOption())
  17003.             ->then(
  17004.                 function ($response) use ($returnType) {
  17005.                     return [null$response->getStatusCode(), $response->getHeaders()];
  17006.                 },
  17007.                 function ($exception) {
  17008.                     $response $exception->getResponse();
  17009.                     $statusCode $response->getStatusCode();
  17010.                     throw new ApiException(
  17011.                         sprintf(
  17012.                             '[%d] Error connecting to the API (%s)',
  17013.                             $statusCode,
  17014.                             $exception->getRequest()->getUri()
  17015.                         ),
  17016.                         $statusCode,
  17017.                         $response->getHeaders(),
  17018.                         $response->getBody()
  17019.                     );
  17020.                 }
  17021.             );
  17022.     }
  17023.     /**
  17024.      * Create request for operation 'deleteItem'
  17025.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  17026.      * @param  string $item_id Unique identifier for an Item (required)
  17027.      * @throws \InvalidArgumentException
  17028.      * @return \GuzzleHttp\Psr7\Request  */
  17029.     protected function deleteItemRequest($xero_tenant_id$item_id)
  17030.     {
  17031.         // verify the required parameter 'xero_tenant_id' is set
  17032.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  17033.             throw new \InvalidArgumentException(
  17034.                 'Missing the required parameter $xero_tenant_id when calling deleteItem'
  17035.             );
  17036.         }
  17037.         // verify the required parameter 'item_id' is set
  17038.         if ($item_id === null || (is_array($item_id) && count($item_id) === 0)) {
  17039.             throw new \InvalidArgumentException(
  17040.                 'Missing the required parameter $item_id when calling deleteItem'
  17041.             );
  17042.         }
  17043.         $resourcePath '/Items/{ItemID}';
  17044.         $formParams = [];
  17045.         $queryParams = [];
  17046.         $headerParams = [];
  17047.         $httpBody '';
  17048.         $multipart false;
  17049.         // header params
  17050.         if ($xero_tenant_id !== null) {
  17051.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  17052.         }
  17053.         // path params
  17054.         if ($item_id !== null) {
  17055.             $resourcePath str_replace(
  17056.                 '{' 'ItemID' '}',
  17057.                 AccountingObjectSerializer::toPathValue($item_id),
  17058.                 $resourcePath
  17059.             );
  17060.         }
  17061.         // body params
  17062.         $_tempBody null;
  17063.         if ($multipart) {
  17064.             $headers $this->headerSelector->selectHeadersForMultipart(
  17065.                 ['application/json']
  17066.             );
  17067.         } else {
  17068.             $headers $this->headerSelector->selectHeaders(
  17069.                 ['application/json'],
  17070.                 []
  17071.             );
  17072.         }
  17073.         // for model (json/xml)
  17074.         if (isset($_tempBody)) {
  17075.             // $_tempBody is the method argument, if present
  17076.             if ($headers['Content-Type'] === 'application/json') {
  17077.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  17078.             } else {
  17079.                 $httpBody $_tempBody;
  17080.             }
  17081.         } elseif (count($formParams) > 0) {
  17082.             if ($multipart) {
  17083.                 $multipartContents = [
  17084.                     [
  17085.                         'Content-type' => 'multipart/form-data',
  17086.                     ]
  17087.                 ];
  17088.                 
  17089.                 // for HTTP post (form)
  17090.                 $httpBody = new MultipartStream($multipartContents);
  17091.             } elseif ($headers['Content-Type'] === 'application/json') {
  17092.                 $httpBody \GuzzleHttp\json_encode($formParams);
  17093.             } else {
  17094.                 // for HTTP post (form)
  17095.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  17096.             }
  17097.         }
  17098.         // this endpoint requires OAuth (access token)
  17099.         if ($this->config->getAccessToken() !== null) {
  17100.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  17101.         }
  17102.         $defaultHeaders = [];
  17103.         if ($this->config->getUserAgent()) {
  17104.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  17105.         }
  17106.         $headers array_merge(
  17107.             $defaultHeaders,
  17108.             $headerParams,
  17109.             $headers
  17110.         );
  17111.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  17112.         return new Request(
  17113.             'DELETE',
  17114.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  17115.             $headers,
  17116.             $httpBody
  17117.         );
  17118.     }
  17119.     /**
  17120.      * Operation deleteLinkedTransaction
  17121.      * Deletes a specific linked transactions (billable expenses)
  17122.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  17123.      * @param  string $linked_transaction_id Unique identifier for a LinkedTransaction (required)
  17124.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  17125.      * @throws \InvalidArgumentException
  17126.      * @return void
  17127.      */
  17128.     public function deleteLinkedTransaction($xero_tenant_id$linked_transaction_id)
  17129.     {
  17130.         $this->deleteLinkedTransactionWithHttpInfo($xero_tenant_id$linked_transaction_id);
  17131.     }
  17132.     /**
  17133.      * Operation deleteLinkedTransactionWithHttpInfo
  17134.      * Deletes a specific linked transactions (billable expenses)
  17135.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  17136.      * @param  string $linked_transaction_id Unique identifier for a LinkedTransaction (required)
  17137.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  17138.      * @throws \InvalidArgumentException
  17139.      * @return array of null, HTTP status code, HTTP response headers (array of strings)
  17140.      */
  17141.     public function deleteLinkedTransactionWithHttpInfo($xero_tenant_id$linked_transaction_id)
  17142.     {
  17143.         $request $this->deleteLinkedTransactionRequest($xero_tenant_id$linked_transaction_id);
  17144.         try {
  17145.             $options $this->createHttpClientOption();
  17146.             try {
  17147.                 $response $this->client->send($request$options);
  17148.             } catch (RequestException $e) {
  17149.                 throw new ApiException(
  17150.                     "[{$e->getCode()}{$e->getMessage()}",
  17151.                     $e->getCode(),
  17152.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  17153.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  17154.                 );
  17155.             }
  17156.             $statusCode $response->getStatusCode();
  17157.             if ($statusCode 200 || $statusCode 299) {
  17158.                 throw new ApiException(
  17159.                     sprintf(
  17160.                         '[%d] Error connecting to the API (%s)',
  17161.                         $statusCode,
  17162.                         $request->getUri()
  17163.                     ),
  17164.                     $statusCode,
  17165.                     $response->getHeaders(),
  17166.                     $response->getBody()
  17167.                 );
  17168.             }
  17169.             return [null$statusCode$response->getHeaders()];
  17170.         } catch (ApiException $e) {
  17171.             switch ($e->getCode()) {
  17172.                 case 400:
  17173.                     $data AccountingObjectSerializer::deserialize(
  17174.                         $e->getResponseBody(),
  17175.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  17176.                         $e->getResponseHeaders()
  17177.                     );
  17178.                     $e->setResponseObject($data);
  17179.                     break;
  17180.             }
  17181.             throw $e;
  17182.         }
  17183.     }
  17184.     /**
  17185.      * Operation deleteLinkedTransactionAsync
  17186.      * Deletes a specific linked transactions (billable expenses)
  17187.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  17188.      * @param  string $linked_transaction_id Unique identifier for a LinkedTransaction (required)
  17189.      * @throws \InvalidArgumentException
  17190.      * @return \GuzzleHttp\Promise\PromiseInterface
  17191.      */
  17192.     public function deleteLinkedTransactionAsync($xero_tenant_id$linked_transaction_id)
  17193.     {
  17194.         return $this->deleteLinkedTransactionAsyncWithHttpInfo($xero_tenant_id$linked_transaction_id)
  17195.             ->then(
  17196.                 function ($response) {
  17197.                     return $response[0];
  17198.                 }
  17199.             );
  17200.     }
  17201.     /**
  17202.      * Operation deleteLinkedTransactionAsyncWithHttpInfo
  17203.      * Deletes a specific linked transactions (billable expenses)
  17204.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  17205.      * @param  string $linked_transaction_id Unique identifier for a LinkedTransaction (required)
  17206.      * @throws \InvalidArgumentException
  17207.      * @return \GuzzleHttp\Promise\PromiseInterface */
  17208.     public function deleteLinkedTransactionAsyncWithHttpInfo($xero_tenant_id$linked_transaction_id)
  17209.     {
  17210.         $returnType '';
  17211.         $request $this->deleteLinkedTransactionRequest($xero_tenant_id$linked_transaction_id);
  17212.         return $this->client
  17213.             ->sendAsync($request$this->createHttpClientOption())
  17214.             ->then(
  17215.                 function ($response) use ($returnType) {
  17216.                     return [null$response->getStatusCode(), $response->getHeaders()];
  17217.                 },
  17218.                 function ($exception) {
  17219.                     $response $exception->getResponse();
  17220.                     $statusCode $response->getStatusCode();
  17221.                     throw new ApiException(
  17222.                         sprintf(
  17223.                             '[%d] Error connecting to the API (%s)',
  17224.                             $statusCode,
  17225.                             $exception->getRequest()->getUri()
  17226.                         ),
  17227.                         $statusCode,
  17228.                         $response->getHeaders(),
  17229.                         $response->getBody()
  17230.                     );
  17231.                 }
  17232.             );
  17233.     }
  17234.     /**
  17235.      * Create request for operation 'deleteLinkedTransaction'
  17236.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  17237.      * @param  string $linked_transaction_id Unique identifier for a LinkedTransaction (required)
  17238.      * @throws \InvalidArgumentException
  17239.      * @return \GuzzleHttp\Psr7\Request  */
  17240.     protected function deleteLinkedTransactionRequest($xero_tenant_id$linked_transaction_id)
  17241.     {
  17242.         // verify the required parameter 'xero_tenant_id' is set
  17243.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  17244.             throw new \InvalidArgumentException(
  17245.                 'Missing the required parameter $xero_tenant_id when calling deleteLinkedTransaction'
  17246.             );
  17247.         }
  17248.         // verify the required parameter 'linked_transaction_id' is set
  17249.         if ($linked_transaction_id === null || (is_array($linked_transaction_id) && count($linked_transaction_id) === 0)) {
  17250.             throw new \InvalidArgumentException(
  17251.                 'Missing the required parameter $linked_transaction_id when calling deleteLinkedTransaction'
  17252.             );
  17253.         }
  17254.         $resourcePath '/LinkedTransactions/{LinkedTransactionID}';
  17255.         $formParams = [];
  17256.         $queryParams = [];
  17257.         $headerParams = [];
  17258.         $httpBody '';
  17259.         $multipart false;
  17260.         // header params
  17261.         if ($xero_tenant_id !== null) {
  17262.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  17263.         }
  17264.         // path params
  17265.         if ($linked_transaction_id !== null) {
  17266.             $resourcePath str_replace(
  17267.                 '{' 'LinkedTransactionID' '}',
  17268.                 AccountingObjectSerializer::toPathValue($linked_transaction_id),
  17269.                 $resourcePath
  17270.             );
  17271.         }
  17272.         // body params
  17273.         $_tempBody null;
  17274.         if ($multipart) {
  17275.             $headers $this->headerSelector->selectHeadersForMultipart(
  17276.                 ['application/json']
  17277.             );
  17278.         } else {
  17279.             $headers $this->headerSelector->selectHeaders(
  17280.                 ['application/json'],
  17281.                 []
  17282.             );
  17283.         }
  17284.         // for model (json/xml)
  17285.         if (isset($_tempBody)) {
  17286.             // $_tempBody is the method argument, if present
  17287.             if ($headers['Content-Type'] === 'application/json') {
  17288.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  17289.             } else {
  17290.                 $httpBody $_tempBody;
  17291.             }
  17292.         } elseif (count($formParams) > 0) {
  17293.             if ($multipart) {
  17294.                 $multipartContents = [
  17295.                     [
  17296.                         'Content-type' => 'multipart/form-data',
  17297.                     ]
  17298.                 ];
  17299.                 
  17300.                 // for HTTP post (form)
  17301.                 $httpBody = new MultipartStream($multipartContents);
  17302.             } elseif ($headers['Content-Type'] === 'application/json') {
  17303.                 $httpBody \GuzzleHttp\json_encode($formParams);
  17304.             } else {
  17305.                 // for HTTP post (form)
  17306.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  17307.             }
  17308.         }
  17309.         // this endpoint requires OAuth (access token)
  17310.         if ($this->config->getAccessToken() !== null) {
  17311.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  17312.         }
  17313.         $defaultHeaders = [];
  17314.         if ($this->config->getUserAgent()) {
  17315.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  17316.         }
  17317.         $headers array_merge(
  17318.             $defaultHeaders,
  17319.             $headerParams,
  17320.             $headers
  17321.         );
  17322.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  17323.         return new Request(
  17324.             'DELETE',
  17325.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  17326.             $headers,
  17327.             $httpBody
  17328.         );
  17329.     }
  17330.     /**
  17331.      * Operation deletePayment
  17332.      * Updates a specific payment for invoices and credit notes
  17333.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  17334.      * @param  string $payment_id Unique identifier for a Payment (required)
  17335.      * @param  \XeroAPI\XeroPHP\Models\Accounting\PaymentDelete $payment_delete payment_delete (required)
  17336.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  17337.      * @throws \InvalidArgumentException
  17338.      * @return \XeroAPI\XeroPHP\Models\Accounting\Payments|\XeroAPI\XeroPHP\Models\Accounting\Error
  17339.      */
  17340.     public function deletePayment($xero_tenant_id$payment_id$payment_delete)
  17341.     {
  17342.         list($response) = $this->deletePaymentWithHttpInfo($xero_tenant_id$payment_id$payment_delete);
  17343.         return $response;
  17344.     }
  17345.     /**
  17346.      * Operation deletePaymentWithHttpInfo
  17347.      * Updates a specific payment for invoices and credit notes
  17348.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  17349.      * @param  string $payment_id Unique identifier for a Payment (required)
  17350.      * @param  \XeroAPI\XeroPHP\Models\Accounting\PaymentDelete $payment_delete (required)
  17351.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  17352.      * @throws \InvalidArgumentException
  17353.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Payments|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  17354.      */
  17355.     public function deletePaymentWithHttpInfo($xero_tenant_id$payment_id$payment_delete)
  17356.     {
  17357.         $request $this->deletePaymentRequest($xero_tenant_id$payment_id$payment_delete);
  17358.         try {
  17359.             $options $this->createHttpClientOption();
  17360.             try {
  17361.                 $response $this->client->send($request$options);
  17362.             } catch (RequestException $e) {
  17363.                 throw new ApiException(
  17364.                     "[{$e->getCode()}{$e->getMessage()}",
  17365.                     $e->getCode(),
  17366.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  17367.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  17368.                 );
  17369.             }
  17370.             $statusCode $response->getStatusCode();
  17371.             if ($statusCode 200 || $statusCode 299) {
  17372.                 throw new ApiException(
  17373.                     sprintf(
  17374.                         '[%d] Error connecting to the API (%s)',
  17375.                         $statusCode,
  17376.                         $request->getUri()
  17377.                     ),
  17378.                     $statusCode,
  17379.                     $response->getHeaders(),
  17380.                     $response->getBody()
  17381.                 );
  17382.             }
  17383.             $responseBody $response->getBody();
  17384.             switch($statusCode) {
  17385.                 case 200:
  17386.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Payments' === '\SplFileObject') {
  17387.                         $content $responseBody//stream goes to serializer
  17388.                     } else {
  17389.                         $content $responseBody->getContents();
  17390.                     }
  17391.                     return [
  17392.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Payments', []),
  17393.                         $response->getStatusCode(),
  17394.                         $response->getHeaders()
  17395.                     ];
  17396.                 case 400:
  17397.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  17398.                         $content $responseBody//stream goes to serializer
  17399.                     } else {
  17400.                         $content $responseBody->getContents();
  17401.                     }
  17402.                     return [
  17403.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  17404.                         $response->getStatusCode(),
  17405.                         $response->getHeaders()
  17406.                     ];
  17407.             }
  17408.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Payments';
  17409.             $responseBody $response->getBody();
  17410.             if ($returnType === '\SplFileObject') {
  17411.                 $content $responseBody//stream goes to serializer
  17412.             } else {
  17413.                 $content $responseBody->getContents();
  17414.             }
  17415.             return [
  17416.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  17417.                 $response->getStatusCode(),
  17418.                 $response->getHeaders()
  17419.             ];
  17420.         } catch (ApiException $e) {
  17421.             switch ($e->getCode()) {
  17422.                 case 200:
  17423.                     $data AccountingObjectSerializer::deserialize(
  17424.                         $e->getResponseBody(),
  17425.                         '\XeroAPI\XeroPHP\Models\Accounting\Payments',
  17426.                         $e->getResponseHeaders()
  17427.                     );
  17428.                     $e->setResponseObject($data);
  17429.                     break;
  17430.                 case 400:
  17431.                     $data AccountingObjectSerializer::deserialize(
  17432.                         $e->getResponseBody(),
  17433.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  17434.                         $e->getResponseHeaders()
  17435.                     );
  17436.                     $e->setResponseObject($data);
  17437.                     break;
  17438.             }
  17439.             throw $e;
  17440.         }
  17441.     }
  17442.     /**
  17443.      * Operation deletePaymentAsync
  17444.      * Updates a specific payment for invoices and credit notes
  17445.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  17446.      * @param  string $payment_id Unique identifier for a Payment (required)
  17447.      * @param  \XeroAPI\XeroPHP\Models\Accounting\PaymentDelete $payment_delete (required)
  17448.      * @throws \InvalidArgumentException
  17449.      * @return \GuzzleHttp\Promise\PromiseInterface
  17450.      */
  17451.     public function deletePaymentAsync($xero_tenant_id$payment_id$payment_delete)
  17452.     {
  17453.         return $this->deletePaymentAsyncWithHttpInfo($xero_tenant_id$payment_id$payment_delete)
  17454.             ->then(
  17455.                 function ($response) {
  17456.                     return $response[0];
  17457.                 }
  17458.             );
  17459.     }
  17460.     /**
  17461.      * Operation deletePaymentAsyncWithHttpInfo
  17462.      * Updates a specific payment for invoices and credit notes
  17463.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  17464.      * @param  string $payment_id Unique identifier for a Payment (required)
  17465.      * @param  \XeroAPI\XeroPHP\Models\Accounting\PaymentDelete $payment_delete (required)
  17466.      * @throws \InvalidArgumentException
  17467.      * @return \GuzzleHttp\Promise\PromiseInterface */
  17468.     public function deletePaymentAsyncWithHttpInfo($xero_tenant_id$payment_id$payment_delete)
  17469.     {
  17470.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Payments';
  17471.         $request $this->deletePaymentRequest($xero_tenant_id$payment_id$payment_delete);
  17472.         return $this->client
  17473.             ->sendAsync($request$this->createHttpClientOption())
  17474.             ->then(
  17475.                 function ($response) use ($returnType) {
  17476.                     $responseBody $response->getBody();
  17477.                     if ($returnType === '\SplFileObject') {
  17478.                         $content $responseBody//stream goes to serializer
  17479.                     } else {
  17480.                         $content $responseBody->getContents();
  17481.                     }
  17482.                     return [
  17483.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  17484.                         $response->getStatusCode(),
  17485.                         $response->getHeaders()
  17486.                     ];
  17487.                 },
  17488.                 function ($exception) {
  17489.                     $response $exception->getResponse();
  17490.                     $statusCode $response->getStatusCode();
  17491.                     throw new ApiException(
  17492.                         sprintf(
  17493.                             '[%d] Error connecting to the API (%s)',
  17494.                             $statusCode,
  17495.                             $exception->getRequest()->getUri()
  17496.                         ),
  17497.                         $statusCode,
  17498.                         $response->getHeaders(),
  17499.                         $response->getBody()
  17500.                     );
  17501.                 }
  17502.             );
  17503.     }
  17504.     /**
  17505.      * Create request for operation 'deletePayment'
  17506.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  17507.      * @param  string $payment_id Unique identifier for a Payment (required)
  17508.      * @param  \XeroAPI\XeroPHP\Models\Accounting\PaymentDelete $payment_delete (required)
  17509.      * @throws \InvalidArgumentException
  17510.      * @return \GuzzleHttp\Psr7\Request  */
  17511.     protected function deletePaymentRequest($xero_tenant_id$payment_id$payment_delete)
  17512.     {
  17513.         // verify the required parameter 'xero_tenant_id' is set
  17514.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  17515.             throw new \InvalidArgumentException(
  17516.                 'Missing the required parameter $xero_tenant_id when calling deletePayment'
  17517.             );
  17518.         }
  17519.         // verify the required parameter 'payment_id' is set
  17520.         if ($payment_id === null || (is_array($payment_id) && count($payment_id) === 0)) {
  17521.             throw new \InvalidArgumentException(
  17522.                 'Missing the required parameter $payment_id when calling deletePayment'
  17523.             );
  17524.         }
  17525.         // verify the required parameter 'payment_delete' is set
  17526.         if ($payment_delete === null || (is_array($payment_delete) && count($payment_delete) === 0)) {
  17527.             throw new \InvalidArgumentException(
  17528.                 'Missing the required parameter $payment_delete when calling deletePayment'
  17529.             );
  17530.         }
  17531.         $resourcePath '/Payments/{PaymentID}';
  17532.         $formParams = [];
  17533.         $queryParams = [];
  17534.         $headerParams = [];
  17535.         $httpBody '';
  17536.         $multipart false;
  17537.         // header params
  17538.         if ($xero_tenant_id !== null) {
  17539.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  17540.         }
  17541.         // path params
  17542.         if ($payment_id !== null) {
  17543.             $resourcePath str_replace(
  17544.                 '{' 'PaymentID' '}',
  17545.                 AccountingObjectSerializer::toPathValue($payment_id),
  17546.                 $resourcePath
  17547.             );
  17548.         }
  17549.         // body params
  17550.         $_tempBody null;
  17551.         if (isset($payment_delete)) {
  17552.             $_tempBody $payment_delete;
  17553.         }
  17554.         if ($multipart) {
  17555.             $headers $this->headerSelector->selectHeadersForMultipart(
  17556.                 ['application/json']
  17557.             );
  17558.         } else {
  17559.             $headers $this->headerSelector->selectHeaders(
  17560.                 ['application/json'],
  17561.                 ['application/json']
  17562.             );
  17563.         }
  17564.         // for model (json/xml)
  17565.         if (isset($_tempBody)) {
  17566.             // $_tempBody is the method argument, if present
  17567.             if ($headers['Content-Type'] === 'application/json') {
  17568.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  17569.             } else {
  17570.                 $httpBody $_tempBody;
  17571.             }
  17572.         } elseif (count($formParams) > 0) {
  17573.             if ($multipart) {
  17574.                 $multipartContents = [
  17575.                     [
  17576.                         'Content-type' => 'multipart/form-data',
  17577.                     ]
  17578.                 ];
  17579.                 
  17580.                 // for HTTP post (form)
  17581.                 $httpBody = new MultipartStream($multipartContents);
  17582.             } elseif ($headers['Content-Type'] === 'application/json') {
  17583.                 $httpBody \GuzzleHttp\json_encode($formParams);
  17584.             } else {
  17585.                 // for HTTP post (form)
  17586.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  17587.             }
  17588.         }
  17589.         // this endpoint requires OAuth (access token)
  17590.         if ($this->config->getAccessToken() !== null) {
  17591.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  17592.         }
  17593.         $defaultHeaders = [];
  17594.         if ($this->config->getUserAgent()) {
  17595.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  17596.         }
  17597.         $headers array_merge(
  17598.             $defaultHeaders,
  17599.             $headerParams,
  17600.             $headers
  17601.         );
  17602.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  17603.         return new Request(
  17604.             'POST',
  17605.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  17606.             $headers,
  17607.             $httpBody
  17608.         );
  17609.     }
  17610.     /**
  17611.      * Operation deleteTrackingCategory
  17612.      * Deletes a specific tracking category
  17613.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  17614.      * @param  string $tracking_category_id Unique identifier for a TrackingCategory (required)
  17615.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  17616.      * @throws \InvalidArgumentException
  17617.      * @return \XeroAPI\XeroPHP\Models\Accounting\TrackingCategories|\XeroAPI\XeroPHP\Models\Accounting\Error
  17618.      */
  17619.     public function deleteTrackingCategory($xero_tenant_id$tracking_category_id)
  17620.     {
  17621.         list($response) = $this->deleteTrackingCategoryWithHttpInfo($xero_tenant_id$tracking_category_id);
  17622.         return $response;
  17623.     }
  17624.     /**
  17625.      * Operation deleteTrackingCategoryWithHttpInfo
  17626.      * Deletes a specific tracking category
  17627.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  17628.      * @param  string $tracking_category_id Unique identifier for a TrackingCategory (required)
  17629.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  17630.      * @throws \InvalidArgumentException
  17631.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\TrackingCategories|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  17632.      */
  17633.     public function deleteTrackingCategoryWithHttpInfo($xero_tenant_id$tracking_category_id)
  17634.     {
  17635.         $request $this->deleteTrackingCategoryRequest($xero_tenant_id$tracking_category_id);
  17636.         try {
  17637.             $options $this->createHttpClientOption();
  17638.             try {
  17639.                 $response $this->client->send($request$options);
  17640.             } catch (RequestException $e) {
  17641.                 throw new ApiException(
  17642.                     "[{$e->getCode()}{$e->getMessage()}",
  17643.                     $e->getCode(),
  17644.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  17645.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  17646.                 );
  17647.             }
  17648.             $statusCode $response->getStatusCode();
  17649.             if ($statusCode 200 || $statusCode 299) {
  17650.                 throw new ApiException(
  17651.                     sprintf(
  17652.                         '[%d] Error connecting to the API (%s)',
  17653.                         $statusCode,
  17654.                         $request->getUri()
  17655.                     ),
  17656.                     $statusCode,
  17657.                     $response->getHeaders(),
  17658.                     $response->getBody()
  17659.                 );
  17660.             }
  17661.             $responseBody $response->getBody();
  17662.             switch($statusCode) {
  17663.                 case 200:
  17664.                     if ('\XeroAPI\XeroPHP\Models\Accounting\TrackingCategories' === '\SplFileObject') {
  17665.                         $content $responseBody//stream goes to serializer
  17666.                     } else {
  17667.                         $content $responseBody->getContents();
  17668.                     }
  17669.                     return [
  17670.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\TrackingCategories', []),
  17671.                         $response->getStatusCode(),
  17672.                         $response->getHeaders()
  17673.                     ];
  17674.                 case 400:
  17675.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  17676.                         $content $responseBody//stream goes to serializer
  17677.                     } else {
  17678.                         $content $responseBody->getContents();
  17679.                     }
  17680.                     return [
  17681.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  17682.                         $response->getStatusCode(),
  17683.                         $response->getHeaders()
  17684.                     ];
  17685.             }
  17686.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\TrackingCategories';
  17687.             $responseBody $response->getBody();
  17688.             if ($returnType === '\SplFileObject') {
  17689.                 $content $responseBody//stream goes to serializer
  17690.             } else {
  17691.                 $content $responseBody->getContents();
  17692.             }
  17693.             return [
  17694.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  17695.                 $response->getStatusCode(),
  17696.                 $response->getHeaders()
  17697.             ];
  17698.         } catch (ApiException $e) {
  17699.             switch ($e->getCode()) {
  17700.                 case 200:
  17701.                     $data AccountingObjectSerializer::deserialize(
  17702.                         $e->getResponseBody(),
  17703.                         '\XeroAPI\XeroPHP\Models\Accounting\TrackingCategories',
  17704.                         $e->getResponseHeaders()
  17705.                     );
  17706.                     $e->setResponseObject($data);
  17707.                     break;
  17708.                 case 400:
  17709.                     $data AccountingObjectSerializer::deserialize(
  17710.                         $e->getResponseBody(),
  17711.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  17712.                         $e->getResponseHeaders()
  17713.                     );
  17714.                     $e->setResponseObject($data);
  17715.                     break;
  17716.             }
  17717.             throw $e;
  17718.         }
  17719.     }
  17720.     /**
  17721.      * Operation deleteTrackingCategoryAsync
  17722.      * Deletes a specific tracking category
  17723.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  17724.      * @param  string $tracking_category_id Unique identifier for a TrackingCategory (required)
  17725.      * @throws \InvalidArgumentException
  17726.      * @return \GuzzleHttp\Promise\PromiseInterface
  17727.      */
  17728.     public function deleteTrackingCategoryAsync($xero_tenant_id$tracking_category_id)
  17729.     {
  17730.         return $this->deleteTrackingCategoryAsyncWithHttpInfo($xero_tenant_id$tracking_category_id)
  17731.             ->then(
  17732.                 function ($response) {
  17733.                     return $response[0];
  17734.                 }
  17735.             );
  17736.     }
  17737.     /**
  17738.      * Operation deleteTrackingCategoryAsyncWithHttpInfo
  17739.      * Deletes a specific tracking category
  17740.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  17741.      * @param  string $tracking_category_id Unique identifier for a TrackingCategory (required)
  17742.      * @throws \InvalidArgumentException
  17743.      * @return \GuzzleHttp\Promise\PromiseInterface */
  17744.     public function deleteTrackingCategoryAsyncWithHttpInfo($xero_tenant_id$tracking_category_id)
  17745.     {
  17746.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\TrackingCategories';
  17747.         $request $this->deleteTrackingCategoryRequest($xero_tenant_id$tracking_category_id);
  17748.         return $this->client
  17749.             ->sendAsync($request$this->createHttpClientOption())
  17750.             ->then(
  17751.                 function ($response) use ($returnType) {
  17752.                     $responseBody $response->getBody();
  17753.                     if ($returnType === '\SplFileObject') {
  17754.                         $content $responseBody//stream goes to serializer
  17755.                     } else {
  17756.                         $content $responseBody->getContents();
  17757.                     }
  17758.                     return [
  17759.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  17760.                         $response->getStatusCode(),
  17761.                         $response->getHeaders()
  17762.                     ];
  17763.                 },
  17764.                 function ($exception) {
  17765.                     $response $exception->getResponse();
  17766.                     $statusCode $response->getStatusCode();
  17767.                     throw new ApiException(
  17768.                         sprintf(
  17769.                             '[%d] Error connecting to the API (%s)',
  17770.                             $statusCode,
  17771.                             $exception->getRequest()->getUri()
  17772.                         ),
  17773.                         $statusCode,
  17774.                         $response->getHeaders(),
  17775.                         $response->getBody()
  17776.                     );
  17777.                 }
  17778.             );
  17779.     }
  17780.     /**
  17781.      * Create request for operation 'deleteTrackingCategory'
  17782.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  17783.      * @param  string $tracking_category_id Unique identifier for a TrackingCategory (required)
  17784.      * @throws \InvalidArgumentException
  17785.      * @return \GuzzleHttp\Psr7\Request  */
  17786.     protected function deleteTrackingCategoryRequest($xero_tenant_id$tracking_category_id)
  17787.     {
  17788.         // verify the required parameter 'xero_tenant_id' is set
  17789.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  17790.             throw new \InvalidArgumentException(
  17791.                 'Missing the required parameter $xero_tenant_id when calling deleteTrackingCategory'
  17792.             );
  17793.         }
  17794.         // verify the required parameter 'tracking_category_id' is set
  17795.         if ($tracking_category_id === null || (is_array($tracking_category_id) && count($tracking_category_id) === 0)) {
  17796.             throw new \InvalidArgumentException(
  17797.                 'Missing the required parameter $tracking_category_id when calling deleteTrackingCategory'
  17798.             );
  17799.         }
  17800.         $resourcePath '/TrackingCategories/{TrackingCategoryID}';
  17801.         $formParams = [];
  17802.         $queryParams = [];
  17803.         $headerParams = [];
  17804.         $httpBody '';
  17805.         $multipart false;
  17806.         // header params
  17807.         if ($xero_tenant_id !== null) {
  17808.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  17809.         }
  17810.         // path params
  17811.         if ($tracking_category_id !== null) {
  17812.             $resourcePath str_replace(
  17813.                 '{' 'TrackingCategoryID' '}',
  17814.                 AccountingObjectSerializer::toPathValue($tracking_category_id),
  17815.                 $resourcePath
  17816.             );
  17817.         }
  17818.         // body params
  17819.         $_tempBody null;
  17820.         if ($multipart) {
  17821.             $headers $this->headerSelector->selectHeadersForMultipart(
  17822.                 ['application/json']
  17823.             );
  17824.         } else {
  17825.             $headers $this->headerSelector->selectHeaders(
  17826.                 ['application/json'],
  17827.                 []
  17828.             );
  17829.         }
  17830.         // for model (json/xml)
  17831.         if (isset($_tempBody)) {
  17832.             // $_tempBody is the method argument, if present
  17833.             if ($headers['Content-Type'] === 'application/json') {
  17834.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  17835.             } else {
  17836.                 $httpBody $_tempBody;
  17837.             }
  17838.         } elseif (count($formParams) > 0) {
  17839.             if ($multipart) {
  17840.                 $multipartContents = [
  17841.                     [
  17842.                         'Content-type' => 'multipart/form-data',
  17843.                     ]
  17844.                 ];
  17845.                 
  17846.                 // for HTTP post (form)
  17847.                 $httpBody = new MultipartStream($multipartContents);
  17848.             } elseif ($headers['Content-Type'] === 'application/json') {
  17849.                 $httpBody \GuzzleHttp\json_encode($formParams);
  17850.             } else {
  17851.                 // for HTTP post (form)
  17852.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  17853.             }
  17854.         }
  17855.         // this endpoint requires OAuth (access token)
  17856.         if ($this->config->getAccessToken() !== null) {
  17857.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  17858.         }
  17859.         $defaultHeaders = [];
  17860.         if ($this->config->getUserAgent()) {
  17861.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  17862.         }
  17863.         $headers array_merge(
  17864.             $defaultHeaders,
  17865.             $headerParams,
  17866.             $headers
  17867.         );
  17868.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  17869.         return new Request(
  17870.             'DELETE',
  17871.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  17872.             $headers,
  17873.             $httpBody
  17874.         );
  17875.     }
  17876.     /**
  17877.      * Operation deleteTrackingOptions
  17878.      * Deletes a specific option for a specific tracking category
  17879.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  17880.      * @param  string $tracking_category_id Unique identifier for a TrackingCategory (required)
  17881.      * @param  string $tracking_option_id Unique identifier for a Tracking Option (required)
  17882.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  17883.      * @throws \InvalidArgumentException
  17884.      * @return \XeroAPI\XeroPHP\Models\Accounting\TrackingOptions|\XeroAPI\XeroPHP\Models\Accounting\Error
  17885.      */
  17886.     public function deleteTrackingOptions($xero_tenant_id$tracking_category_id$tracking_option_id)
  17887.     {
  17888.         list($response) = $this->deleteTrackingOptionsWithHttpInfo($xero_tenant_id$tracking_category_id$tracking_option_id);
  17889.         return $response;
  17890.     }
  17891.     /**
  17892.      * Operation deleteTrackingOptionsWithHttpInfo
  17893.      * Deletes a specific option for a specific tracking category
  17894.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  17895.      * @param  string $tracking_category_id Unique identifier for a TrackingCategory (required)
  17896.      * @param  string $tracking_option_id Unique identifier for a Tracking Option (required)
  17897.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  17898.      * @throws \InvalidArgumentException
  17899.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\TrackingOptions|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  17900.      */
  17901.     public function deleteTrackingOptionsWithHttpInfo($xero_tenant_id$tracking_category_id$tracking_option_id)
  17902.     {
  17903.         $request $this->deleteTrackingOptionsRequest($xero_tenant_id$tracking_category_id$tracking_option_id);
  17904.         try {
  17905.             $options $this->createHttpClientOption();
  17906.             try {
  17907.                 $response $this->client->send($request$options);
  17908.             } catch (RequestException $e) {
  17909.                 throw new ApiException(
  17910.                     "[{$e->getCode()}{$e->getMessage()}",
  17911.                     $e->getCode(),
  17912.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  17913.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  17914.                 );
  17915.             }
  17916.             $statusCode $response->getStatusCode();
  17917.             if ($statusCode 200 || $statusCode 299) {
  17918.                 throw new ApiException(
  17919.                     sprintf(
  17920.                         '[%d] Error connecting to the API (%s)',
  17921.                         $statusCode,
  17922.                         $request->getUri()
  17923.                     ),
  17924.                     $statusCode,
  17925.                     $response->getHeaders(),
  17926.                     $response->getBody()
  17927.                 );
  17928.             }
  17929.             $responseBody $response->getBody();
  17930.             switch($statusCode) {
  17931.                 case 200:
  17932.                     if ('\XeroAPI\XeroPHP\Models\Accounting\TrackingOptions' === '\SplFileObject') {
  17933.                         $content $responseBody//stream goes to serializer
  17934.                     } else {
  17935.                         $content $responseBody->getContents();
  17936.                     }
  17937.                     return [
  17938.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\TrackingOptions', []),
  17939.                         $response->getStatusCode(),
  17940.                         $response->getHeaders()
  17941.                     ];
  17942.                 case 400:
  17943.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  17944.                         $content $responseBody//stream goes to serializer
  17945.                     } else {
  17946.                         $content $responseBody->getContents();
  17947.                     }
  17948.                     return [
  17949.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  17950.                         $response->getStatusCode(),
  17951.                         $response->getHeaders()
  17952.                     ];
  17953.             }
  17954.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\TrackingOptions';
  17955.             $responseBody $response->getBody();
  17956.             if ($returnType === '\SplFileObject') {
  17957.                 $content $responseBody//stream goes to serializer
  17958.             } else {
  17959.                 $content $responseBody->getContents();
  17960.             }
  17961.             return [
  17962.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  17963.                 $response->getStatusCode(),
  17964.                 $response->getHeaders()
  17965.             ];
  17966.         } catch (ApiException $e) {
  17967.             switch ($e->getCode()) {
  17968.                 case 200:
  17969.                     $data AccountingObjectSerializer::deserialize(
  17970.                         $e->getResponseBody(),
  17971.                         '\XeroAPI\XeroPHP\Models\Accounting\TrackingOptions',
  17972.                         $e->getResponseHeaders()
  17973.                     );
  17974.                     $e->setResponseObject($data);
  17975.                     break;
  17976.                 case 400:
  17977.                     $data AccountingObjectSerializer::deserialize(
  17978.                         $e->getResponseBody(),
  17979.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  17980.                         $e->getResponseHeaders()
  17981.                     );
  17982.                     $e->setResponseObject($data);
  17983.                     break;
  17984.             }
  17985.             throw $e;
  17986.         }
  17987.     }
  17988.     /**
  17989.      * Operation deleteTrackingOptionsAsync
  17990.      * Deletes a specific option for a specific tracking category
  17991.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  17992.      * @param  string $tracking_category_id Unique identifier for a TrackingCategory (required)
  17993.      * @param  string $tracking_option_id Unique identifier for a Tracking Option (required)
  17994.      * @throws \InvalidArgumentException
  17995.      * @return \GuzzleHttp\Promise\PromiseInterface
  17996.      */
  17997.     public function deleteTrackingOptionsAsync($xero_tenant_id$tracking_category_id$tracking_option_id)
  17998.     {
  17999.         return $this->deleteTrackingOptionsAsyncWithHttpInfo($xero_tenant_id$tracking_category_id$tracking_option_id)
  18000.             ->then(
  18001.                 function ($response) {
  18002.                     return $response[0];
  18003.                 }
  18004.             );
  18005.     }
  18006.     /**
  18007.      * Operation deleteTrackingOptionsAsyncWithHttpInfo
  18008.      * Deletes a specific option for a specific tracking category
  18009.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  18010.      * @param  string $tracking_category_id Unique identifier for a TrackingCategory (required)
  18011.      * @param  string $tracking_option_id Unique identifier for a Tracking Option (required)
  18012.      * @throws \InvalidArgumentException
  18013.      * @return \GuzzleHttp\Promise\PromiseInterface */
  18014.     public function deleteTrackingOptionsAsyncWithHttpInfo($xero_tenant_id$tracking_category_id$tracking_option_id)
  18015.     {
  18016.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\TrackingOptions';
  18017.         $request $this->deleteTrackingOptionsRequest($xero_tenant_id$tracking_category_id$tracking_option_id);
  18018.         return $this->client
  18019.             ->sendAsync($request$this->createHttpClientOption())
  18020.             ->then(
  18021.                 function ($response) use ($returnType) {
  18022.                     $responseBody $response->getBody();
  18023.                     if ($returnType === '\SplFileObject') {
  18024.                         $content $responseBody//stream goes to serializer
  18025.                     } else {
  18026.                         $content $responseBody->getContents();
  18027.                     }
  18028.                     return [
  18029.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  18030.                         $response->getStatusCode(),
  18031.                         $response->getHeaders()
  18032.                     ];
  18033.                 },
  18034.                 function ($exception) {
  18035.                     $response $exception->getResponse();
  18036.                     $statusCode $response->getStatusCode();
  18037.                     throw new ApiException(
  18038.                         sprintf(
  18039.                             '[%d] Error connecting to the API (%s)',
  18040.                             $statusCode,
  18041.                             $exception->getRequest()->getUri()
  18042.                         ),
  18043.                         $statusCode,
  18044.                         $response->getHeaders(),
  18045.                         $response->getBody()
  18046.                     );
  18047.                 }
  18048.             );
  18049.     }
  18050.     /**
  18051.      * Create request for operation 'deleteTrackingOptions'
  18052.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  18053.      * @param  string $tracking_category_id Unique identifier for a TrackingCategory (required)
  18054.      * @param  string $tracking_option_id Unique identifier for a Tracking Option (required)
  18055.      * @throws \InvalidArgumentException
  18056.      * @return \GuzzleHttp\Psr7\Request  */
  18057.     protected function deleteTrackingOptionsRequest($xero_tenant_id$tracking_category_id$tracking_option_id)
  18058.     {
  18059.         // verify the required parameter 'xero_tenant_id' is set
  18060.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  18061.             throw new \InvalidArgumentException(
  18062.                 'Missing the required parameter $xero_tenant_id when calling deleteTrackingOptions'
  18063.             );
  18064.         }
  18065.         // verify the required parameter 'tracking_category_id' is set
  18066.         if ($tracking_category_id === null || (is_array($tracking_category_id) && count($tracking_category_id) === 0)) {
  18067.             throw new \InvalidArgumentException(
  18068.                 'Missing the required parameter $tracking_category_id when calling deleteTrackingOptions'
  18069.             );
  18070.         }
  18071.         // verify the required parameter 'tracking_option_id' is set
  18072.         if ($tracking_option_id === null || (is_array($tracking_option_id) && count($tracking_option_id) === 0)) {
  18073.             throw new \InvalidArgumentException(
  18074.                 'Missing the required parameter $tracking_option_id when calling deleteTrackingOptions'
  18075.             );
  18076.         }
  18077.         $resourcePath '/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}';
  18078.         $formParams = [];
  18079.         $queryParams = [];
  18080.         $headerParams = [];
  18081.         $httpBody '';
  18082.         $multipart false;
  18083.         // header params
  18084.         if ($xero_tenant_id !== null) {
  18085.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  18086.         }
  18087.         // path params
  18088.         if ($tracking_category_id !== null) {
  18089.             $resourcePath str_replace(
  18090.                 '{' 'TrackingCategoryID' '}',
  18091.                 AccountingObjectSerializer::toPathValue($tracking_category_id),
  18092.                 $resourcePath
  18093.             );
  18094.         }
  18095.         // path params
  18096.         if ($tracking_option_id !== null) {
  18097.             $resourcePath str_replace(
  18098.                 '{' 'TrackingOptionID' '}',
  18099.                 AccountingObjectSerializer::toPathValue($tracking_option_id),
  18100.                 $resourcePath
  18101.             );
  18102.         }
  18103.         // body params
  18104.         $_tempBody null;
  18105.         if ($multipart) {
  18106.             $headers $this->headerSelector->selectHeadersForMultipart(
  18107.                 ['application/json']
  18108.             );
  18109.         } else {
  18110.             $headers $this->headerSelector->selectHeaders(
  18111.                 ['application/json'],
  18112.                 []
  18113.             );
  18114.         }
  18115.         // for model (json/xml)
  18116.         if (isset($_tempBody)) {
  18117.             // $_tempBody is the method argument, if present
  18118.             if ($headers['Content-Type'] === 'application/json') {
  18119.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  18120.             } else {
  18121.                 $httpBody $_tempBody;
  18122.             }
  18123.         } elseif (count($formParams) > 0) {
  18124.             if ($multipart) {
  18125.                 $multipartContents = [
  18126.                     [
  18127.                         'Content-type' => 'multipart/form-data',
  18128.                     ]
  18129.                 ];
  18130.                 
  18131.                 // for HTTP post (form)
  18132.                 $httpBody = new MultipartStream($multipartContents);
  18133.             } elseif ($headers['Content-Type'] === 'application/json') {
  18134.                 $httpBody \GuzzleHttp\json_encode($formParams);
  18135.             } else {
  18136.                 // for HTTP post (form)
  18137.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  18138.             }
  18139.         }
  18140.         // this endpoint requires OAuth (access token)
  18141.         if ($this->config->getAccessToken() !== null) {
  18142.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  18143.         }
  18144.         $defaultHeaders = [];
  18145.         if ($this->config->getUserAgent()) {
  18146.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  18147.         }
  18148.         $headers array_merge(
  18149.             $defaultHeaders,
  18150.             $headerParams,
  18151.             $headers
  18152.         );
  18153.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  18154.         return new Request(
  18155.             'DELETE',
  18156.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  18157.             $headers,
  18158.             $httpBody
  18159.         );
  18160.     }
  18161.     /**
  18162.      * Operation emailInvoice
  18163.      * Sends a copy of a specific invoice to related contact via email
  18164.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  18165.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  18166.      * @param  \XeroAPI\XeroPHP\Models\Accounting\RequestEmpty $request_empty request_empty (required)
  18167.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  18168.      * @throws \InvalidArgumentException
  18169.      * @return void
  18170.      */
  18171.     public function emailInvoice($xero_tenant_id$invoice_id$request_empty)
  18172.     {
  18173.         $this->emailInvoiceWithHttpInfo($xero_tenant_id$invoice_id$request_empty);
  18174.     }
  18175.     /**
  18176.      * Operation emailInvoiceWithHttpInfo
  18177.      * Sends a copy of a specific invoice to related contact via email
  18178.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  18179.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  18180.      * @param  \XeroAPI\XeroPHP\Models\Accounting\RequestEmpty $request_empty (required)
  18181.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  18182.      * @throws \InvalidArgumentException
  18183.      * @return array of null, HTTP status code, HTTP response headers (array of strings)
  18184.      */
  18185.     public function emailInvoiceWithHttpInfo($xero_tenant_id$invoice_id$request_empty)
  18186.     {
  18187.         $request $this->emailInvoiceRequest($xero_tenant_id$invoice_id$request_empty);
  18188.         try {
  18189.             $options $this->createHttpClientOption();
  18190.             try {
  18191.                 $response $this->client->send($request$options);
  18192.             } catch (RequestException $e) {
  18193.                 throw new ApiException(
  18194.                     "[{$e->getCode()}{$e->getMessage()}",
  18195.                     $e->getCode(),
  18196.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  18197.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  18198.                 );
  18199.             }
  18200.             $statusCode $response->getStatusCode();
  18201.             if ($statusCode 200 || $statusCode 299) {
  18202.                 throw new ApiException(
  18203.                     sprintf(
  18204.                         '[%d] Error connecting to the API (%s)',
  18205.                         $statusCode,
  18206.                         $request->getUri()
  18207.                     ),
  18208.                     $statusCode,
  18209.                     $response->getHeaders(),
  18210.                     $response->getBody()
  18211.                 );
  18212.             }
  18213.             return [null$statusCode$response->getHeaders()];
  18214.         } catch (ApiException $e) {
  18215.             switch ($e->getCode()) {
  18216.                 case 400:
  18217.                     $data AccountingObjectSerializer::deserialize(
  18218.                         $e->getResponseBody(),
  18219.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  18220.                         $e->getResponseHeaders()
  18221.                     );
  18222.                     $e->setResponseObject($data);
  18223.                     break;
  18224.             }
  18225.             throw $e;
  18226.         }
  18227.     }
  18228.     /**
  18229.      * Operation emailInvoiceAsync
  18230.      * Sends a copy of a specific invoice to related contact via email
  18231.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  18232.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  18233.      * @param  \XeroAPI\XeroPHP\Models\Accounting\RequestEmpty $request_empty (required)
  18234.      * @throws \InvalidArgumentException
  18235.      * @return \GuzzleHttp\Promise\PromiseInterface
  18236.      */
  18237.     public function emailInvoiceAsync($xero_tenant_id$invoice_id$request_empty)
  18238.     {
  18239.         return $this->emailInvoiceAsyncWithHttpInfo($xero_tenant_id$invoice_id$request_empty)
  18240.             ->then(
  18241.                 function ($response) {
  18242.                     return $response[0];
  18243.                 }
  18244.             );
  18245.     }
  18246.     /**
  18247.      * Operation emailInvoiceAsyncWithHttpInfo
  18248.      * Sends a copy of a specific invoice to related contact via email
  18249.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  18250.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  18251.      * @param  \XeroAPI\XeroPHP\Models\Accounting\RequestEmpty $request_empty (required)
  18252.      * @throws \InvalidArgumentException
  18253.      * @return \GuzzleHttp\Promise\PromiseInterface */
  18254.     public function emailInvoiceAsyncWithHttpInfo($xero_tenant_id$invoice_id$request_empty)
  18255.     {
  18256.         $returnType '';
  18257.         $request $this->emailInvoiceRequest($xero_tenant_id$invoice_id$request_empty);
  18258.         return $this->client
  18259.             ->sendAsync($request$this->createHttpClientOption())
  18260.             ->then(
  18261.                 function ($response) use ($returnType) {
  18262.                     return [null$response->getStatusCode(), $response->getHeaders()];
  18263.                 },
  18264.                 function ($exception) {
  18265.                     $response $exception->getResponse();
  18266.                     $statusCode $response->getStatusCode();
  18267.                     throw new ApiException(
  18268.                         sprintf(
  18269.                             '[%d] Error connecting to the API (%s)',
  18270.                             $statusCode,
  18271.                             $exception->getRequest()->getUri()
  18272.                         ),
  18273.                         $statusCode,
  18274.                         $response->getHeaders(),
  18275.                         $response->getBody()
  18276.                     );
  18277.                 }
  18278.             );
  18279.     }
  18280.     /**
  18281.      * Create request for operation 'emailInvoice'
  18282.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  18283.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  18284.      * @param  \XeroAPI\XeroPHP\Models\Accounting\RequestEmpty $request_empty (required)
  18285.      * @throws \InvalidArgumentException
  18286.      * @return \GuzzleHttp\Psr7\Request  */
  18287.     protected function emailInvoiceRequest($xero_tenant_id$invoice_id$request_empty)
  18288.     {
  18289.         // verify the required parameter 'xero_tenant_id' is set
  18290.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  18291.             throw new \InvalidArgumentException(
  18292.                 'Missing the required parameter $xero_tenant_id when calling emailInvoice'
  18293.             );
  18294.         }
  18295.         // verify the required parameter 'invoice_id' is set
  18296.         if ($invoice_id === null || (is_array($invoice_id) && count($invoice_id) === 0)) {
  18297.             throw new \InvalidArgumentException(
  18298.                 'Missing the required parameter $invoice_id when calling emailInvoice'
  18299.             );
  18300.         }
  18301.         // verify the required parameter 'request_empty' is set
  18302.         if ($request_empty === null || (is_array($request_empty) && count($request_empty) === 0)) {
  18303.             throw new \InvalidArgumentException(
  18304.                 'Missing the required parameter $request_empty when calling emailInvoice'
  18305.             );
  18306.         }
  18307.         $resourcePath '/Invoices/{InvoiceID}/Email';
  18308.         $formParams = [];
  18309.         $queryParams = [];
  18310.         $headerParams = [];
  18311.         $httpBody '';
  18312.         $multipart false;
  18313.         // header params
  18314.         if ($xero_tenant_id !== null) {
  18315.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  18316.         }
  18317.         // path params
  18318.         if ($invoice_id !== null) {
  18319.             $resourcePath str_replace(
  18320.                 '{' 'InvoiceID' '}',
  18321.                 AccountingObjectSerializer::toPathValue($invoice_id),
  18322.                 $resourcePath
  18323.             );
  18324.         }
  18325.         // body params
  18326.         $_tempBody null;
  18327.         if (isset($request_empty)) {
  18328.             $_tempBody $request_empty;
  18329.         }
  18330.         if ($multipart) {
  18331.             $headers $this->headerSelector->selectHeadersForMultipart(
  18332.                 ['application/json']
  18333.             );
  18334.         } else {
  18335.             $headers $this->headerSelector->selectHeaders(
  18336.                 ['application/json'],
  18337.                 ['application/json']
  18338.             );
  18339.         }
  18340.         // for model (json/xml)
  18341.         if (isset($_tempBody)) {
  18342.             // $_tempBody is the method argument, if present
  18343.             if ($headers['Content-Type'] === 'application/json') {
  18344.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  18345.             } else {
  18346.                 $httpBody $_tempBody;
  18347.             }
  18348.         } elseif (count($formParams) > 0) {
  18349.             if ($multipart) {
  18350.                 $multipartContents = [
  18351.                     [
  18352.                         'Content-type' => 'multipart/form-data',
  18353.                     ]
  18354.                 ];
  18355.                 
  18356.                 // for HTTP post (form)
  18357.                 $httpBody = new MultipartStream($multipartContents);
  18358.             } elseif ($headers['Content-Type'] === 'application/json') {
  18359.                 $httpBody \GuzzleHttp\json_encode($formParams);
  18360.             } else {
  18361.                 // for HTTP post (form)
  18362.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  18363.             }
  18364.         }
  18365.         // this endpoint requires OAuth (access token)
  18366.         if ($this->config->getAccessToken() !== null) {
  18367.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  18368.         }
  18369.         $defaultHeaders = [];
  18370.         if ($this->config->getUserAgent()) {
  18371.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  18372.         }
  18373.         $headers array_merge(
  18374.             $defaultHeaders,
  18375.             $headerParams,
  18376.             $headers
  18377.         );
  18378.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  18379.         return new Request(
  18380.             'POST',
  18381.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  18382.             $headers,
  18383.             $httpBody
  18384.         );
  18385.     }
  18386.     /**
  18387.      * Operation getAccount
  18388.      * Retrieves a single chart of accounts by using a unique account Id
  18389.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  18390.      * @param  string $account_id Unique identifier for Account object (required)
  18391.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  18392.      * @throws \InvalidArgumentException
  18393.      * @return \XeroAPI\XeroPHP\Models\Accounting\Accounts
  18394.      */
  18395.     public function getAccount($xero_tenant_id$account_id)
  18396.     {
  18397.         list($response) = $this->getAccountWithHttpInfo($xero_tenant_id$account_id);
  18398.         return $response;
  18399.     }
  18400.     /**
  18401.      * Operation getAccountWithHttpInfo
  18402.      * Retrieves a single chart of accounts by using a unique account Id
  18403.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  18404.      * @param  string $account_id Unique identifier for Account object (required)
  18405.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  18406.      * @throws \InvalidArgumentException
  18407.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Accounts, HTTP status code, HTTP response headers (array of strings)
  18408.      */
  18409.     public function getAccountWithHttpInfo($xero_tenant_id$account_id)
  18410.     {
  18411.         $request $this->getAccountRequest($xero_tenant_id$account_id);
  18412.         try {
  18413.             $options $this->createHttpClientOption();
  18414.             try {
  18415.                 $response $this->client->send($request$options);
  18416.             } catch (RequestException $e) {
  18417.                 throw new ApiException(
  18418.                     "[{$e->getCode()}{$e->getMessage()}",
  18419.                     $e->getCode(),
  18420.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  18421.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  18422.                 );
  18423.             }
  18424.             $statusCode $response->getStatusCode();
  18425.             if ($statusCode 200 || $statusCode 299) {
  18426.                 throw new ApiException(
  18427.                     sprintf(
  18428.                         '[%d] Error connecting to the API (%s)',
  18429.                         $statusCode,
  18430.                         $request->getUri()
  18431.                     ),
  18432.                     $statusCode,
  18433.                     $response->getHeaders(),
  18434.                     $response->getBody()
  18435.                 );
  18436.             }
  18437.             $responseBody $response->getBody();
  18438.             switch($statusCode) {
  18439.                 case 200:
  18440.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Accounts' === '\SplFileObject') {
  18441.                         $content $responseBody//stream goes to serializer
  18442.                     } else {
  18443.                         $content $responseBody->getContents();
  18444.                     }
  18445.                     return [
  18446.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Accounts', []),
  18447.                         $response->getStatusCode(),
  18448.                         $response->getHeaders()
  18449.                     ];
  18450.             }
  18451.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Accounts';
  18452.             $responseBody $response->getBody();
  18453.             if ($returnType === '\SplFileObject') {
  18454.                 $content $responseBody//stream goes to serializer
  18455.             } else {
  18456.                 $content $responseBody->getContents();
  18457.             }
  18458.             return [
  18459.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  18460.                 $response->getStatusCode(),
  18461.                 $response->getHeaders()
  18462.             ];
  18463.         } catch (ApiException $e) {
  18464.             switch ($e->getCode()) {
  18465.                 case 200:
  18466.                     $data AccountingObjectSerializer::deserialize(
  18467.                         $e->getResponseBody(),
  18468.                         '\XeroAPI\XeroPHP\Models\Accounting\Accounts',
  18469.                         $e->getResponseHeaders()
  18470.                     );
  18471.                     $e->setResponseObject($data);
  18472.                     break;
  18473.             }
  18474.             throw $e;
  18475.         }
  18476.     }
  18477.     /**
  18478.      * Operation getAccountAsync
  18479.      * Retrieves a single chart of accounts by using a unique account Id
  18480.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  18481.      * @param  string $account_id Unique identifier for Account object (required)
  18482.      * @throws \InvalidArgumentException
  18483.      * @return \GuzzleHttp\Promise\PromiseInterface
  18484.      */
  18485.     public function getAccountAsync($xero_tenant_id$account_id)
  18486.     {
  18487.         return $this->getAccountAsyncWithHttpInfo($xero_tenant_id$account_id)
  18488.             ->then(
  18489.                 function ($response) {
  18490.                     return $response[0];
  18491.                 }
  18492.             );
  18493.     }
  18494.     /**
  18495.      * Operation getAccountAsyncWithHttpInfo
  18496.      * Retrieves a single chart of accounts by using a unique account Id
  18497.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  18498.      * @param  string $account_id Unique identifier for Account object (required)
  18499.      * @throws \InvalidArgumentException
  18500.      * @return \GuzzleHttp\Promise\PromiseInterface */
  18501.     public function getAccountAsyncWithHttpInfo($xero_tenant_id$account_id)
  18502.     {
  18503.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Accounts';
  18504.         $request $this->getAccountRequest($xero_tenant_id$account_id);
  18505.         return $this->client
  18506.             ->sendAsync($request$this->createHttpClientOption())
  18507.             ->then(
  18508.                 function ($response) use ($returnType) {
  18509.                     $responseBody $response->getBody();
  18510.                     if ($returnType === '\SplFileObject') {
  18511.                         $content $responseBody//stream goes to serializer
  18512.                     } else {
  18513.                         $content $responseBody->getContents();
  18514.                     }
  18515.                     return [
  18516.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  18517.                         $response->getStatusCode(),
  18518.                         $response->getHeaders()
  18519.                     ];
  18520.                 },
  18521.                 function ($exception) {
  18522.                     $response $exception->getResponse();
  18523.                     $statusCode $response->getStatusCode();
  18524.                     throw new ApiException(
  18525.                         sprintf(
  18526.                             '[%d] Error connecting to the API (%s)',
  18527.                             $statusCode,
  18528.                             $exception->getRequest()->getUri()
  18529.                         ),
  18530.                         $statusCode,
  18531.                         $response->getHeaders(),
  18532.                         $response->getBody()
  18533.                     );
  18534.                 }
  18535.             );
  18536.     }
  18537.     /**
  18538.      * Create request for operation 'getAccount'
  18539.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  18540.      * @param  string $account_id Unique identifier for Account object (required)
  18541.      * @throws \InvalidArgumentException
  18542.      * @return \GuzzleHttp\Psr7\Request  */
  18543.     protected function getAccountRequest($xero_tenant_id$account_id)
  18544.     {
  18545.         // verify the required parameter 'xero_tenant_id' is set
  18546.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  18547.             throw new \InvalidArgumentException(
  18548.                 'Missing the required parameter $xero_tenant_id when calling getAccount'
  18549.             );
  18550.         }
  18551.         // verify the required parameter 'account_id' is set
  18552.         if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
  18553.             throw new \InvalidArgumentException(
  18554.                 'Missing the required parameter $account_id when calling getAccount'
  18555.             );
  18556.         }
  18557.         $resourcePath '/Accounts/{AccountID}';
  18558.         $formParams = [];
  18559.         $queryParams = [];
  18560.         $headerParams = [];
  18561.         $httpBody '';
  18562.         $multipart false;
  18563.         // header params
  18564.         if ($xero_tenant_id !== null) {
  18565.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  18566.         }
  18567.         // path params
  18568.         if ($account_id !== null) {
  18569.             $resourcePath str_replace(
  18570.                 '{' 'AccountID' '}',
  18571.                 AccountingObjectSerializer::toPathValue($account_id),
  18572.                 $resourcePath
  18573.             );
  18574.         }
  18575.         // body params
  18576.         $_tempBody null;
  18577.         if ($multipart) {
  18578.             $headers $this->headerSelector->selectHeadersForMultipart(
  18579.                 ['application/json']
  18580.             );
  18581.         } else {
  18582.             $headers $this->headerSelector->selectHeaders(
  18583.                 ['application/json'],
  18584.                 []
  18585.             );
  18586.         }
  18587.         // for model (json/xml)
  18588.         if (isset($_tempBody)) {
  18589.             // $_tempBody is the method argument, if present
  18590.             if ($headers['Content-Type'] === 'application/json') {
  18591.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  18592.             } else {
  18593.                 $httpBody $_tempBody;
  18594.             }
  18595.         } elseif (count($formParams) > 0) {
  18596.             if ($multipart) {
  18597.                 $multipartContents = [
  18598.                     [
  18599.                         'Content-type' => 'multipart/form-data',
  18600.                     ]
  18601.                 ];
  18602.                 
  18603.                 // for HTTP post (form)
  18604.                 $httpBody = new MultipartStream($multipartContents);
  18605.             } elseif ($headers['Content-Type'] === 'application/json') {
  18606.                 $httpBody \GuzzleHttp\json_encode($formParams);
  18607.             } else {
  18608.                 // for HTTP post (form)
  18609.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  18610.             }
  18611.         }
  18612.         // this endpoint requires OAuth (access token)
  18613.         if ($this->config->getAccessToken() !== null) {
  18614.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  18615.         }
  18616.         $defaultHeaders = [];
  18617.         if ($this->config->getUserAgent()) {
  18618.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  18619.         }
  18620.         $headers array_merge(
  18621.             $defaultHeaders,
  18622.             $headerParams,
  18623.             $headers
  18624.         );
  18625.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  18626.         return new Request(
  18627.             'GET',
  18628.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  18629.             $headers,
  18630.             $httpBody
  18631.         );
  18632.     }
  18633.     /**
  18634.      * Operation getAccountAttachmentByFileName
  18635.      * Retrieves an attachment for a specific account by filename
  18636.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  18637.      * @param  string $account_id Unique identifier for Account object (required)
  18638.      * @param  string $file_name Name of the attachment (required)
  18639.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  18640.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  18641.      * @throws \InvalidArgumentException
  18642.      * @return \SplFileObject
  18643.      */
  18644.     public function getAccountAttachmentByFileName($xero_tenant_id$account_id$file_name$content_type)
  18645.     {
  18646.         list($response) = $this->getAccountAttachmentByFileNameWithHttpInfo($xero_tenant_id$account_id$file_name$content_type);
  18647.         return $response;
  18648.     }
  18649.     /**
  18650.      * Operation getAccountAttachmentByFileNameWithHttpInfo
  18651.      * Retrieves an attachment for a specific account by filename
  18652.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  18653.      * @param  string $account_id Unique identifier for Account object (required)
  18654.      * @param  string $file_name Name of the attachment (required)
  18655.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  18656.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  18657.      * @throws \InvalidArgumentException
  18658.      * @return array of \SplFileObject, HTTP status code, HTTP response headers (array of strings)
  18659.      */
  18660.     public function getAccountAttachmentByFileNameWithHttpInfo($xero_tenant_id$account_id$file_name$content_type)
  18661.     {
  18662.         $request $this->getAccountAttachmentByFileNameRequest($xero_tenant_id$account_id$file_name$content_type);
  18663.         try {
  18664.             $options $this->createHttpClientOption();
  18665.             try {
  18666.                 $response $this->client->send($request$options);
  18667.             } catch (RequestException $e) {
  18668.                 throw new ApiException(
  18669.                     "[{$e->getCode()}{$e->getMessage()}",
  18670.                     $e->getCode(),
  18671.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  18672.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  18673.                 );
  18674.             }
  18675.             $statusCode $response->getStatusCode();
  18676.             if ($statusCode 200 || $statusCode 299) {
  18677.                 throw new ApiException(
  18678.                     sprintf(
  18679.                         '[%d] Error connecting to the API (%s)',
  18680.                         $statusCode,
  18681.                         $request->getUri()
  18682.                     ),
  18683.                     $statusCode,
  18684.                     $response->getHeaders(),
  18685.                     $response->getBody()
  18686.                 );
  18687.             }
  18688.             $responseBody $response->getBody();
  18689.             switch($statusCode) {
  18690.                 case 200:
  18691.                     if ('\SplFileObject' === '\SplFileObject') {
  18692.                         $content $responseBody//stream goes to serializer
  18693.                     } else {
  18694.                         $content $responseBody->getContents();
  18695.                     }
  18696.                     return [
  18697.                         AccountingObjectSerializer::deserialize($content'\SplFileObject', []),
  18698.                         $response->getStatusCode(),
  18699.                         $response->getHeaders()
  18700.                     ];
  18701.             }
  18702.             $returnType '\SplFileObject';
  18703.             $responseBody $response->getBody();
  18704.             if ($returnType === '\SplFileObject') {
  18705.                 $content $responseBody//stream goes to serializer
  18706.             } else {
  18707.                 $content $responseBody->getContents();
  18708.             }
  18709.             return [
  18710.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  18711.                 $response->getStatusCode(),
  18712.                 $response->getHeaders()
  18713.             ];
  18714.         } catch (ApiException $e) {
  18715.             switch ($e->getCode()) {
  18716.                 case 200:
  18717.                     $data AccountingObjectSerializer::deserialize(
  18718.                         $e->getResponseBody(),
  18719.                         '\SplFileObject',
  18720.                         $e->getResponseHeaders()
  18721.                     );
  18722.                     $e->setResponseObject($data);
  18723.                     break;
  18724.             }
  18725.             throw $e;
  18726.         }
  18727.     }
  18728.     /**
  18729.      * Operation getAccountAttachmentByFileNameAsync
  18730.      * Retrieves an attachment for a specific account by filename
  18731.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  18732.      * @param  string $account_id Unique identifier for Account object (required)
  18733.      * @param  string $file_name Name of the attachment (required)
  18734.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  18735.      * @throws \InvalidArgumentException
  18736.      * @return \GuzzleHttp\Promise\PromiseInterface
  18737.      */
  18738.     public function getAccountAttachmentByFileNameAsync($xero_tenant_id$account_id$file_name$content_type)
  18739.     {
  18740.         return $this->getAccountAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$account_id$file_name$content_type)
  18741.             ->then(
  18742.                 function ($response) {
  18743.                     return $response[0];
  18744.                 }
  18745.             );
  18746.     }
  18747.     /**
  18748.      * Operation getAccountAttachmentByFileNameAsyncWithHttpInfo
  18749.      * Retrieves an attachment for a specific account by filename
  18750.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  18751.      * @param  string $account_id Unique identifier for Account object (required)
  18752.      * @param  string $file_name Name of the attachment (required)
  18753.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  18754.      * @throws \InvalidArgumentException
  18755.      * @return \GuzzleHttp\Promise\PromiseInterface */
  18756.     public function getAccountAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$account_id$file_name$content_type)
  18757.     {
  18758.         $returnType '\SplFileObject';
  18759.         $request $this->getAccountAttachmentByFileNameRequest($xero_tenant_id$account_id$file_name$content_type);
  18760.         return $this->client
  18761.             ->sendAsync($request$this->createHttpClientOption())
  18762.             ->then(
  18763.                 function ($response) use ($returnType) {
  18764.                     $responseBody $response->getBody();
  18765.                     if ($returnType === '\SplFileObject') {
  18766.                         $content $responseBody//stream goes to serializer
  18767.                     } else {
  18768.                         $content $responseBody->getContents();
  18769.                     }
  18770.                     return [
  18771.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  18772.                         $response->getStatusCode(),
  18773.                         $response->getHeaders()
  18774.                     ];
  18775.                 },
  18776.                 function ($exception) {
  18777.                     $response $exception->getResponse();
  18778.                     $statusCode $response->getStatusCode();
  18779.                     throw new ApiException(
  18780.                         sprintf(
  18781.                             '[%d] Error connecting to the API (%s)',
  18782.                             $statusCode,
  18783.                             $exception->getRequest()->getUri()
  18784.                         ),
  18785.                         $statusCode,
  18786.                         $response->getHeaders(),
  18787.                         $response->getBody()
  18788.                     );
  18789.                 }
  18790.             );
  18791.     }
  18792.     /**
  18793.      * Create request for operation 'getAccountAttachmentByFileName'
  18794.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  18795.      * @param  string $account_id Unique identifier for Account object (required)
  18796.      * @param  string $file_name Name of the attachment (required)
  18797.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  18798.      * @throws \InvalidArgumentException
  18799.      * @return \GuzzleHttp\Psr7\Request  */
  18800.     protected function getAccountAttachmentByFileNameRequest($xero_tenant_id$account_id$file_name$content_type)
  18801.     {
  18802.         // verify the required parameter 'xero_tenant_id' is set
  18803.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  18804.             throw new \InvalidArgumentException(
  18805.                 'Missing the required parameter $xero_tenant_id when calling getAccountAttachmentByFileName'
  18806.             );
  18807.         }
  18808.         // verify the required parameter 'account_id' is set
  18809.         if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
  18810.             throw new \InvalidArgumentException(
  18811.                 'Missing the required parameter $account_id when calling getAccountAttachmentByFileName'
  18812.             );
  18813.         }
  18814.         // verify the required parameter 'file_name' is set
  18815.         if ($file_name === null || (is_array($file_name) && count($file_name) === 0)) {
  18816.             throw new \InvalidArgumentException(
  18817.                 'Missing the required parameter $file_name when calling getAccountAttachmentByFileName'
  18818.             );
  18819.         }
  18820.         // verify the required parameter 'content_type' is set
  18821.         if ($content_type === null || (is_array($content_type) && count($content_type) === 0)) {
  18822.             throw new \InvalidArgumentException(
  18823.                 'Missing the required parameter $content_type when calling getAccountAttachmentByFileName'
  18824.             );
  18825.         }
  18826.         $resourcePath '/Accounts/{AccountID}/Attachments/{FileName}';
  18827.         $formParams = [];
  18828.         $queryParams = [];
  18829.         $headerParams = [];
  18830.         $httpBody '';
  18831.         $multipart false;
  18832.         // header params
  18833.         if ($xero_tenant_id !== null) {
  18834.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  18835.         }
  18836.         // header params
  18837.         if ($content_type !== null) {
  18838.             $headerParams['contentType'] = AccountingObjectSerializer::toHeaderValue($content_type);
  18839.         }
  18840.         // path params
  18841.         if ($account_id !== null) {
  18842.             $resourcePath str_replace(
  18843.                 '{' 'AccountID' '}',
  18844.                 AccountingObjectSerializer::toPathValue($account_id),
  18845.                 $resourcePath
  18846.             );
  18847.         }
  18848.         // path params
  18849.         if ($file_name !== null) {
  18850.             $resourcePath str_replace(
  18851.                 '{' 'FileName' '}',
  18852.                 AccountingObjectSerializer::toPathValue($file_name),
  18853.                 $resourcePath
  18854.             );
  18855.         }
  18856.         // body params
  18857.         $_tempBody null;
  18858.         if ($multipart) {
  18859.             $headers $this->headerSelector->selectHeadersForMultipart(
  18860.                 ['application/octet-stream']
  18861.             );
  18862.         } else {
  18863.             $headers $this->headerSelector->selectHeaders(
  18864.                 ['application/octet-stream'],
  18865.                 []
  18866.             );
  18867.         }
  18868.         // for model (json/xml)
  18869.         if (isset($_tempBody)) {
  18870.             // $_tempBody is the method argument, if present
  18871.             if ($headers['Content-Type'] === 'application/json') {
  18872.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  18873.             } else {
  18874.                 $httpBody $_tempBody;
  18875.             }
  18876.         } elseif (count($formParams) > 0) {
  18877.             if ($multipart) {
  18878.                 $multipartContents = [
  18879.                     [
  18880.                         'Content-type' => 'multipart/form-data',
  18881.                     ]
  18882.                 ];
  18883.                 
  18884.                 // for HTTP post (form)
  18885.                 $httpBody = new MultipartStream($multipartContents);
  18886.             } elseif ($headers['Content-Type'] === 'application/json') {
  18887.                 $httpBody \GuzzleHttp\json_encode($formParams);
  18888.             } else {
  18889.                 // for HTTP post (form)
  18890.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  18891.             }
  18892.         }
  18893.         // this endpoint requires OAuth (access token)
  18894.         if ($this->config->getAccessToken() !== null) {
  18895.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  18896.         }
  18897.         $defaultHeaders = [];
  18898.         if ($this->config->getUserAgent()) {
  18899.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  18900.         }
  18901.         $headers array_merge(
  18902.             $defaultHeaders,
  18903.             $headerParams,
  18904.             $headers
  18905.         );
  18906.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  18907.         return new Request(
  18908.             'GET',
  18909.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  18910.             $headers,
  18911.             $httpBody
  18912.         );
  18913.     }
  18914.     /**
  18915.      * Operation getAccountAttachmentById
  18916.      * Retrieves a specific attachment from a specific account using a unique attachment Id
  18917.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  18918.      * @param  string $account_id Unique identifier for Account object (required)
  18919.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  18920.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  18921.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  18922.      * @throws \InvalidArgumentException
  18923.      * @return \SplFileObject
  18924.      */
  18925.     public function getAccountAttachmentById($xero_tenant_id$account_id$attachment_id$content_type)
  18926.     {
  18927.         list($response) = $this->getAccountAttachmentByIdWithHttpInfo($xero_tenant_id$account_id$attachment_id$content_type);
  18928.         return $response;
  18929.     }
  18930.     /**
  18931.      * Operation getAccountAttachmentByIdWithHttpInfo
  18932.      * Retrieves a specific attachment from a specific account using a unique attachment Id
  18933.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  18934.      * @param  string $account_id Unique identifier for Account object (required)
  18935.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  18936.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  18937.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  18938.      * @throws \InvalidArgumentException
  18939.      * @return array of \SplFileObject, HTTP status code, HTTP response headers (array of strings)
  18940.      */
  18941.     public function getAccountAttachmentByIdWithHttpInfo($xero_tenant_id$account_id$attachment_id$content_type)
  18942.     {
  18943.         $request $this->getAccountAttachmentByIdRequest($xero_tenant_id$account_id$attachment_id$content_type);
  18944.         try {
  18945.             $options $this->createHttpClientOption();
  18946.             try {
  18947.                 $response $this->client->send($request$options);
  18948.             } catch (RequestException $e) {
  18949.                 throw new ApiException(
  18950.                     "[{$e->getCode()}{$e->getMessage()}",
  18951.                     $e->getCode(),
  18952.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  18953.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  18954.                 );
  18955.             }
  18956.             $statusCode $response->getStatusCode();
  18957.             if ($statusCode 200 || $statusCode 299) {
  18958.                 throw new ApiException(
  18959.                     sprintf(
  18960.                         '[%d] Error connecting to the API (%s)',
  18961.                         $statusCode,
  18962.                         $request->getUri()
  18963.                     ),
  18964.                     $statusCode,
  18965.                     $response->getHeaders(),
  18966.                     $response->getBody()
  18967.                 );
  18968.             }
  18969.             $responseBody $response->getBody();
  18970.             switch($statusCode) {
  18971.                 case 200:
  18972.                     if ('\SplFileObject' === '\SplFileObject') {
  18973.                         $content $responseBody//stream goes to serializer
  18974.                     } else {
  18975.                         $content $responseBody->getContents();
  18976.                     }
  18977.                     return [
  18978.                         AccountingObjectSerializer::deserialize($content'\SplFileObject', []),
  18979.                         $response->getStatusCode(),
  18980.                         $response->getHeaders()
  18981.                     ];
  18982.             }
  18983.             $returnType '\SplFileObject';
  18984.             $responseBody $response->getBody();
  18985.             if ($returnType === '\SplFileObject') {
  18986.                 $content $responseBody//stream goes to serializer
  18987.             } else {
  18988.                 $content $responseBody->getContents();
  18989.             }
  18990.             return [
  18991.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  18992.                 $response->getStatusCode(),
  18993.                 $response->getHeaders()
  18994.             ];
  18995.         } catch (ApiException $e) {
  18996.             switch ($e->getCode()) {
  18997.                 case 200:
  18998.                     $data AccountingObjectSerializer::deserialize(
  18999.                         $e->getResponseBody(),
  19000.                         '\SplFileObject',
  19001.                         $e->getResponseHeaders()
  19002.                     );
  19003.                     $e->setResponseObject($data);
  19004.                     break;
  19005.             }
  19006.             throw $e;
  19007.         }
  19008.     }
  19009.     /**
  19010.      * Operation getAccountAttachmentByIdAsync
  19011.      * Retrieves a specific attachment from a specific account using a unique attachment Id
  19012.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  19013.      * @param  string $account_id Unique identifier for Account object (required)
  19014.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  19015.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  19016.      * @throws \InvalidArgumentException
  19017.      * @return \GuzzleHttp\Promise\PromiseInterface
  19018.      */
  19019.     public function getAccountAttachmentByIdAsync($xero_tenant_id$account_id$attachment_id$content_type)
  19020.     {
  19021.         return $this->getAccountAttachmentByIdAsyncWithHttpInfo($xero_tenant_id$account_id$attachment_id$content_type)
  19022.             ->then(
  19023.                 function ($response) {
  19024.                     return $response[0];
  19025.                 }
  19026.             );
  19027.     }
  19028.     /**
  19029.      * Operation getAccountAttachmentByIdAsyncWithHttpInfo
  19030.      * Retrieves a specific attachment from a specific account using a unique attachment Id
  19031.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  19032.      * @param  string $account_id Unique identifier for Account object (required)
  19033.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  19034.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  19035.      * @throws \InvalidArgumentException
  19036.      * @return \GuzzleHttp\Promise\PromiseInterface */
  19037.     public function getAccountAttachmentByIdAsyncWithHttpInfo($xero_tenant_id$account_id$attachment_id$content_type)
  19038.     {
  19039.         $returnType '\SplFileObject';
  19040.         $request $this->getAccountAttachmentByIdRequest($xero_tenant_id$account_id$attachment_id$content_type);
  19041.         return $this->client
  19042.             ->sendAsync($request$this->createHttpClientOption())
  19043.             ->then(
  19044.                 function ($response) use ($returnType) {
  19045.                     $responseBody $response->getBody();
  19046.                     if ($returnType === '\SplFileObject') {
  19047.                         $content $responseBody//stream goes to serializer
  19048.                     } else {
  19049.                         $content $responseBody->getContents();
  19050.                     }
  19051.                     return [
  19052.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  19053.                         $response->getStatusCode(),
  19054.                         $response->getHeaders()
  19055.                     ];
  19056.                 },
  19057.                 function ($exception) {
  19058.                     $response $exception->getResponse();
  19059.                     $statusCode $response->getStatusCode();
  19060.                     throw new ApiException(
  19061.                         sprintf(
  19062.                             '[%d] Error connecting to the API (%s)',
  19063.                             $statusCode,
  19064.                             $exception->getRequest()->getUri()
  19065.                         ),
  19066.                         $statusCode,
  19067.                         $response->getHeaders(),
  19068.                         $response->getBody()
  19069.                     );
  19070.                 }
  19071.             );
  19072.     }
  19073.     /**
  19074.      * Create request for operation 'getAccountAttachmentById'
  19075.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  19076.      * @param  string $account_id Unique identifier for Account object (required)
  19077.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  19078.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  19079.      * @throws \InvalidArgumentException
  19080.      * @return \GuzzleHttp\Psr7\Request  */
  19081.     protected function getAccountAttachmentByIdRequest($xero_tenant_id$account_id$attachment_id$content_type)
  19082.     {
  19083.         // verify the required parameter 'xero_tenant_id' is set
  19084.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  19085.             throw new \InvalidArgumentException(
  19086.                 'Missing the required parameter $xero_tenant_id when calling getAccountAttachmentById'
  19087.             );
  19088.         }
  19089.         // verify the required parameter 'account_id' is set
  19090.         if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
  19091.             throw new \InvalidArgumentException(
  19092.                 'Missing the required parameter $account_id when calling getAccountAttachmentById'
  19093.             );
  19094.         }
  19095.         // verify the required parameter 'attachment_id' is set
  19096.         if ($attachment_id === null || (is_array($attachment_id) && count($attachment_id) === 0)) {
  19097.             throw new \InvalidArgumentException(
  19098.                 'Missing the required parameter $attachment_id when calling getAccountAttachmentById'
  19099.             );
  19100.         }
  19101.         // verify the required parameter 'content_type' is set
  19102.         if ($content_type === null || (is_array($content_type) && count($content_type) === 0)) {
  19103.             throw new \InvalidArgumentException(
  19104.                 'Missing the required parameter $content_type when calling getAccountAttachmentById'
  19105.             );
  19106.         }
  19107.         $resourcePath '/Accounts/{AccountID}/Attachments/{AttachmentID}';
  19108.         $formParams = [];
  19109.         $queryParams = [];
  19110.         $headerParams = [];
  19111.         $httpBody '';
  19112.         $multipart false;
  19113.         // header params
  19114.         if ($xero_tenant_id !== null) {
  19115.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  19116.         }
  19117.         // header params
  19118.         if ($content_type !== null) {
  19119.             $headerParams['contentType'] = AccountingObjectSerializer::toHeaderValue($content_type);
  19120.         }
  19121.         // path params
  19122.         if ($account_id !== null) {
  19123.             $resourcePath str_replace(
  19124.                 '{' 'AccountID' '}',
  19125.                 AccountingObjectSerializer::toPathValue($account_id),
  19126.                 $resourcePath
  19127.             );
  19128.         }
  19129.         // path params
  19130.         if ($attachment_id !== null) {
  19131.             $resourcePath str_replace(
  19132.                 '{' 'AttachmentID' '}',
  19133.                 AccountingObjectSerializer::toPathValue($attachment_id),
  19134.                 $resourcePath
  19135.             );
  19136.         }
  19137.         // body params
  19138.         $_tempBody null;
  19139.         if ($multipart) {
  19140.             $headers $this->headerSelector->selectHeadersForMultipart(
  19141.                 ['application/octet-stream']
  19142.             );
  19143.         } else {
  19144.             $headers $this->headerSelector->selectHeaders(
  19145.                 ['application/octet-stream'],
  19146.                 []
  19147.             );
  19148.         }
  19149.         // for model (json/xml)
  19150.         if (isset($_tempBody)) {
  19151.             // $_tempBody is the method argument, if present
  19152.             if ($headers['Content-Type'] === 'application/json') {
  19153.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  19154.             } else {
  19155.                 $httpBody $_tempBody;
  19156.             }
  19157.         } elseif (count($formParams) > 0) {
  19158.             if ($multipart) {
  19159.                 $multipartContents = [
  19160.                     [
  19161.                         'Content-type' => 'multipart/form-data',
  19162.                     ]
  19163.                 ];
  19164.                 
  19165.                 // for HTTP post (form)
  19166.                 $httpBody = new MultipartStream($multipartContents);
  19167.             } elseif ($headers['Content-Type'] === 'application/json') {
  19168.                 $httpBody \GuzzleHttp\json_encode($formParams);
  19169.             } else {
  19170.                 // for HTTP post (form)
  19171.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  19172.             }
  19173.         }
  19174.         // this endpoint requires OAuth (access token)
  19175.         if ($this->config->getAccessToken() !== null) {
  19176.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  19177.         }
  19178.         $defaultHeaders = [];
  19179.         if ($this->config->getUserAgent()) {
  19180.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  19181.         }
  19182.         $headers array_merge(
  19183.             $defaultHeaders,
  19184.             $headerParams,
  19185.             $headers
  19186.         );
  19187.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  19188.         return new Request(
  19189.             'GET',
  19190.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  19191.             $headers,
  19192.             $httpBody
  19193.         );
  19194.     }
  19195.     /**
  19196.      * Operation getAccountAttachments
  19197.      * Retrieves attachments for a specific accounts by using a unique account Id
  19198.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  19199.      * @param  string $account_id Unique identifier for Account object (required)
  19200.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  19201.      * @throws \InvalidArgumentException
  19202.      * @return \XeroAPI\XeroPHP\Models\Accounting\Attachments
  19203.      */
  19204.     public function getAccountAttachments($xero_tenant_id$account_id)
  19205.     {
  19206.         list($response) = $this->getAccountAttachmentsWithHttpInfo($xero_tenant_id$account_id);
  19207.         return $response;
  19208.     }
  19209.     /**
  19210.      * Operation getAccountAttachmentsWithHttpInfo
  19211.      * Retrieves attachments for a specific accounts by using a unique account Id
  19212.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  19213.      * @param  string $account_id Unique identifier for Account object (required)
  19214.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  19215.      * @throws \InvalidArgumentException
  19216.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Attachments, HTTP status code, HTTP response headers (array of strings)
  19217.      */
  19218.     public function getAccountAttachmentsWithHttpInfo($xero_tenant_id$account_id)
  19219.     {
  19220.         $request $this->getAccountAttachmentsRequest($xero_tenant_id$account_id);
  19221.         try {
  19222.             $options $this->createHttpClientOption();
  19223.             try {
  19224.                 $response $this->client->send($request$options);
  19225.             } catch (RequestException $e) {
  19226.                 throw new ApiException(
  19227.                     "[{$e->getCode()}{$e->getMessage()}",
  19228.                     $e->getCode(),
  19229.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  19230.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  19231.                 );
  19232.             }
  19233.             $statusCode $response->getStatusCode();
  19234.             if ($statusCode 200 || $statusCode 299) {
  19235.                 throw new ApiException(
  19236.                     sprintf(
  19237.                         '[%d] Error connecting to the API (%s)',
  19238.                         $statusCode,
  19239.                         $request->getUri()
  19240.                     ),
  19241.                     $statusCode,
  19242.                     $response->getHeaders(),
  19243.                     $response->getBody()
  19244.                 );
  19245.             }
  19246.             $responseBody $response->getBody();
  19247.             switch($statusCode) {
  19248.                 case 200:
  19249.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Attachments' === '\SplFileObject') {
  19250.                         $content $responseBody//stream goes to serializer
  19251.                     } else {
  19252.                         $content $responseBody->getContents();
  19253.                     }
  19254.                     return [
  19255.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Attachments', []),
  19256.                         $response->getStatusCode(),
  19257.                         $response->getHeaders()
  19258.                     ];
  19259.             }
  19260.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  19261.             $responseBody $response->getBody();
  19262.             if ($returnType === '\SplFileObject') {
  19263.                 $content $responseBody//stream goes to serializer
  19264.             } else {
  19265.                 $content $responseBody->getContents();
  19266.             }
  19267.             return [
  19268.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  19269.                 $response->getStatusCode(),
  19270.                 $response->getHeaders()
  19271.             ];
  19272.         } catch (ApiException $e) {
  19273.             switch ($e->getCode()) {
  19274.                 case 200:
  19275.                     $data AccountingObjectSerializer::deserialize(
  19276.                         $e->getResponseBody(),
  19277.                         '\XeroAPI\XeroPHP\Models\Accounting\Attachments',
  19278.                         $e->getResponseHeaders()
  19279.                     );
  19280.                     $e->setResponseObject($data);
  19281.                     break;
  19282.             }
  19283.             throw $e;
  19284.         }
  19285.     }
  19286.     /**
  19287.      * Operation getAccountAttachmentsAsync
  19288.      * Retrieves attachments for a specific accounts by using a unique account Id
  19289.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  19290.      * @param  string $account_id Unique identifier for Account object (required)
  19291.      * @throws \InvalidArgumentException
  19292.      * @return \GuzzleHttp\Promise\PromiseInterface
  19293.      */
  19294.     public function getAccountAttachmentsAsync($xero_tenant_id$account_id)
  19295.     {
  19296.         return $this->getAccountAttachmentsAsyncWithHttpInfo($xero_tenant_id$account_id)
  19297.             ->then(
  19298.                 function ($response) {
  19299.                     return $response[0];
  19300.                 }
  19301.             );
  19302.     }
  19303.     /**
  19304.      * Operation getAccountAttachmentsAsyncWithHttpInfo
  19305.      * Retrieves attachments for a specific accounts by using a unique account Id
  19306.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  19307.      * @param  string $account_id Unique identifier for Account object (required)
  19308.      * @throws \InvalidArgumentException
  19309.      * @return \GuzzleHttp\Promise\PromiseInterface */
  19310.     public function getAccountAttachmentsAsyncWithHttpInfo($xero_tenant_id$account_id)
  19311.     {
  19312.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  19313.         $request $this->getAccountAttachmentsRequest($xero_tenant_id$account_id);
  19314.         return $this->client
  19315.             ->sendAsync($request$this->createHttpClientOption())
  19316.             ->then(
  19317.                 function ($response) use ($returnType) {
  19318.                     $responseBody $response->getBody();
  19319.                     if ($returnType === '\SplFileObject') {
  19320.                         $content $responseBody//stream goes to serializer
  19321.                     } else {
  19322.                         $content $responseBody->getContents();
  19323.                     }
  19324.                     return [
  19325.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  19326.                         $response->getStatusCode(),
  19327.                         $response->getHeaders()
  19328.                     ];
  19329.                 },
  19330.                 function ($exception) {
  19331.                     $response $exception->getResponse();
  19332.                     $statusCode $response->getStatusCode();
  19333.                     throw new ApiException(
  19334.                         sprintf(
  19335.                             '[%d] Error connecting to the API (%s)',
  19336.                             $statusCode,
  19337.                             $exception->getRequest()->getUri()
  19338.                         ),
  19339.                         $statusCode,
  19340.                         $response->getHeaders(),
  19341.                         $response->getBody()
  19342.                     );
  19343.                 }
  19344.             );
  19345.     }
  19346.     /**
  19347.      * Create request for operation 'getAccountAttachments'
  19348.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  19349.      * @param  string $account_id Unique identifier for Account object (required)
  19350.      * @throws \InvalidArgumentException
  19351.      * @return \GuzzleHttp\Psr7\Request  */
  19352.     protected function getAccountAttachmentsRequest($xero_tenant_id$account_id)
  19353.     {
  19354.         // verify the required parameter 'xero_tenant_id' is set
  19355.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  19356.             throw new \InvalidArgumentException(
  19357.                 'Missing the required parameter $xero_tenant_id when calling getAccountAttachments'
  19358.             );
  19359.         }
  19360.         // verify the required parameter 'account_id' is set
  19361.         if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
  19362.             throw new \InvalidArgumentException(
  19363.                 'Missing the required parameter $account_id when calling getAccountAttachments'
  19364.             );
  19365.         }
  19366.         $resourcePath '/Accounts/{AccountID}/Attachments';
  19367.         $formParams = [];
  19368.         $queryParams = [];
  19369.         $headerParams = [];
  19370.         $httpBody '';
  19371.         $multipart false;
  19372.         // header params
  19373.         if ($xero_tenant_id !== null) {
  19374.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  19375.         }
  19376.         // path params
  19377.         if ($account_id !== null) {
  19378.             $resourcePath str_replace(
  19379.                 '{' 'AccountID' '}',
  19380.                 AccountingObjectSerializer::toPathValue($account_id),
  19381.                 $resourcePath
  19382.             );
  19383.         }
  19384.         // body params
  19385.         $_tempBody null;
  19386.         if ($multipart) {
  19387.             $headers $this->headerSelector->selectHeadersForMultipart(
  19388.                 ['application/json']
  19389.             );
  19390.         } else {
  19391.             $headers $this->headerSelector->selectHeaders(
  19392.                 ['application/json'],
  19393.                 []
  19394.             );
  19395.         }
  19396.         // for model (json/xml)
  19397.         if (isset($_tempBody)) {
  19398.             // $_tempBody is the method argument, if present
  19399.             if ($headers['Content-Type'] === 'application/json') {
  19400.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  19401.             } else {
  19402.                 $httpBody $_tempBody;
  19403.             }
  19404.         } elseif (count($formParams) > 0) {
  19405.             if ($multipart) {
  19406.                 $multipartContents = [
  19407.                     [
  19408.                         'Content-type' => 'multipart/form-data',
  19409.                     ]
  19410.                 ];
  19411.                 
  19412.                 // for HTTP post (form)
  19413.                 $httpBody = new MultipartStream($multipartContents);
  19414.             } elseif ($headers['Content-Type'] === 'application/json') {
  19415.                 $httpBody \GuzzleHttp\json_encode($formParams);
  19416.             } else {
  19417.                 // for HTTP post (form)
  19418.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  19419.             }
  19420.         }
  19421.         // this endpoint requires OAuth (access token)
  19422.         if ($this->config->getAccessToken() !== null) {
  19423.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  19424.         }
  19425.         $defaultHeaders = [];
  19426.         if ($this->config->getUserAgent()) {
  19427.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  19428.         }
  19429.         $headers array_merge(
  19430.             $defaultHeaders,
  19431.             $headerParams,
  19432.             $headers
  19433.         );
  19434.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  19435.         return new Request(
  19436.             'GET',
  19437.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  19438.             $headers,
  19439.             $httpBody
  19440.         );
  19441.     }
  19442.     /**
  19443.      * Operation getAccounts
  19444.      * Retrieves the full chart of accounts
  19445.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  19446.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  19447.      * @param  string $where Filter by an any element (optional)
  19448.      * @param  string $order Order by an any element (optional)
  19449.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  19450.      * @throws \InvalidArgumentException
  19451.      * @return \XeroAPI\XeroPHP\Models\Accounting\Accounts
  19452.      */
  19453.     public function getAccounts($xero_tenant_id$if_modified_since null$where null$order null)
  19454.     {
  19455.         list($response) = $this->getAccountsWithHttpInfo($xero_tenant_id$if_modified_since$where$order);
  19456.         return $response;
  19457.     }
  19458.     /**
  19459.      * Operation getAccountsWithHttpInfo
  19460.      * Retrieves the full chart of accounts
  19461.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  19462.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  19463.      * @param  string $where Filter by an any element (optional)
  19464.      * @param  string $order Order by an any element (optional)
  19465.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  19466.      * @throws \InvalidArgumentException
  19467.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Accounts, HTTP status code, HTTP response headers (array of strings)
  19468.      */
  19469.     public function getAccountsWithHttpInfo($xero_tenant_id$if_modified_since null$where null$order null)
  19470.     {
  19471.         $request $this->getAccountsRequest($xero_tenant_id$if_modified_since$where$order);
  19472.         try {
  19473.             $options $this->createHttpClientOption();
  19474.             try {
  19475.                 $response $this->client->send($request$options);
  19476.             } catch (RequestException $e) {
  19477.                 throw new ApiException(
  19478.                     "[{$e->getCode()}{$e->getMessage()}",
  19479.                     $e->getCode(),
  19480.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  19481.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  19482.                 );
  19483.             }
  19484.             $statusCode $response->getStatusCode();
  19485.             if ($statusCode 200 || $statusCode 299) {
  19486.                 throw new ApiException(
  19487.                     sprintf(
  19488.                         '[%d] Error connecting to the API (%s)',
  19489.                         $statusCode,
  19490.                         $request->getUri()
  19491.                     ),
  19492.                     $statusCode,
  19493.                     $response->getHeaders(),
  19494.                     $response->getBody()
  19495.                 );
  19496.             }
  19497.             $responseBody $response->getBody();
  19498.             switch($statusCode) {
  19499.                 case 200:
  19500.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Accounts' === '\SplFileObject') {
  19501.                         $content $responseBody//stream goes to serializer
  19502.                     } else {
  19503.                         $content $responseBody->getContents();
  19504.                     }
  19505.                     return [
  19506.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Accounts', []),
  19507.                         $response->getStatusCode(),
  19508.                         $response->getHeaders()
  19509.                     ];
  19510.             }
  19511.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Accounts';
  19512.             $responseBody $response->getBody();
  19513.             if ($returnType === '\SplFileObject') {
  19514.                 $content $responseBody//stream goes to serializer
  19515.             } else {
  19516.                 $content $responseBody->getContents();
  19517.             }
  19518.             return [
  19519.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  19520.                 $response->getStatusCode(),
  19521.                 $response->getHeaders()
  19522.             ];
  19523.         } catch (ApiException $e) {
  19524.             switch ($e->getCode()) {
  19525.                 case 200:
  19526.                     $data AccountingObjectSerializer::deserialize(
  19527.                         $e->getResponseBody(),
  19528.                         '\XeroAPI\XeroPHP\Models\Accounting\Accounts',
  19529.                         $e->getResponseHeaders()
  19530.                     );
  19531.                     $e->setResponseObject($data);
  19532.                     break;
  19533.             }
  19534.             throw $e;
  19535.         }
  19536.     }
  19537.     /**
  19538.      * Operation getAccountsAsync
  19539.      * Retrieves the full chart of accounts
  19540.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  19541.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  19542.      * @param  string $where Filter by an any element (optional)
  19543.      * @param  string $order Order by an any element (optional)
  19544.      * @throws \InvalidArgumentException
  19545.      * @return \GuzzleHttp\Promise\PromiseInterface
  19546.      */
  19547.     public function getAccountsAsync($xero_tenant_id$if_modified_since null$where null$order null)
  19548.     {
  19549.         return $this->getAccountsAsyncWithHttpInfo($xero_tenant_id$if_modified_since$where$order)
  19550.             ->then(
  19551.                 function ($response) {
  19552.                     return $response[0];
  19553.                 }
  19554.             );
  19555.     }
  19556.     /**
  19557.      * Operation getAccountsAsyncWithHttpInfo
  19558.      * Retrieves the full chart of accounts
  19559.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  19560.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  19561.      * @param  string $where Filter by an any element (optional)
  19562.      * @param  string $order Order by an any element (optional)
  19563.      * @throws \InvalidArgumentException
  19564.      * @return \GuzzleHttp\Promise\PromiseInterface */
  19565.     public function getAccountsAsyncWithHttpInfo($xero_tenant_id$if_modified_since null$where null$order null)
  19566.     {
  19567.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Accounts';
  19568.         $request $this->getAccountsRequest($xero_tenant_id$if_modified_since$where$order);
  19569.         return $this->client
  19570.             ->sendAsync($request$this->createHttpClientOption())
  19571.             ->then(
  19572.                 function ($response) use ($returnType) {
  19573.                     $responseBody $response->getBody();
  19574.                     if ($returnType === '\SplFileObject') {
  19575.                         $content $responseBody//stream goes to serializer
  19576.                     } else {
  19577.                         $content $responseBody->getContents();
  19578.                     }
  19579.                     return [
  19580.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  19581.                         $response->getStatusCode(),
  19582.                         $response->getHeaders()
  19583.                     ];
  19584.                 },
  19585.                 function ($exception) {
  19586.                     $response $exception->getResponse();
  19587.                     $statusCode $response->getStatusCode();
  19588.                     throw new ApiException(
  19589.                         sprintf(
  19590.                             '[%d] Error connecting to the API (%s)',
  19591.                             $statusCode,
  19592.                             $exception->getRequest()->getUri()
  19593.                         ),
  19594.                         $statusCode,
  19595.                         $response->getHeaders(),
  19596.                         $response->getBody()
  19597.                     );
  19598.                 }
  19599.             );
  19600.     }
  19601.     /**
  19602.      * Create request for operation 'getAccounts'
  19603.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  19604.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  19605.      * @param  string $where Filter by an any element (optional)
  19606.      * @param  string $order Order by an any element (optional)
  19607.      * @throws \InvalidArgumentException
  19608.      * @return \GuzzleHttp\Psr7\Request  */
  19609.     protected function getAccountsRequest($xero_tenant_id$if_modified_since null$where null$order null)
  19610.     {
  19611.         // verify the required parameter 'xero_tenant_id' is set
  19612.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  19613.             throw new \InvalidArgumentException(
  19614.                 'Missing the required parameter $xero_tenant_id when calling getAccounts'
  19615.             );
  19616.         }
  19617.         $resourcePath '/Accounts';
  19618.         $formParams = [];
  19619.         $queryParams = [];
  19620.         $headerParams = [];
  19621.         $httpBody '';
  19622.         $multipart false;
  19623.         // query params
  19624.         if ($where !== null) {
  19625.             $queryParams['where'] = AccountingObjectSerializer::toQueryValue($where);
  19626.         }
  19627.         // query params
  19628.         if ($order !== null) {
  19629.             $queryParams['order'] = AccountingObjectSerializer::toQueryValue($order);
  19630.         }
  19631.         // header params
  19632.         if ($xero_tenant_id !== null) {
  19633.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  19634.         }
  19635.         // header params
  19636.         if ($if_modified_since !== null) {
  19637.             $headerParams['If-Modified-Since'] = AccountingObjectSerializer::toHeaderValue($if_modified_since);
  19638.         }
  19639.         // body params
  19640.         $_tempBody null;
  19641.         if ($multipart) {
  19642.             $headers $this->headerSelector->selectHeadersForMultipart(
  19643.                 ['application/json']
  19644.             );
  19645.         } else {
  19646.             $headers $this->headerSelector->selectHeaders(
  19647.                 ['application/json'],
  19648.                 []
  19649.             );
  19650.         }
  19651.         // for model (json/xml)
  19652.         if (isset($_tempBody)) {
  19653.             // $_tempBody is the method argument, if present
  19654.             if ($headers['Content-Type'] === 'application/json') {
  19655.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  19656.             } else {
  19657.                 $httpBody $_tempBody;
  19658.             }
  19659.         } elseif (count($formParams) > 0) {
  19660.             if ($multipart) {
  19661.                 $multipartContents = [
  19662.                     [
  19663.                         'Content-type' => 'multipart/form-data',
  19664.                     ]
  19665.                 ];
  19666.                 
  19667.                 // for HTTP post (form)
  19668.                 $httpBody = new MultipartStream($multipartContents);
  19669.             } elseif ($headers['Content-Type'] === 'application/json') {
  19670.                 $httpBody \GuzzleHttp\json_encode($formParams);
  19671.             } else {
  19672.                 // for HTTP post (form)
  19673.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  19674.             }
  19675.         }
  19676.         // this endpoint requires OAuth (access token)
  19677.         if ($this->config->getAccessToken() !== null) {
  19678.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  19679.         }
  19680.         $defaultHeaders = [];
  19681.         if ($this->config->getUserAgent()) {
  19682.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  19683.         }
  19684.         $headers array_merge(
  19685.             $defaultHeaders,
  19686.             $headerParams,
  19687.             $headers
  19688.         );
  19689.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  19690.         return new Request(
  19691.             'GET',
  19692.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  19693.             $headers,
  19694.             $httpBody
  19695.         );
  19696.     }
  19697.     /**
  19698.      * Operation getBankTransaction
  19699.      * Retrieves a single spent or received money transaction by using a unique bank transaction Id
  19700.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  19701.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  19702.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  19703.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  19704.      * @throws \InvalidArgumentException
  19705.      * @return \XeroAPI\XeroPHP\Models\Accounting\BankTransactions
  19706.      */
  19707.     public function getBankTransaction($xero_tenant_id$bank_transaction_id$unitdp null)
  19708.     {
  19709.         list($response) = $this->getBankTransactionWithHttpInfo($xero_tenant_id$bank_transaction_id$unitdp);
  19710.         return $response;
  19711.     }
  19712.     /**
  19713.      * Operation getBankTransactionWithHttpInfo
  19714.      * Retrieves a single spent or received money transaction by using a unique bank transaction Id
  19715.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  19716.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  19717.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  19718.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  19719.      * @throws \InvalidArgumentException
  19720.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\BankTransactions, HTTP status code, HTTP response headers (array of strings)
  19721.      */
  19722.     public function getBankTransactionWithHttpInfo($xero_tenant_id$bank_transaction_id$unitdp null)
  19723.     {
  19724.         $request $this->getBankTransactionRequest($xero_tenant_id$bank_transaction_id$unitdp);
  19725.         try {
  19726.             $options $this->createHttpClientOption();
  19727.             try {
  19728.                 $response $this->client->send($request$options);
  19729.             } catch (RequestException $e) {
  19730.                 throw new ApiException(
  19731.                     "[{$e->getCode()}{$e->getMessage()}",
  19732.                     $e->getCode(),
  19733.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  19734.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  19735.                 );
  19736.             }
  19737.             $statusCode $response->getStatusCode();
  19738.             if ($statusCode 200 || $statusCode 299) {
  19739.                 throw new ApiException(
  19740.                     sprintf(
  19741.                         '[%d] Error connecting to the API (%s)',
  19742.                         $statusCode,
  19743.                         $request->getUri()
  19744.                     ),
  19745.                     $statusCode,
  19746.                     $response->getHeaders(),
  19747.                     $response->getBody()
  19748.                 );
  19749.             }
  19750.             $responseBody $response->getBody();
  19751.             switch($statusCode) {
  19752.                 case 200:
  19753.                     if ('\XeroAPI\XeroPHP\Models\Accounting\BankTransactions' === '\SplFileObject') {
  19754.                         $content $responseBody//stream goes to serializer
  19755.                     } else {
  19756.                         $content $responseBody->getContents();
  19757.                     }
  19758.                     return [
  19759.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\BankTransactions', []),
  19760.                         $response->getStatusCode(),
  19761.                         $response->getHeaders()
  19762.                     ];
  19763.             }
  19764.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\BankTransactions';
  19765.             $responseBody $response->getBody();
  19766.             if ($returnType === '\SplFileObject') {
  19767.                 $content $responseBody//stream goes to serializer
  19768.             } else {
  19769.                 $content $responseBody->getContents();
  19770.             }
  19771.             return [
  19772.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  19773.                 $response->getStatusCode(),
  19774.                 $response->getHeaders()
  19775.             ];
  19776.         } catch (ApiException $e) {
  19777.             switch ($e->getCode()) {
  19778.                 case 200:
  19779.                     $data AccountingObjectSerializer::deserialize(
  19780.                         $e->getResponseBody(),
  19781.                         '\XeroAPI\XeroPHP\Models\Accounting\BankTransactions',
  19782.                         $e->getResponseHeaders()
  19783.                     );
  19784.                     $e->setResponseObject($data);
  19785.                     break;
  19786.             }
  19787.             throw $e;
  19788.         }
  19789.     }
  19790.     /**
  19791.      * Operation getBankTransactionAsync
  19792.      * Retrieves a single spent or received money transaction by using a unique bank transaction Id
  19793.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  19794.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  19795.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  19796.      * @throws \InvalidArgumentException
  19797.      * @return \GuzzleHttp\Promise\PromiseInterface
  19798.      */
  19799.     public function getBankTransactionAsync($xero_tenant_id$bank_transaction_id$unitdp null)
  19800.     {
  19801.         return $this->getBankTransactionAsyncWithHttpInfo($xero_tenant_id$bank_transaction_id$unitdp)
  19802.             ->then(
  19803.                 function ($response) {
  19804.                     return $response[0];
  19805.                 }
  19806.             );
  19807.     }
  19808.     /**
  19809.      * Operation getBankTransactionAsyncWithHttpInfo
  19810.      * Retrieves a single spent or received money transaction by using a unique bank transaction Id
  19811.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  19812.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  19813.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  19814.      * @throws \InvalidArgumentException
  19815.      * @return \GuzzleHttp\Promise\PromiseInterface */
  19816.     public function getBankTransactionAsyncWithHttpInfo($xero_tenant_id$bank_transaction_id$unitdp null)
  19817.     {
  19818.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\BankTransactions';
  19819.         $request $this->getBankTransactionRequest($xero_tenant_id$bank_transaction_id$unitdp);
  19820.         return $this->client
  19821.             ->sendAsync($request$this->createHttpClientOption())
  19822.             ->then(
  19823.                 function ($response) use ($returnType) {
  19824.                     $responseBody $response->getBody();
  19825.                     if ($returnType === '\SplFileObject') {
  19826.                         $content $responseBody//stream goes to serializer
  19827.                     } else {
  19828.                         $content $responseBody->getContents();
  19829.                     }
  19830.                     return [
  19831.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  19832.                         $response->getStatusCode(),
  19833.                         $response->getHeaders()
  19834.                     ];
  19835.                 },
  19836.                 function ($exception) {
  19837.                     $response $exception->getResponse();
  19838.                     $statusCode $response->getStatusCode();
  19839.                     throw new ApiException(
  19840.                         sprintf(
  19841.                             '[%d] Error connecting to the API (%s)',
  19842.                             $statusCode,
  19843.                             $exception->getRequest()->getUri()
  19844.                         ),
  19845.                         $statusCode,
  19846.                         $response->getHeaders(),
  19847.                         $response->getBody()
  19848.                     );
  19849.                 }
  19850.             );
  19851.     }
  19852.     /**
  19853.      * Create request for operation 'getBankTransaction'
  19854.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  19855.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  19856.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  19857.      * @throws \InvalidArgumentException
  19858.      * @return \GuzzleHttp\Psr7\Request  */
  19859.     protected function getBankTransactionRequest($xero_tenant_id$bank_transaction_id$unitdp null)
  19860.     {
  19861.         // verify the required parameter 'xero_tenant_id' is set
  19862.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  19863.             throw new \InvalidArgumentException(
  19864.                 'Missing the required parameter $xero_tenant_id when calling getBankTransaction'
  19865.             );
  19866.         }
  19867.         // verify the required parameter 'bank_transaction_id' is set
  19868.         if ($bank_transaction_id === null || (is_array($bank_transaction_id) && count($bank_transaction_id) === 0)) {
  19869.             throw new \InvalidArgumentException(
  19870.                 'Missing the required parameter $bank_transaction_id when calling getBankTransaction'
  19871.             );
  19872.         }
  19873.         $resourcePath '/BankTransactions/{BankTransactionID}';
  19874.         $formParams = [];
  19875.         $queryParams = [];
  19876.         $headerParams = [];
  19877.         $httpBody '';
  19878.         $multipart false;
  19879.         // query params
  19880.         if ($unitdp !== null) {
  19881.             $queryParams['unitdp'] = AccountingObjectSerializer::toQueryValue($unitdp);
  19882.         }
  19883.         // header params
  19884.         if ($xero_tenant_id !== null) {
  19885.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  19886.         }
  19887.         // path params
  19888.         if ($bank_transaction_id !== null) {
  19889.             $resourcePath str_replace(
  19890.                 '{' 'BankTransactionID' '}',
  19891.                 AccountingObjectSerializer::toPathValue($bank_transaction_id),
  19892.                 $resourcePath
  19893.             );
  19894.         }
  19895.         // body params
  19896.         $_tempBody null;
  19897.         if ($multipart) {
  19898.             $headers $this->headerSelector->selectHeadersForMultipart(
  19899.                 ['application/json']
  19900.             );
  19901.         } else {
  19902.             $headers $this->headerSelector->selectHeaders(
  19903.                 ['application/json'],
  19904.                 []
  19905.             );
  19906.         }
  19907.         // for model (json/xml)
  19908.         if (isset($_tempBody)) {
  19909.             // $_tempBody is the method argument, if present
  19910.             if ($headers['Content-Type'] === 'application/json') {
  19911.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  19912.             } else {
  19913.                 $httpBody $_tempBody;
  19914.             }
  19915.         } elseif (count($formParams) > 0) {
  19916.             if ($multipart) {
  19917.                 $multipartContents = [
  19918.                     [
  19919.                         'Content-type' => 'multipart/form-data',
  19920.                     ]
  19921.                 ];
  19922.                 
  19923.                 // for HTTP post (form)
  19924.                 $httpBody = new MultipartStream($multipartContents);
  19925.             } elseif ($headers['Content-Type'] === 'application/json') {
  19926.                 $httpBody \GuzzleHttp\json_encode($formParams);
  19927.             } else {
  19928.                 // for HTTP post (form)
  19929.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  19930.             }
  19931.         }
  19932.         // this endpoint requires OAuth (access token)
  19933.         if ($this->config->getAccessToken() !== null) {
  19934.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  19935.         }
  19936.         $defaultHeaders = [];
  19937.         if ($this->config->getUserAgent()) {
  19938.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  19939.         }
  19940.         $headers array_merge(
  19941.             $defaultHeaders,
  19942.             $headerParams,
  19943.             $headers
  19944.         );
  19945.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  19946.         return new Request(
  19947.             'GET',
  19948.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  19949.             $headers,
  19950.             $httpBody
  19951.         );
  19952.     }
  19953.     /**
  19954.      * Operation getBankTransactionAttachmentByFileName
  19955.      * Retrieves a specific attachment from a specific bank transaction by filename
  19956.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  19957.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  19958.      * @param  string $file_name Name of the attachment (required)
  19959.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  19960.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  19961.      * @throws \InvalidArgumentException
  19962.      * @return \SplFileObject
  19963.      */
  19964.     public function getBankTransactionAttachmentByFileName($xero_tenant_id$bank_transaction_id$file_name$content_type)
  19965.     {
  19966.         list($response) = $this->getBankTransactionAttachmentByFileNameWithHttpInfo($xero_tenant_id$bank_transaction_id$file_name$content_type);
  19967.         return $response;
  19968.     }
  19969.     /**
  19970.      * Operation getBankTransactionAttachmentByFileNameWithHttpInfo
  19971.      * Retrieves a specific attachment from a specific bank transaction by filename
  19972.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  19973.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  19974.      * @param  string $file_name Name of the attachment (required)
  19975.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  19976.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  19977.      * @throws \InvalidArgumentException
  19978.      * @return array of \SplFileObject, HTTP status code, HTTP response headers (array of strings)
  19979.      */
  19980.     public function getBankTransactionAttachmentByFileNameWithHttpInfo($xero_tenant_id$bank_transaction_id$file_name$content_type)
  19981.     {
  19982.         $request $this->getBankTransactionAttachmentByFileNameRequest($xero_tenant_id$bank_transaction_id$file_name$content_type);
  19983.         try {
  19984.             $options $this->createHttpClientOption();
  19985.             try {
  19986.                 $response $this->client->send($request$options);
  19987.             } catch (RequestException $e) {
  19988.                 throw new ApiException(
  19989.                     "[{$e->getCode()}{$e->getMessage()}",
  19990.                     $e->getCode(),
  19991.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  19992.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  19993.                 );
  19994.             }
  19995.             $statusCode $response->getStatusCode();
  19996.             if ($statusCode 200 || $statusCode 299) {
  19997.                 throw new ApiException(
  19998.                     sprintf(
  19999.                         '[%d] Error connecting to the API (%s)',
  20000.                         $statusCode,
  20001.                         $request->getUri()
  20002.                     ),
  20003.                     $statusCode,
  20004.                     $response->getHeaders(),
  20005.                     $response->getBody()
  20006.                 );
  20007.             }
  20008.             $responseBody $response->getBody();
  20009.             switch($statusCode) {
  20010.                 case 200:
  20011.                     if ('\SplFileObject' === '\SplFileObject') {
  20012.                         $content $responseBody//stream goes to serializer
  20013.                     } else {
  20014.                         $content $responseBody->getContents();
  20015.                     }
  20016.                     return [
  20017.                         AccountingObjectSerializer::deserialize($content'\SplFileObject', []),
  20018.                         $response->getStatusCode(),
  20019.                         $response->getHeaders()
  20020.                     ];
  20021.             }
  20022.             $returnType '\SplFileObject';
  20023.             $responseBody $response->getBody();
  20024.             if ($returnType === '\SplFileObject') {
  20025.                 $content $responseBody//stream goes to serializer
  20026.             } else {
  20027.                 $content $responseBody->getContents();
  20028.             }
  20029.             return [
  20030.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  20031.                 $response->getStatusCode(),
  20032.                 $response->getHeaders()
  20033.             ];
  20034.         } catch (ApiException $e) {
  20035.             switch ($e->getCode()) {
  20036.                 case 200:
  20037.                     $data AccountingObjectSerializer::deserialize(
  20038.                         $e->getResponseBody(),
  20039.                         '\SplFileObject',
  20040.                         $e->getResponseHeaders()
  20041.                     );
  20042.                     $e->setResponseObject($data);
  20043.                     break;
  20044.             }
  20045.             throw $e;
  20046.         }
  20047.     }
  20048.     /**
  20049.      * Operation getBankTransactionAttachmentByFileNameAsync
  20050.      * Retrieves a specific attachment from a specific bank transaction by filename
  20051.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  20052.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  20053.      * @param  string $file_name Name of the attachment (required)
  20054.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  20055.      * @throws \InvalidArgumentException
  20056.      * @return \GuzzleHttp\Promise\PromiseInterface
  20057.      */
  20058.     public function getBankTransactionAttachmentByFileNameAsync($xero_tenant_id$bank_transaction_id$file_name$content_type)
  20059.     {
  20060.         return $this->getBankTransactionAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$bank_transaction_id$file_name$content_type)
  20061.             ->then(
  20062.                 function ($response) {
  20063.                     return $response[0];
  20064.                 }
  20065.             );
  20066.     }
  20067.     /**
  20068.      * Operation getBankTransactionAttachmentByFileNameAsyncWithHttpInfo
  20069.      * Retrieves a specific attachment from a specific bank transaction by filename
  20070.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  20071.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  20072.      * @param  string $file_name Name of the attachment (required)
  20073.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  20074.      * @throws \InvalidArgumentException
  20075.      * @return \GuzzleHttp\Promise\PromiseInterface */
  20076.     public function getBankTransactionAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$bank_transaction_id$file_name$content_type)
  20077.     {
  20078.         $returnType '\SplFileObject';
  20079.         $request $this->getBankTransactionAttachmentByFileNameRequest($xero_tenant_id$bank_transaction_id$file_name$content_type);
  20080.         return $this->client
  20081.             ->sendAsync($request$this->createHttpClientOption())
  20082.             ->then(
  20083.                 function ($response) use ($returnType) {
  20084.                     $responseBody $response->getBody();
  20085.                     if ($returnType === '\SplFileObject') {
  20086.                         $content $responseBody//stream goes to serializer
  20087.                     } else {
  20088.                         $content $responseBody->getContents();
  20089.                     }
  20090.                     return [
  20091.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  20092.                         $response->getStatusCode(),
  20093.                         $response->getHeaders()
  20094.                     ];
  20095.                 },
  20096.                 function ($exception) {
  20097.                     $response $exception->getResponse();
  20098.                     $statusCode $response->getStatusCode();
  20099.                     throw new ApiException(
  20100.                         sprintf(
  20101.                             '[%d] Error connecting to the API (%s)',
  20102.                             $statusCode,
  20103.                             $exception->getRequest()->getUri()
  20104.                         ),
  20105.                         $statusCode,
  20106.                         $response->getHeaders(),
  20107.                         $response->getBody()
  20108.                     );
  20109.                 }
  20110.             );
  20111.     }
  20112.     /**
  20113.      * Create request for operation 'getBankTransactionAttachmentByFileName'
  20114.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  20115.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  20116.      * @param  string $file_name Name of the attachment (required)
  20117.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  20118.      * @throws \InvalidArgumentException
  20119.      * @return \GuzzleHttp\Psr7\Request  */
  20120.     protected function getBankTransactionAttachmentByFileNameRequest($xero_tenant_id$bank_transaction_id$file_name$content_type)
  20121.     {
  20122.         // verify the required parameter 'xero_tenant_id' is set
  20123.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  20124.             throw new \InvalidArgumentException(
  20125.                 'Missing the required parameter $xero_tenant_id when calling getBankTransactionAttachmentByFileName'
  20126.             );
  20127.         }
  20128.         // verify the required parameter 'bank_transaction_id' is set
  20129.         if ($bank_transaction_id === null || (is_array($bank_transaction_id) && count($bank_transaction_id) === 0)) {
  20130.             throw new \InvalidArgumentException(
  20131.                 'Missing the required parameter $bank_transaction_id when calling getBankTransactionAttachmentByFileName'
  20132.             );
  20133.         }
  20134.         // verify the required parameter 'file_name' is set
  20135.         if ($file_name === null || (is_array($file_name) && count($file_name) === 0)) {
  20136.             throw new \InvalidArgumentException(
  20137.                 'Missing the required parameter $file_name when calling getBankTransactionAttachmentByFileName'
  20138.             );
  20139.         }
  20140.         // verify the required parameter 'content_type' is set
  20141.         if ($content_type === null || (is_array($content_type) && count($content_type) === 0)) {
  20142.             throw new \InvalidArgumentException(
  20143.                 'Missing the required parameter $content_type when calling getBankTransactionAttachmentByFileName'
  20144.             );
  20145.         }
  20146.         $resourcePath '/BankTransactions/{BankTransactionID}/Attachments/{FileName}';
  20147.         $formParams = [];
  20148.         $queryParams = [];
  20149.         $headerParams = [];
  20150.         $httpBody '';
  20151.         $multipart false;
  20152.         // header params
  20153.         if ($xero_tenant_id !== null) {
  20154.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  20155.         }
  20156.         // header params
  20157.         if ($content_type !== null) {
  20158.             $headerParams['contentType'] = AccountingObjectSerializer::toHeaderValue($content_type);
  20159.         }
  20160.         // path params
  20161.         if ($bank_transaction_id !== null) {
  20162.             $resourcePath str_replace(
  20163.                 '{' 'BankTransactionID' '}',
  20164.                 AccountingObjectSerializer::toPathValue($bank_transaction_id),
  20165.                 $resourcePath
  20166.             );
  20167.         }
  20168.         // path params
  20169.         if ($file_name !== null) {
  20170.             $resourcePath str_replace(
  20171.                 '{' 'FileName' '}',
  20172.                 AccountingObjectSerializer::toPathValue($file_name),
  20173.                 $resourcePath
  20174.             );
  20175.         }
  20176.         // body params
  20177.         $_tempBody null;
  20178.         if ($multipart) {
  20179.             $headers $this->headerSelector->selectHeadersForMultipart(
  20180.                 ['application/octet-stream']
  20181.             );
  20182.         } else {
  20183.             $headers $this->headerSelector->selectHeaders(
  20184.                 ['application/octet-stream'],
  20185.                 []
  20186.             );
  20187.         }
  20188.         // for model (json/xml)
  20189.         if (isset($_tempBody)) {
  20190.             // $_tempBody is the method argument, if present
  20191.             if ($headers['Content-Type'] === 'application/json') {
  20192.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  20193.             } else {
  20194.                 $httpBody $_tempBody;
  20195.             }
  20196.         } elseif (count($formParams) > 0) {
  20197.             if ($multipart) {
  20198.                 $multipartContents = [
  20199.                     [
  20200.                         'Content-type' => 'multipart/form-data',
  20201.                     ]
  20202.                 ];
  20203.                 
  20204.                 // for HTTP post (form)
  20205.                 $httpBody = new MultipartStream($multipartContents);
  20206.             } elseif ($headers['Content-Type'] === 'application/json') {
  20207.                 $httpBody \GuzzleHttp\json_encode($formParams);
  20208.             } else {
  20209.                 // for HTTP post (form)
  20210.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  20211.             }
  20212.         }
  20213.         // this endpoint requires OAuth (access token)
  20214.         if ($this->config->getAccessToken() !== null) {
  20215.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  20216.         }
  20217.         $defaultHeaders = [];
  20218.         if ($this->config->getUserAgent()) {
  20219.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  20220.         }
  20221.         $headers array_merge(
  20222.             $defaultHeaders,
  20223.             $headerParams,
  20224.             $headers
  20225.         );
  20226.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  20227.         return new Request(
  20228.             'GET',
  20229.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  20230.             $headers,
  20231.             $httpBody
  20232.         );
  20233.     }
  20234.     /**
  20235.      * Operation getBankTransactionAttachmentById
  20236.      * Retrieves specific attachments from a specific BankTransaction using a unique attachment Id
  20237.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  20238.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  20239.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  20240.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  20241.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  20242.      * @throws \InvalidArgumentException
  20243.      * @return \SplFileObject
  20244.      */
  20245.     public function getBankTransactionAttachmentById($xero_tenant_id$bank_transaction_id$attachment_id$content_type)
  20246.     {
  20247.         list($response) = $this->getBankTransactionAttachmentByIdWithHttpInfo($xero_tenant_id$bank_transaction_id$attachment_id$content_type);
  20248.         return $response;
  20249.     }
  20250.     /**
  20251.      * Operation getBankTransactionAttachmentByIdWithHttpInfo
  20252.      * Retrieves specific attachments from a specific BankTransaction using a unique attachment Id
  20253.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  20254.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  20255.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  20256.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  20257.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  20258.      * @throws \InvalidArgumentException
  20259.      * @return array of \SplFileObject, HTTP status code, HTTP response headers (array of strings)
  20260.      */
  20261.     public function getBankTransactionAttachmentByIdWithHttpInfo($xero_tenant_id$bank_transaction_id$attachment_id$content_type)
  20262.     {
  20263.         $request $this->getBankTransactionAttachmentByIdRequest($xero_tenant_id$bank_transaction_id$attachment_id$content_type);
  20264.         try {
  20265.             $options $this->createHttpClientOption();
  20266.             try {
  20267.                 $response $this->client->send($request$options);
  20268.             } catch (RequestException $e) {
  20269.                 throw new ApiException(
  20270.                     "[{$e->getCode()}{$e->getMessage()}",
  20271.                     $e->getCode(),
  20272.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  20273.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  20274.                 );
  20275.             }
  20276.             $statusCode $response->getStatusCode();
  20277.             if ($statusCode 200 || $statusCode 299) {
  20278.                 throw new ApiException(
  20279.                     sprintf(
  20280.                         '[%d] Error connecting to the API (%s)',
  20281.                         $statusCode,
  20282.                         $request->getUri()
  20283.                     ),
  20284.                     $statusCode,
  20285.                     $response->getHeaders(),
  20286.                     $response->getBody()
  20287.                 );
  20288.             }
  20289.             $responseBody $response->getBody();
  20290.             switch($statusCode) {
  20291.                 case 200:
  20292.                     if ('\SplFileObject' === '\SplFileObject') {
  20293.                         $content $responseBody//stream goes to serializer
  20294.                     } else {
  20295.                         $content $responseBody->getContents();
  20296.                     }
  20297.                     return [
  20298.                         AccountingObjectSerializer::deserialize($content'\SplFileObject', []),
  20299.                         $response->getStatusCode(),
  20300.                         $response->getHeaders()
  20301.                     ];
  20302.             }
  20303.             $returnType '\SplFileObject';
  20304.             $responseBody $response->getBody();
  20305.             if ($returnType === '\SplFileObject') {
  20306.                 $content $responseBody//stream goes to serializer
  20307.             } else {
  20308.                 $content $responseBody->getContents();
  20309.             }
  20310.             return [
  20311.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  20312.                 $response->getStatusCode(),
  20313.                 $response->getHeaders()
  20314.             ];
  20315.         } catch (ApiException $e) {
  20316.             switch ($e->getCode()) {
  20317.                 case 200:
  20318.                     $data AccountingObjectSerializer::deserialize(
  20319.                         $e->getResponseBody(),
  20320.                         '\SplFileObject',
  20321.                         $e->getResponseHeaders()
  20322.                     );
  20323.                     $e->setResponseObject($data);
  20324.                     break;
  20325.             }
  20326.             throw $e;
  20327.         }
  20328.     }
  20329.     /**
  20330.      * Operation getBankTransactionAttachmentByIdAsync
  20331.      * Retrieves specific attachments from a specific BankTransaction using a unique attachment Id
  20332.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  20333.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  20334.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  20335.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  20336.      * @throws \InvalidArgumentException
  20337.      * @return \GuzzleHttp\Promise\PromiseInterface
  20338.      */
  20339.     public function getBankTransactionAttachmentByIdAsync($xero_tenant_id$bank_transaction_id$attachment_id$content_type)
  20340.     {
  20341.         return $this->getBankTransactionAttachmentByIdAsyncWithHttpInfo($xero_tenant_id$bank_transaction_id$attachment_id$content_type)
  20342.             ->then(
  20343.                 function ($response) {
  20344.                     return $response[0];
  20345.                 }
  20346.             );
  20347.     }
  20348.     /**
  20349.      * Operation getBankTransactionAttachmentByIdAsyncWithHttpInfo
  20350.      * Retrieves specific attachments from a specific BankTransaction using a unique attachment Id
  20351.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  20352.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  20353.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  20354.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  20355.      * @throws \InvalidArgumentException
  20356.      * @return \GuzzleHttp\Promise\PromiseInterface */
  20357.     public function getBankTransactionAttachmentByIdAsyncWithHttpInfo($xero_tenant_id$bank_transaction_id$attachment_id$content_type)
  20358.     {
  20359.         $returnType '\SplFileObject';
  20360.         $request $this->getBankTransactionAttachmentByIdRequest($xero_tenant_id$bank_transaction_id$attachment_id$content_type);
  20361.         return $this->client
  20362.             ->sendAsync($request$this->createHttpClientOption())
  20363.             ->then(
  20364.                 function ($response) use ($returnType) {
  20365.                     $responseBody $response->getBody();
  20366.                     if ($returnType === '\SplFileObject') {
  20367.                         $content $responseBody//stream goes to serializer
  20368.                     } else {
  20369.                         $content $responseBody->getContents();
  20370.                     }
  20371.                     return [
  20372.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  20373.                         $response->getStatusCode(),
  20374.                         $response->getHeaders()
  20375.                     ];
  20376.                 },
  20377.                 function ($exception) {
  20378.                     $response $exception->getResponse();
  20379.                     $statusCode $response->getStatusCode();
  20380.                     throw new ApiException(
  20381.                         sprintf(
  20382.                             '[%d] Error connecting to the API (%s)',
  20383.                             $statusCode,
  20384.                             $exception->getRequest()->getUri()
  20385.                         ),
  20386.                         $statusCode,
  20387.                         $response->getHeaders(),
  20388.                         $response->getBody()
  20389.                     );
  20390.                 }
  20391.             );
  20392.     }
  20393.     /**
  20394.      * Create request for operation 'getBankTransactionAttachmentById'
  20395.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  20396.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  20397.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  20398.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  20399.      * @throws \InvalidArgumentException
  20400.      * @return \GuzzleHttp\Psr7\Request  */
  20401.     protected function getBankTransactionAttachmentByIdRequest($xero_tenant_id$bank_transaction_id$attachment_id$content_type)
  20402.     {
  20403.         // verify the required parameter 'xero_tenant_id' is set
  20404.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  20405.             throw new \InvalidArgumentException(
  20406.                 'Missing the required parameter $xero_tenant_id when calling getBankTransactionAttachmentById'
  20407.             );
  20408.         }
  20409.         // verify the required parameter 'bank_transaction_id' is set
  20410.         if ($bank_transaction_id === null || (is_array($bank_transaction_id) && count($bank_transaction_id) === 0)) {
  20411.             throw new \InvalidArgumentException(
  20412.                 'Missing the required parameter $bank_transaction_id when calling getBankTransactionAttachmentById'
  20413.             );
  20414.         }
  20415.         // verify the required parameter 'attachment_id' is set
  20416.         if ($attachment_id === null || (is_array($attachment_id) && count($attachment_id) === 0)) {
  20417.             throw new \InvalidArgumentException(
  20418.                 'Missing the required parameter $attachment_id when calling getBankTransactionAttachmentById'
  20419.             );
  20420.         }
  20421.         // verify the required parameter 'content_type' is set
  20422.         if ($content_type === null || (is_array($content_type) && count($content_type) === 0)) {
  20423.             throw new \InvalidArgumentException(
  20424.                 'Missing the required parameter $content_type when calling getBankTransactionAttachmentById'
  20425.             );
  20426.         }
  20427.         $resourcePath '/BankTransactions/{BankTransactionID}/Attachments/{AttachmentID}';
  20428.         $formParams = [];
  20429.         $queryParams = [];
  20430.         $headerParams = [];
  20431.         $httpBody '';
  20432.         $multipart false;
  20433.         // header params
  20434.         if ($xero_tenant_id !== null) {
  20435.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  20436.         }
  20437.         // header params
  20438.         if ($content_type !== null) {
  20439.             $headerParams['contentType'] = AccountingObjectSerializer::toHeaderValue($content_type);
  20440.         }
  20441.         // path params
  20442.         if ($bank_transaction_id !== null) {
  20443.             $resourcePath str_replace(
  20444.                 '{' 'BankTransactionID' '}',
  20445.                 AccountingObjectSerializer::toPathValue($bank_transaction_id),
  20446.                 $resourcePath
  20447.             );
  20448.         }
  20449.         // path params
  20450.         if ($attachment_id !== null) {
  20451.             $resourcePath str_replace(
  20452.                 '{' 'AttachmentID' '}',
  20453.                 AccountingObjectSerializer::toPathValue($attachment_id),
  20454.                 $resourcePath
  20455.             );
  20456.         }
  20457.         // body params
  20458.         $_tempBody null;
  20459.         if ($multipart) {
  20460.             $headers $this->headerSelector->selectHeadersForMultipart(
  20461.                 ['application/octet-stream']
  20462.             );
  20463.         } else {
  20464.             $headers $this->headerSelector->selectHeaders(
  20465.                 ['application/octet-stream'],
  20466.                 []
  20467.             );
  20468.         }
  20469.         // for model (json/xml)
  20470.         if (isset($_tempBody)) {
  20471.             // $_tempBody is the method argument, if present
  20472.             if ($headers['Content-Type'] === 'application/json') {
  20473.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  20474.             } else {
  20475.                 $httpBody $_tempBody;
  20476.             }
  20477.         } elseif (count($formParams) > 0) {
  20478.             if ($multipart) {
  20479.                 $multipartContents = [
  20480.                     [
  20481.                         'Content-type' => 'multipart/form-data',
  20482.                     ]
  20483.                 ];
  20484.                 
  20485.                 // for HTTP post (form)
  20486.                 $httpBody = new MultipartStream($multipartContents);
  20487.             } elseif ($headers['Content-Type'] === 'application/json') {
  20488.                 $httpBody \GuzzleHttp\json_encode($formParams);
  20489.             } else {
  20490.                 // for HTTP post (form)
  20491.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  20492.             }
  20493.         }
  20494.         // this endpoint requires OAuth (access token)
  20495.         if ($this->config->getAccessToken() !== null) {
  20496.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  20497.         }
  20498.         $defaultHeaders = [];
  20499.         if ($this->config->getUserAgent()) {
  20500.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  20501.         }
  20502.         $headers array_merge(
  20503.             $defaultHeaders,
  20504.             $headerParams,
  20505.             $headers
  20506.         );
  20507.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  20508.         return new Request(
  20509.             'GET',
  20510.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  20511.             $headers,
  20512.             $httpBody
  20513.         );
  20514.     }
  20515.     /**
  20516.      * Operation getBankTransactionAttachments
  20517.      * Retrieves any attachments from a specific bank transactions
  20518.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  20519.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  20520.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  20521.      * @throws \InvalidArgumentException
  20522.      * @return \XeroAPI\XeroPHP\Models\Accounting\Attachments
  20523.      */
  20524.     public function getBankTransactionAttachments($xero_tenant_id$bank_transaction_id)
  20525.     {
  20526.         list($response) = $this->getBankTransactionAttachmentsWithHttpInfo($xero_tenant_id$bank_transaction_id);
  20527.         return $response;
  20528.     }
  20529.     /**
  20530.      * Operation getBankTransactionAttachmentsWithHttpInfo
  20531.      * Retrieves any attachments from a specific bank transactions
  20532.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  20533.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  20534.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  20535.      * @throws \InvalidArgumentException
  20536.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Attachments, HTTP status code, HTTP response headers (array of strings)
  20537.      */
  20538.     public function getBankTransactionAttachmentsWithHttpInfo($xero_tenant_id$bank_transaction_id)
  20539.     {
  20540.         $request $this->getBankTransactionAttachmentsRequest($xero_tenant_id$bank_transaction_id);
  20541.         try {
  20542.             $options $this->createHttpClientOption();
  20543.             try {
  20544.                 $response $this->client->send($request$options);
  20545.             } catch (RequestException $e) {
  20546.                 throw new ApiException(
  20547.                     "[{$e->getCode()}{$e->getMessage()}",
  20548.                     $e->getCode(),
  20549.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  20550.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  20551.                 );
  20552.             }
  20553.             $statusCode $response->getStatusCode();
  20554.             if ($statusCode 200 || $statusCode 299) {
  20555.                 throw new ApiException(
  20556.                     sprintf(
  20557.                         '[%d] Error connecting to the API (%s)',
  20558.                         $statusCode,
  20559.                         $request->getUri()
  20560.                     ),
  20561.                     $statusCode,
  20562.                     $response->getHeaders(),
  20563.                     $response->getBody()
  20564.                 );
  20565.             }
  20566.             $responseBody $response->getBody();
  20567.             switch($statusCode) {
  20568.                 case 200:
  20569.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Attachments' === '\SplFileObject') {
  20570.                         $content $responseBody//stream goes to serializer
  20571.                     } else {
  20572.                         $content $responseBody->getContents();
  20573.                     }
  20574.                     return [
  20575.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Attachments', []),
  20576.                         $response->getStatusCode(),
  20577.                         $response->getHeaders()
  20578.                     ];
  20579.             }
  20580.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  20581.             $responseBody $response->getBody();
  20582.             if ($returnType === '\SplFileObject') {
  20583.                 $content $responseBody//stream goes to serializer
  20584.             } else {
  20585.                 $content $responseBody->getContents();
  20586.             }
  20587.             return [
  20588.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  20589.                 $response->getStatusCode(),
  20590.                 $response->getHeaders()
  20591.             ];
  20592.         } catch (ApiException $e) {
  20593.             switch ($e->getCode()) {
  20594.                 case 200:
  20595.                     $data AccountingObjectSerializer::deserialize(
  20596.                         $e->getResponseBody(),
  20597.                         '\XeroAPI\XeroPHP\Models\Accounting\Attachments',
  20598.                         $e->getResponseHeaders()
  20599.                     );
  20600.                     $e->setResponseObject($data);
  20601.                     break;
  20602.             }
  20603.             throw $e;
  20604.         }
  20605.     }
  20606.     /**
  20607.      * Operation getBankTransactionAttachmentsAsync
  20608.      * Retrieves any attachments from a specific bank transactions
  20609.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  20610.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  20611.      * @throws \InvalidArgumentException
  20612.      * @return \GuzzleHttp\Promise\PromiseInterface
  20613.      */
  20614.     public function getBankTransactionAttachmentsAsync($xero_tenant_id$bank_transaction_id)
  20615.     {
  20616.         return $this->getBankTransactionAttachmentsAsyncWithHttpInfo($xero_tenant_id$bank_transaction_id)
  20617.             ->then(
  20618.                 function ($response) {
  20619.                     return $response[0];
  20620.                 }
  20621.             );
  20622.     }
  20623.     /**
  20624.      * Operation getBankTransactionAttachmentsAsyncWithHttpInfo
  20625.      * Retrieves any attachments from a specific bank transactions
  20626.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  20627.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  20628.      * @throws \InvalidArgumentException
  20629.      * @return \GuzzleHttp\Promise\PromiseInterface */
  20630.     public function getBankTransactionAttachmentsAsyncWithHttpInfo($xero_tenant_id$bank_transaction_id)
  20631.     {
  20632.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  20633.         $request $this->getBankTransactionAttachmentsRequest($xero_tenant_id$bank_transaction_id);
  20634.         return $this->client
  20635.             ->sendAsync($request$this->createHttpClientOption())
  20636.             ->then(
  20637.                 function ($response) use ($returnType) {
  20638.                     $responseBody $response->getBody();
  20639.                     if ($returnType === '\SplFileObject') {
  20640.                         $content $responseBody//stream goes to serializer
  20641.                     } else {
  20642.                         $content $responseBody->getContents();
  20643.                     }
  20644.                     return [
  20645.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  20646.                         $response->getStatusCode(),
  20647.                         $response->getHeaders()
  20648.                     ];
  20649.                 },
  20650.                 function ($exception) {
  20651.                     $response $exception->getResponse();
  20652.                     $statusCode $response->getStatusCode();
  20653.                     throw new ApiException(
  20654.                         sprintf(
  20655.                             '[%d] Error connecting to the API (%s)',
  20656.                             $statusCode,
  20657.                             $exception->getRequest()->getUri()
  20658.                         ),
  20659.                         $statusCode,
  20660.                         $response->getHeaders(),
  20661.                         $response->getBody()
  20662.                     );
  20663.                 }
  20664.             );
  20665.     }
  20666.     /**
  20667.      * Create request for operation 'getBankTransactionAttachments'
  20668.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  20669.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  20670.      * @throws \InvalidArgumentException
  20671.      * @return \GuzzleHttp\Psr7\Request  */
  20672.     protected function getBankTransactionAttachmentsRequest($xero_tenant_id$bank_transaction_id)
  20673.     {
  20674.         // verify the required parameter 'xero_tenant_id' is set
  20675.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  20676.             throw new \InvalidArgumentException(
  20677.                 'Missing the required parameter $xero_tenant_id when calling getBankTransactionAttachments'
  20678.             );
  20679.         }
  20680.         // verify the required parameter 'bank_transaction_id' is set
  20681.         if ($bank_transaction_id === null || (is_array($bank_transaction_id) && count($bank_transaction_id) === 0)) {
  20682.             throw new \InvalidArgumentException(
  20683.                 'Missing the required parameter $bank_transaction_id when calling getBankTransactionAttachments'
  20684.             );
  20685.         }
  20686.         $resourcePath '/BankTransactions/{BankTransactionID}/Attachments';
  20687.         $formParams = [];
  20688.         $queryParams = [];
  20689.         $headerParams = [];
  20690.         $httpBody '';
  20691.         $multipart false;
  20692.         // header params
  20693.         if ($xero_tenant_id !== null) {
  20694.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  20695.         }
  20696.         // path params
  20697.         if ($bank_transaction_id !== null) {
  20698.             $resourcePath str_replace(
  20699.                 '{' 'BankTransactionID' '}',
  20700.                 AccountingObjectSerializer::toPathValue($bank_transaction_id),
  20701.                 $resourcePath
  20702.             );
  20703.         }
  20704.         // body params
  20705.         $_tempBody null;
  20706.         if ($multipart) {
  20707.             $headers $this->headerSelector->selectHeadersForMultipart(
  20708.                 ['application/json']
  20709.             );
  20710.         } else {
  20711.             $headers $this->headerSelector->selectHeaders(
  20712.                 ['application/json'],
  20713.                 []
  20714.             );
  20715.         }
  20716.         // for model (json/xml)
  20717.         if (isset($_tempBody)) {
  20718.             // $_tempBody is the method argument, if present
  20719.             if ($headers['Content-Type'] === 'application/json') {
  20720.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  20721.             } else {
  20722.                 $httpBody $_tempBody;
  20723.             }
  20724.         } elseif (count($formParams) > 0) {
  20725.             if ($multipart) {
  20726.                 $multipartContents = [
  20727.                     [
  20728.                         'Content-type' => 'multipart/form-data',
  20729.                     ]
  20730.                 ];
  20731.                 
  20732.                 // for HTTP post (form)
  20733.                 $httpBody = new MultipartStream($multipartContents);
  20734.             } elseif ($headers['Content-Type'] === 'application/json') {
  20735.                 $httpBody \GuzzleHttp\json_encode($formParams);
  20736.             } else {
  20737.                 // for HTTP post (form)
  20738.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  20739.             }
  20740.         }
  20741.         // this endpoint requires OAuth (access token)
  20742.         if ($this->config->getAccessToken() !== null) {
  20743.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  20744.         }
  20745.         $defaultHeaders = [];
  20746.         if ($this->config->getUserAgent()) {
  20747.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  20748.         }
  20749.         $headers array_merge(
  20750.             $defaultHeaders,
  20751.             $headerParams,
  20752.             $headers
  20753.         );
  20754.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  20755.         return new Request(
  20756.             'GET',
  20757.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  20758.             $headers,
  20759.             $httpBody
  20760.         );
  20761.     }
  20762.     /**
  20763.      * Operation getBankTransactions
  20764.      * Retrieves any spent or received money transactions
  20765.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  20766.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  20767.      * @param  string $where Filter by an any element (optional)
  20768.      * @param  string $order Order by an any element (optional)
  20769.      * @param  int $page Up to 100 bank transactions will be returned in a single API call with line items details (optional)
  20770.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  20771.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  20772.      * @throws \InvalidArgumentException
  20773.      * @return \XeroAPI\XeroPHP\Models\Accounting\BankTransactions
  20774.      */
  20775.     public function getBankTransactions($xero_tenant_id$if_modified_since null$where null$order null$page null$unitdp null)
  20776.     {
  20777.         list($response) = $this->getBankTransactionsWithHttpInfo($xero_tenant_id$if_modified_since$where$order$page$unitdp);
  20778.         return $response;
  20779.     }
  20780.     /**
  20781.      * Operation getBankTransactionsWithHttpInfo
  20782.      * Retrieves any spent or received money transactions
  20783.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  20784.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  20785.      * @param  string $where Filter by an any element (optional)
  20786.      * @param  string $order Order by an any element (optional)
  20787.      * @param  int $page Up to 100 bank transactions will be returned in a single API call with line items details (optional)
  20788.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  20789.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  20790.      * @throws \InvalidArgumentException
  20791.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\BankTransactions, HTTP status code, HTTP response headers (array of strings)
  20792.      */
  20793.     public function getBankTransactionsWithHttpInfo($xero_tenant_id$if_modified_since null$where null$order null$page null$unitdp null)
  20794.     {
  20795.         $request $this->getBankTransactionsRequest($xero_tenant_id$if_modified_since$where$order$page$unitdp);
  20796.         try {
  20797.             $options $this->createHttpClientOption();
  20798.             try {
  20799.                 $response $this->client->send($request$options);
  20800.             } catch (RequestException $e) {
  20801.                 throw new ApiException(
  20802.                     "[{$e->getCode()}{$e->getMessage()}",
  20803.                     $e->getCode(),
  20804.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  20805.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  20806.                 );
  20807.             }
  20808.             $statusCode $response->getStatusCode();
  20809.             if ($statusCode 200 || $statusCode 299) {
  20810.                 throw new ApiException(
  20811.                     sprintf(
  20812.                         '[%d] Error connecting to the API (%s)',
  20813.                         $statusCode,
  20814.                         $request->getUri()
  20815.                     ),
  20816.                     $statusCode,
  20817.                     $response->getHeaders(),
  20818.                     $response->getBody()
  20819.                 );
  20820.             }
  20821.             $responseBody $response->getBody();
  20822.             switch($statusCode) {
  20823.                 case 200:
  20824.                     if ('\XeroAPI\XeroPHP\Models\Accounting\BankTransactions' === '\SplFileObject') {
  20825.                         $content $responseBody//stream goes to serializer
  20826.                     } else {
  20827.                         $content $responseBody->getContents();
  20828.                     }
  20829.                     return [
  20830.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\BankTransactions', []),
  20831.                         $response->getStatusCode(),
  20832.                         $response->getHeaders()
  20833.                     ];
  20834.             }
  20835.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\BankTransactions';
  20836.             $responseBody $response->getBody();
  20837.             if ($returnType === '\SplFileObject') {
  20838.                 $content $responseBody//stream goes to serializer
  20839.             } else {
  20840.                 $content $responseBody->getContents();
  20841.             }
  20842.             return [
  20843.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  20844.                 $response->getStatusCode(),
  20845.                 $response->getHeaders()
  20846.             ];
  20847.         } catch (ApiException $e) {
  20848.             switch ($e->getCode()) {
  20849.                 case 200:
  20850.                     $data AccountingObjectSerializer::deserialize(
  20851.                         $e->getResponseBody(),
  20852.                         '\XeroAPI\XeroPHP\Models\Accounting\BankTransactions',
  20853.                         $e->getResponseHeaders()
  20854.                     );
  20855.                     $e->setResponseObject($data);
  20856.                     break;
  20857.             }
  20858.             throw $e;
  20859.         }
  20860.     }
  20861.     /**
  20862.      * Operation getBankTransactionsAsync
  20863.      * Retrieves any spent or received money transactions
  20864.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  20865.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  20866.      * @param  string $where Filter by an any element (optional)
  20867.      * @param  string $order Order by an any element (optional)
  20868.      * @param  int $page Up to 100 bank transactions will be returned in a single API call with line items details (optional)
  20869.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  20870.      * @throws \InvalidArgumentException
  20871.      * @return \GuzzleHttp\Promise\PromiseInterface
  20872.      */
  20873.     public function getBankTransactionsAsync($xero_tenant_id$if_modified_since null$where null$order null$page null$unitdp null)
  20874.     {
  20875.         return $this->getBankTransactionsAsyncWithHttpInfo($xero_tenant_id$if_modified_since$where$order$page$unitdp)
  20876.             ->then(
  20877.                 function ($response) {
  20878.                     return $response[0];
  20879.                 }
  20880.             );
  20881.     }
  20882.     /**
  20883.      * Operation getBankTransactionsAsyncWithHttpInfo
  20884.      * Retrieves any spent or received money transactions
  20885.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  20886.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  20887.      * @param  string $where Filter by an any element (optional)
  20888.      * @param  string $order Order by an any element (optional)
  20889.      * @param  int $page Up to 100 bank transactions will be returned in a single API call with line items details (optional)
  20890.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  20891.      * @throws \InvalidArgumentException
  20892.      * @return \GuzzleHttp\Promise\PromiseInterface */
  20893.     public function getBankTransactionsAsyncWithHttpInfo($xero_tenant_id$if_modified_since null$where null$order null$page null$unitdp null)
  20894.     {
  20895.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\BankTransactions';
  20896.         $request $this->getBankTransactionsRequest($xero_tenant_id$if_modified_since$where$order$page$unitdp);
  20897.         return $this->client
  20898.             ->sendAsync($request$this->createHttpClientOption())
  20899.             ->then(
  20900.                 function ($response) use ($returnType) {
  20901.                     $responseBody $response->getBody();
  20902.                     if ($returnType === '\SplFileObject') {
  20903.                         $content $responseBody//stream goes to serializer
  20904.                     } else {
  20905.                         $content $responseBody->getContents();
  20906.                     }
  20907.                     return [
  20908.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  20909.                         $response->getStatusCode(),
  20910.                         $response->getHeaders()
  20911.                     ];
  20912.                 },
  20913.                 function ($exception) {
  20914.                     $response $exception->getResponse();
  20915.                     $statusCode $response->getStatusCode();
  20916.                     throw new ApiException(
  20917.                         sprintf(
  20918.                             '[%d] Error connecting to the API (%s)',
  20919.                             $statusCode,
  20920.                             $exception->getRequest()->getUri()
  20921.                         ),
  20922.                         $statusCode,
  20923.                         $response->getHeaders(),
  20924.                         $response->getBody()
  20925.                     );
  20926.                 }
  20927.             );
  20928.     }
  20929.     /**
  20930.      * Create request for operation 'getBankTransactions'
  20931.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  20932.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  20933.      * @param  string $where Filter by an any element (optional)
  20934.      * @param  string $order Order by an any element (optional)
  20935.      * @param  int $page Up to 100 bank transactions will be returned in a single API call with line items details (optional)
  20936.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  20937.      * @throws \InvalidArgumentException
  20938.      * @return \GuzzleHttp\Psr7\Request  */
  20939.     protected function getBankTransactionsRequest($xero_tenant_id$if_modified_since null$where null$order null$page null$unitdp null)
  20940.     {
  20941.         // verify the required parameter 'xero_tenant_id' is set
  20942.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  20943.             throw new \InvalidArgumentException(
  20944.                 'Missing the required parameter $xero_tenant_id when calling getBankTransactions'
  20945.             );
  20946.         }
  20947.         $resourcePath '/BankTransactions';
  20948.         $formParams = [];
  20949.         $queryParams = [];
  20950.         $headerParams = [];
  20951.         $httpBody '';
  20952.         $multipart false;
  20953.         // query params
  20954.         if ($where !== null) {
  20955.             $queryParams['where'] = AccountingObjectSerializer::toQueryValue($where);
  20956.         }
  20957.         // query params
  20958.         if ($order !== null) {
  20959.             $queryParams['order'] = AccountingObjectSerializer::toQueryValue($order);
  20960.         }
  20961.         // query params
  20962.         if ($page !== null) {
  20963.             $queryParams['page'] = AccountingObjectSerializer::toQueryValue($page);
  20964.         }
  20965.         // query params
  20966.         if ($unitdp !== null) {
  20967.             $queryParams['unitdp'] = AccountingObjectSerializer::toQueryValue($unitdp);
  20968.         }
  20969.         // header params
  20970.         if ($xero_tenant_id !== null) {
  20971.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  20972.         }
  20973.         // header params
  20974.         if ($if_modified_since !== null) {
  20975.             $headerParams['If-Modified-Since'] = AccountingObjectSerializer::toHeaderValue($if_modified_since);
  20976.         }
  20977.         // body params
  20978.         $_tempBody null;
  20979.         if ($multipart) {
  20980.             $headers $this->headerSelector->selectHeadersForMultipart(
  20981.                 ['application/json']
  20982.             );
  20983.         } else {
  20984.             $headers $this->headerSelector->selectHeaders(
  20985.                 ['application/json'],
  20986.                 []
  20987.             );
  20988.         }
  20989.         // for model (json/xml)
  20990.         if (isset($_tempBody)) {
  20991.             // $_tempBody is the method argument, if present
  20992.             if ($headers['Content-Type'] === 'application/json') {
  20993.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  20994.             } else {
  20995.                 $httpBody $_tempBody;
  20996.             }
  20997.         } elseif (count($formParams) > 0) {
  20998.             if ($multipart) {
  20999.                 $multipartContents = [
  21000.                     [
  21001.                         'Content-type' => 'multipart/form-data',
  21002.                     ]
  21003.                 ];
  21004.                 
  21005.                 // for HTTP post (form)
  21006.                 $httpBody = new MultipartStream($multipartContents);
  21007.             } elseif ($headers['Content-Type'] === 'application/json') {
  21008.                 $httpBody \GuzzleHttp\json_encode($formParams);
  21009.             } else {
  21010.                 // for HTTP post (form)
  21011.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  21012.             }
  21013.         }
  21014.         // this endpoint requires OAuth (access token)
  21015.         if ($this->config->getAccessToken() !== null) {
  21016.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  21017.         }
  21018.         $defaultHeaders = [];
  21019.         if ($this->config->getUserAgent()) {
  21020.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  21021.         }
  21022.         $headers array_merge(
  21023.             $defaultHeaders,
  21024.             $headerParams,
  21025.             $headers
  21026.         );
  21027.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  21028.         return new Request(
  21029.             'GET',
  21030.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  21031.             $headers,
  21032.             $httpBody
  21033.         );
  21034.     }
  21035.     /**
  21036.      * Operation getBankTransactionsHistory
  21037.      * Retrieves history from a specific bank transaction using a unique bank transaction Id
  21038.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  21039.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  21040.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  21041.      * @throws \InvalidArgumentException
  21042.      * @return \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords
  21043.      */
  21044.     public function getBankTransactionsHistory($xero_tenant_id$bank_transaction_id)
  21045.     {
  21046.         list($response) = $this->getBankTransactionsHistoryWithHttpInfo($xero_tenant_id$bank_transaction_id);
  21047.         return $response;
  21048.     }
  21049.     /**
  21050.      * Operation getBankTransactionsHistoryWithHttpInfo
  21051.      * Retrieves history from a specific bank transaction using a unique bank transaction Id
  21052.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  21053.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  21054.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  21055.      * @throws \InvalidArgumentException
  21056.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords, HTTP status code, HTTP response headers (array of strings)
  21057.      */
  21058.     public function getBankTransactionsHistoryWithHttpInfo($xero_tenant_id$bank_transaction_id)
  21059.     {
  21060.         $request $this->getBankTransactionsHistoryRequest($xero_tenant_id$bank_transaction_id);
  21061.         try {
  21062.             $options $this->createHttpClientOption();
  21063.             try {
  21064.                 $response $this->client->send($request$options);
  21065.             } catch (RequestException $e) {
  21066.                 throw new ApiException(
  21067.                     "[{$e->getCode()}{$e->getMessage()}",
  21068.                     $e->getCode(),
  21069.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  21070.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  21071.                 );
  21072.             }
  21073.             $statusCode $response->getStatusCode();
  21074.             if ($statusCode 200 || $statusCode 299) {
  21075.                 throw new ApiException(
  21076.                     sprintf(
  21077.                         '[%d] Error connecting to the API (%s)',
  21078.                         $statusCode,
  21079.                         $request->getUri()
  21080.                     ),
  21081.                     $statusCode,
  21082.                     $response->getHeaders(),
  21083.                     $response->getBody()
  21084.                 );
  21085.             }
  21086.             $responseBody $response->getBody();
  21087.             switch($statusCode) {
  21088.                 case 200:
  21089.                     if ('\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords' === '\SplFileObject') {
  21090.                         $content $responseBody//stream goes to serializer
  21091.                     } else {
  21092.                         $content $responseBody->getContents();
  21093.                     }
  21094.                     return [
  21095.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords', []),
  21096.                         $response->getStatusCode(),
  21097.                         $response->getHeaders()
  21098.                     ];
  21099.             }
  21100.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  21101.             $responseBody $response->getBody();
  21102.             if ($returnType === '\SplFileObject') {
  21103.                 $content $responseBody//stream goes to serializer
  21104.             } else {
  21105.                 $content $responseBody->getContents();
  21106.             }
  21107.             return [
  21108.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  21109.                 $response->getStatusCode(),
  21110.                 $response->getHeaders()
  21111.             ];
  21112.         } catch (ApiException $e) {
  21113.             switch ($e->getCode()) {
  21114.                 case 200:
  21115.                     $data AccountingObjectSerializer::deserialize(
  21116.                         $e->getResponseBody(),
  21117.                         '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords',
  21118.                         $e->getResponseHeaders()
  21119.                     );
  21120.                     $e->setResponseObject($data);
  21121.                     break;
  21122.             }
  21123.             throw $e;
  21124.         }
  21125.     }
  21126.     /**
  21127.      * Operation getBankTransactionsHistoryAsync
  21128.      * Retrieves history from a specific bank transaction using a unique bank transaction Id
  21129.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  21130.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  21131.      * @throws \InvalidArgumentException
  21132.      * @return \GuzzleHttp\Promise\PromiseInterface
  21133.      */
  21134.     public function getBankTransactionsHistoryAsync($xero_tenant_id$bank_transaction_id)
  21135.     {
  21136.         return $this->getBankTransactionsHistoryAsyncWithHttpInfo($xero_tenant_id$bank_transaction_id)
  21137.             ->then(
  21138.                 function ($response) {
  21139.                     return $response[0];
  21140.                 }
  21141.             );
  21142.     }
  21143.     /**
  21144.      * Operation getBankTransactionsHistoryAsyncWithHttpInfo
  21145.      * Retrieves history from a specific bank transaction using a unique bank transaction Id
  21146.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  21147.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  21148.      * @throws \InvalidArgumentException
  21149.      * @return \GuzzleHttp\Promise\PromiseInterface */
  21150.     public function getBankTransactionsHistoryAsyncWithHttpInfo($xero_tenant_id$bank_transaction_id)
  21151.     {
  21152.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  21153.         $request $this->getBankTransactionsHistoryRequest($xero_tenant_id$bank_transaction_id);
  21154.         return $this->client
  21155.             ->sendAsync($request$this->createHttpClientOption())
  21156.             ->then(
  21157.                 function ($response) use ($returnType) {
  21158.                     $responseBody $response->getBody();
  21159.                     if ($returnType === '\SplFileObject') {
  21160.                         $content $responseBody//stream goes to serializer
  21161.                     } else {
  21162.                         $content $responseBody->getContents();
  21163.                     }
  21164.                     return [
  21165.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  21166.                         $response->getStatusCode(),
  21167.                         $response->getHeaders()
  21168.                     ];
  21169.                 },
  21170.                 function ($exception) {
  21171.                     $response $exception->getResponse();
  21172.                     $statusCode $response->getStatusCode();
  21173.                     throw new ApiException(
  21174.                         sprintf(
  21175.                             '[%d] Error connecting to the API (%s)',
  21176.                             $statusCode,
  21177.                             $exception->getRequest()->getUri()
  21178.                         ),
  21179.                         $statusCode,
  21180.                         $response->getHeaders(),
  21181.                         $response->getBody()
  21182.                     );
  21183.                 }
  21184.             );
  21185.     }
  21186.     /**
  21187.      * Create request for operation 'getBankTransactionsHistory'
  21188.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  21189.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  21190.      * @throws \InvalidArgumentException
  21191.      * @return \GuzzleHttp\Psr7\Request  */
  21192.     protected function getBankTransactionsHistoryRequest($xero_tenant_id$bank_transaction_id)
  21193.     {
  21194.         // verify the required parameter 'xero_tenant_id' is set
  21195.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  21196.             throw new \InvalidArgumentException(
  21197.                 'Missing the required parameter $xero_tenant_id when calling getBankTransactionsHistory'
  21198.             );
  21199.         }
  21200.         // verify the required parameter 'bank_transaction_id' is set
  21201.         if ($bank_transaction_id === null || (is_array($bank_transaction_id) && count($bank_transaction_id) === 0)) {
  21202.             throw new \InvalidArgumentException(
  21203.                 'Missing the required parameter $bank_transaction_id when calling getBankTransactionsHistory'
  21204.             );
  21205.         }
  21206.         $resourcePath '/BankTransactions/{BankTransactionID}/History';
  21207.         $formParams = [];
  21208.         $queryParams = [];
  21209.         $headerParams = [];
  21210.         $httpBody '';
  21211.         $multipart false;
  21212.         // header params
  21213.         if ($xero_tenant_id !== null) {
  21214.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  21215.         }
  21216.         // path params
  21217.         if ($bank_transaction_id !== null) {
  21218.             $resourcePath str_replace(
  21219.                 '{' 'BankTransactionID' '}',
  21220.                 AccountingObjectSerializer::toPathValue($bank_transaction_id),
  21221.                 $resourcePath
  21222.             );
  21223.         }
  21224.         // body params
  21225.         $_tempBody null;
  21226.         if ($multipart) {
  21227.             $headers $this->headerSelector->selectHeadersForMultipart(
  21228.                 ['application/json']
  21229.             );
  21230.         } else {
  21231.             $headers $this->headerSelector->selectHeaders(
  21232.                 ['application/json'],
  21233.                 []
  21234.             );
  21235.         }
  21236.         // for model (json/xml)
  21237.         if (isset($_tempBody)) {
  21238.             // $_tempBody is the method argument, if present
  21239.             if ($headers['Content-Type'] === 'application/json') {
  21240.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  21241.             } else {
  21242.                 $httpBody $_tempBody;
  21243.             }
  21244.         } elseif (count($formParams) > 0) {
  21245.             if ($multipart) {
  21246.                 $multipartContents = [
  21247.                     [
  21248.                         'Content-type' => 'multipart/form-data',
  21249.                     ]
  21250.                 ];
  21251.                 
  21252.                 // for HTTP post (form)
  21253.                 $httpBody = new MultipartStream($multipartContents);
  21254.             } elseif ($headers['Content-Type'] === 'application/json') {
  21255.                 $httpBody \GuzzleHttp\json_encode($formParams);
  21256.             } else {
  21257.                 // for HTTP post (form)
  21258.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  21259.             }
  21260.         }
  21261.         // this endpoint requires OAuth (access token)
  21262.         if ($this->config->getAccessToken() !== null) {
  21263.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  21264.         }
  21265.         $defaultHeaders = [];
  21266.         if ($this->config->getUserAgent()) {
  21267.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  21268.         }
  21269.         $headers array_merge(
  21270.             $defaultHeaders,
  21271.             $headerParams,
  21272.             $headers
  21273.         );
  21274.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  21275.         return new Request(
  21276.             'GET',
  21277.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  21278.             $headers,
  21279.             $httpBody
  21280.         );
  21281.     }
  21282.     /**
  21283.      * Operation getBankTransfer
  21284.      * Retrieves specific bank transfers by using a unique bank transfer Id
  21285.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  21286.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  21287.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  21288.      * @throws \InvalidArgumentException
  21289.      * @return \XeroAPI\XeroPHP\Models\Accounting\BankTransfers
  21290.      */
  21291.     public function getBankTransfer($xero_tenant_id$bank_transfer_id)
  21292.     {
  21293.         list($response) = $this->getBankTransferWithHttpInfo($xero_tenant_id$bank_transfer_id);
  21294.         return $response;
  21295.     }
  21296.     /**
  21297.      * Operation getBankTransferWithHttpInfo
  21298.      * Retrieves specific bank transfers by using a unique bank transfer Id
  21299.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  21300.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  21301.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  21302.      * @throws \InvalidArgumentException
  21303.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\BankTransfers, HTTP status code, HTTP response headers (array of strings)
  21304.      */
  21305.     public function getBankTransferWithHttpInfo($xero_tenant_id$bank_transfer_id)
  21306.     {
  21307.         $request $this->getBankTransferRequest($xero_tenant_id$bank_transfer_id);
  21308.         try {
  21309.             $options $this->createHttpClientOption();
  21310.             try {
  21311.                 $response $this->client->send($request$options);
  21312.             } catch (RequestException $e) {
  21313.                 throw new ApiException(
  21314.                     "[{$e->getCode()}{$e->getMessage()}",
  21315.                     $e->getCode(),
  21316.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  21317.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  21318.                 );
  21319.             }
  21320.             $statusCode $response->getStatusCode();
  21321.             if ($statusCode 200 || $statusCode 299) {
  21322.                 throw new ApiException(
  21323.                     sprintf(
  21324.                         '[%d] Error connecting to the API (%s)',
  21325.                         $statusCode,
  21326.                         $request->getUri()
  21327.                     ),
  21328.                     $statusCode,
  21329.                     $response->getHeaders(),
  21330.                     $response->getBody()
  21331.                 );
  21332.             }
  21333.             $responseBody $response->getBody();
  21334.             switch($statusCode) {
  21335.                 case 200:
  21336.                     if ('\XeroAPI\XeroPHP\Models\Accounting\BankTransfers' === '\SplFileObject') {
  21337.                         $content $responseBody//stream goes to serializer
  21338.                     } else {
  21339.                         $content $responseBody->getContents();
  21340.                     }
  21341.                     return [
  21342.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\BankTransfers', []),
  21343.                         $response->getStatusCode(),
  21344.                         $response->getHeaders()
  21345.                     ];
  21346.             }
  21347.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\BankTransfers';
  21348.             $responseBody $response->getBody();
  21349.             if ($returnType === '\SplFileObject') {
  21350.                 $content $responseBody//stream goes to serializer
  21351.             } else {
  21352.                 $content $responseBody->getContents();
  21353.             }
  21354.             return [
  21355.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  21356.                 $response->getStatusCode(),
  21357.                 $response->getHeaders()
  21358.             ];
  21359.         } catch (ApiException $e) {
  21360.             switch ($e->getCode()) {
  21361.                 case 200:
  21362.                     $data AccountingObjectSerializer::deserialize(
  21363.                         $e->getResponseBody(),
  21364.                         '\XeroAPI\XeroPHP\Models\Accounting\BankTransfers',
  21365.                         $e->getResponseHeaders()
  21366.                     );
  21367.                     $e->setResponseObject($data);
  21368.                     break;
  21369.             }
  21370.             throw $e;
  21371.         }
  21372.     }
  21373.     /**
  21374.      * Operation getBankTransferAsync
  21375.      * Retrieves specific bank transfers by using a unique bank transfer Id
  21376.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  21377.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  21378.      * @throws \InvalidArgumentException
  21379.      * @return \GuzzleHttp\Promise\PromiseInterface
  21380.      */
  21381.     public function getBankTransferAsync($xero_tenant_id$bank_transfer_id)
  21382.     {
  21383.         return $this->getBankTransferAsyncWithHttpInfo($xero_tenant_id$bank_transfer_id)
  21384.             ->then(
  21385.                 function ($response) {
  21386.                     return $response[0];
  21387.                 }
  21388.             );
  21389.     }
  21390.     /**
  21391.      * Operation getBankTransferAsyncWithHttpInfo
  21392.      * Retrieves specific bank transfers by using a unique bank transfer Id
  21393.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  21394.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  21395.      * @throws \InvalidArgumentException
  21396.      * @return \GuzzleHttp\Promise\PromiseInterface */
  21397.     public function getBankTransferAsyncWithHttpInfo($xero_tenant_id$bank_transfer_id)
  21398.     {
  21399.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\BankTransfers';
  21400.         $request $this->getBankTransferRequest($xero_tenant_id$bank_transfer_id);
  21401.         return $this->client
  21402.             ->sendAsync($request$this->createHttpClientOption())
  21403.             ->then(
  21404.                 function ($response) use ($returnType) {
  21405.                     $responseBody $response->getBody();
  21406.                     if ($returnType === '\SplFileObject') {
  21407.                         $content $responseBody//stream goes to serializer
  21408.                     } else {
  21409.                         $content $responseBody->getContents();
  21410.                     }
  21411.                     return [
  21412.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  21413.                         $response->getStatusCode(),
  21414.                         $response->getHeaders()
  21415.                     ];
  21416.                 },
  21417.                 function ($exception) {
  21418.                     $response $exception->getResponse();
  21419.                     $statusCode $response->getStatusCode();
  21420.                     throw new ApiException(
  21421.                         sprintf(
  21422.                             '[%d] Error connecting to the API (%s)',
  21423.                             $statusCode,
  21424.                             $exception->getRequest()->getUri()
  21425.                         ),
  21426.                         $statusCode,
  21427.                         $response->getHeaders(),
  21428.                         $response->getBody()
  21429.                     );
  21430.                 }
  21431.             );
  21432.     }
  21433.     /**
  21434.      * Create request for operation 'getBankTransfer'
  21435.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  21436.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  21437.      * @throws \InvalidArgumentException
  21438.      * @return \GuzzleHttp\Psr7\Request  */
  21439.     protected function getBankTransferRequest($xero_tenant_id$bank_transfer_id)
  21440.     {
  21441.         // verify the required parameter 'xero_tenant_id' is set
  21442.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  21443.             throw new \InvalidArgumentException(
  21444.                 'Missing the required parameter $xero_tenant_id when calling getBankTransfer'
  21445.             );
  21446.         }
  21447.         // verify the required parameter 'bank_transfer_id' is set
  21448.         if ($bank_transfer_id === null || (is_array($bank_transfer_id) && count($bank_transfer_id) === 0)) {
  21449.             throw new \InvalidArgumentException(
  21450.                 'Missing the required parameter $bank_transfer_id when calling getBankTransfer'
  21451.             );
  21452.         }
  21453.         $resourcePath '/BankTransfers/{BankTransferID}';
  21454.         $formParams = [];
  21455.         $queryParams = [];
  21456.         $headerParams = [];
  21457.         $httpBody '';
  21458.         $multipart false;
  21459.         // header params
  21460.         if ($xero_tenant_id !== null) {
  21461.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  21462.         }
  21463.         // path params
  21464.         if ($bank_transfer_id !== null) {
  21465.             $resourcePath str_replace(
  21466.                 '{' 'BankTransferID' '}',
  21467.                 AccountingObjectSerializer::toPathValue($bank_transfer_id),
  21468.                 $resourcePath
  21469.             );
  21470.         }
  21471.         // body params
  21472.         $_tempBody null;
  21473.         if ($multipart) {
  21474.             $headers $this->headerSelector->selectHeadersForMultipart(
  21475.                 ['application/json']
  21476.             );
  21477.         } else {
  21478.             $headers $this->headerSelector->selectHeaders(
  21479.                 ['application/json'],
  21480.                 []
  21481.             );
  21482.         }
  21483.         // for model (json/xml)
  21484.         if (isset($_tempBody)) {
  21485.             // $_tempBody is the method argument, if present
  21486.             if ($headers['Content-Type'] === 'application/json') {
  21487.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  21488.             } else {
  21489.                 $httpBody $_tempBody;
  21490.             }
  21491.         } elseif (count($formParams) > 0) {
  21492.             if ($multipart) {
  21493.                 $multipartContents = [
  21494.                     [
  21495.                         'Content-type' => 'multipart/form-data',
  21496.                     ]
  21497.                 ];
  21498.                 
  21499.                 // for HTTP post (form)
  21500.                 $httpBody = new MultipartStream($multipartContents);
  21501.             } elseif ($headers['Content-Type'] === 'application/json') {
  21502.                 $httpBody \GuzzleHttp\json_encode($formParams);
  21503.             } else {
  21504.                 // for HTTP post (form)
  21505.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  21506.             }
  21507.         }
  21508.         // this endpoint requires OAuth (access token)
  21509.         if ($this->config->getAccessToken() !== null) {
  21510.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  21511.         }
  21512.         $defaultHeaders = [];
  21513.         if ($this->config->getUserAgent()) {
  21514.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  21515.         }
  21516.         $headers array_merge(
  21517.             $defaultHeaders,
  21518.             $headerParams,
  21519.             $headers
  21520.         );
  21521.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  21522.         return new Request(
  21523.             'GET',
  21524.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  21525.             $headers,
  21526.             $httpBody
  21527.         );
  21528.     }
  21529.     /**
  21530.      * Operation getBankTransferAttachmentByFileName
  21531.      * Retrieves a specific attachment on a specific bank transfer by file name
  21532.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  21533.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  21534.      * @param  string $file_name Name of the attachment (required)
  21535.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  21536.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  21537.      * @throws \InvalidArgumentException
  21538.      * @return \SplFileObject
  21539.      */
  21540.     public function getBankTransferAttachmentByFileName($xero_tenant_id$bank_transfer_id$file_name$content_type)
  21541.     {
  21542.         list($response) = $this->getBankTransferAttachmentByFileNameWithHttpInfo($xero_tenant_id$bank_transfer_id$file_name$content_type);
  21543.         return $response;
  21544.     }
  21545.     /**
  21546.      * Operation getBankTransferAttachmentByFileNameWithHttpInfo
  21547.      * Retrieves a specific attachment on a specific bank transfer by file name
  21548.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  21549.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  21550.      * @param  string $file_name Name of the attachment (required)
  21551.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  21552.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  21553.      * @throws \InvalidArgumentException
  21554.      * @return array of \SplFileObject, HTTP status code, HTTP response headers (array of strings)
  21555.      */
  21556.     public function getBankTransferAttachmentByFileNameWithHttpInfo($xero_tenant_id$bank_transfer_id$file_name$content_type)
  21557.     {
  21558.         $request $this->getBankTransferAttachmentByFileNameRequest($xero_tenant_id$bank_transfer_id$file_name$content_type);
  21559.         try {
  21560.             $options $this->createHttpClientOption();
  21561.             try {
  21562.                 $response $this->client->send($request$options);
  21563.             } catch (RequestException $e) {
  21564.                 throw new ApiException(
  21565.                     "[{$e->getCode()}{$e->getMessage()}",
  21566.                     $e->getCode(),
  21567.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  21568.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  21569.                 );
  21570.             }
  21571.             $statusCode $response->getStatusCode();
  21572.             if ($statusCode 200 || $statusCode 299) {
  21573.                 throw new ApiException(
  21574.                     sprintf(
  21575.                         '[%d] Error connecting to the API (%s)',
  21576.                         $statusCode,
  21577.                         $request->getUri()
  21578.                     ),
  21579.                     $statusCode,
  21580.                     $response->getHeaders(),
  21581.                     $response->getBody()
  21582.                 );
  21583.             }
  21584.             $responseBody $response->getBody();
  21585.             switch($statusCode) {
  21586.                 case 200:
  21587.                     if ('\SplFileObject' === '\SplFileObject') {
  21588.                         $content $responseBody//stream goes to serializer
  21589.                     } else {
  21590.                         $content $responseBody->getContents();
  21591.                     }
  21592.                     return [
  21593.                         AccountingObjectSerializer::deserialize($content'\SplFileObject', []),
  21594.                         $response->getStatusCode(),
  21595.                         $response->getHeaders()
  21596.                     ];
  21597.             }
  21598.             $returnType '\SplFileObject';
  21599.             $responseBody $response->getBody();
  21600.             if ($returnType === '\SplFileObject') {
  21601.                 $content $responseBody//stream goes to serializer
  21602.             } else {
  21603.                 $content $responseBody->getContents();
  21604.             }
  21605.             return [
  21606.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  21607.                 $response->getStatusCode(),
  21608.                 $response->getHeaders()
  21609.             ];
  21610.         } catch (ApiException $e) {
  21611.             switch ($e->getCode()) {
  21612.                 case 200:
  21613.                     $data AccountingObjectSerializer::deserialize(
  21614.                         $e->getResponseBody(),
  21615.                         '\SplFileObject',
  21616.                         $e->getResponseHeaders()
  21617.                     );
  21618.                     $e->setResponseObject($data);
  21619.                     break;
  21620.             }
  21621.             throw $e;
  21622.         }
  21623.     }
  21624.     /**
  21625.      * Operation getBankTransferAttachmentByFileNameAsync
  21626.      * Retrieves a specific attachment on a specific bank transfer by file name
  21627.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  21628.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  21629.      * @param  string $file_name Name of the attachment (required)
  21630.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  21631.      * @throws \InvalidArgumentException
  21632.      * @return \GuzzleHttp\Promise\PromiseInterface
  21633.      */
  21634.     public function getBankTransferAttachmentByFileNameAsync($xero_tenant_id$bank_transfer_id$file_name$content_type)
  21635.     {
  21636.         return $this->getBankTransferAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$bank_transfer_id$file_name$content_type)
  21637.             ->then(
  21638.                 function ($response) {
  21639.                     return $response[0];
  21640.                 }
  21641.             );
  21642.     }
  21643.     /**
  21644.      * Operation getBankTransferAttachmentByFileNameAsyncWithHttpInfo
  21645.      * Retrieves a specific attachment on a specific bank transfer by file name
  21646.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  21647.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  21648.      * @param  string $file_name Name of the attachment (required)
  21649.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  21650.      * @throws \InvalidArgumentException
  21651.      * @return \GuzzleHttp\Promise\PromiseInterface */
  21652.     public function getBankTransferAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$bank_transfer_id$file_name$content_type)
  21653.     {
  21654.         $returnType '\SplFileObject';
  21655.         $request $this->getBankTransferAttachmentByFileNameRequest($xero_tenant_id$bank_transfer_id$file_name$content_type);
  21656.         return $this->client
  21657.             ->sendAsync($request$this->createHttpClientOption())
  21658.             ->then(
  21659.                 function ($response) use ($returnType) {
  21660.                     $responseBody $response->getBody();
  21661.                     if ($returnType === '\SplFileObject') {
  21662.                         $content $responseBody//stream goes to serializer
  21663.                     } else {
  21664.                         $content $responseBody->getContents();
  21665.                     }
  21666.                     return [
  21667.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  21668.                         $response->getStatusCode(),
  21669.                         $response->getHeaders()
  21670.                     ];
  21671.                 },
  21672.                 function ($exception) {
  21673.                     $response $exception->getResponse();
  21674.                     $statusCode $response->getStatusCode();
  21675.                     throw new ApiException(
  21676.                         sprintf(
  21677.                             '[%d] Error connecting to the API (%s)',
  21678.                             $statusCode,
  21679.                             $exception->getRequest()->getUri()
  21680.                         ),
  21681.                         $statusCode,
  21682.                         $response->getHeaders(),
  21683.                         $response->getBody()
  21684.                     );
  21685.                 }
  21686.             );
  21687.     }
  21688.     /**
  21689.      * Create request for operation 'getBankTransferAttachmentByFileName'
  21690.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  21691.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  21692.      * @param  string $file_name Name of the attachment (required)
  21693.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  21694.      * @throws \InvalidArgumentException
  21695.      * @return \GuzzleHttp\Psr7\Request  */
  21696.     protected function getBankTransferAttachmentByFileNameRequest($xero_tenant_id$bank_transfer_id$file_name$content_type)
  21697.     {
  21698.         // verify the required parameter 'xero_tenant_id' is set
  21699.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  21700.             throw new \InvalidArgumentException(
  21701.                 'Missing the required parameter $xero_tenant_id when calling getBankTransferAttachmentByFileName'
  21702.             );
  21703.         }
  21704.         // verify the required parameter 'bank_transfer_id' is set
  21705.         if ($bank_transfer_id === null || (is_array($bank_transfer_id) && count($bank_transfer_id) === 0)) {
  21706.             throw new \InvalidArgumentException(
  21707.                 'Missing the required parameter $bank_transfer_id when calling getBankTransferAttachmentByFileName'
  21708.             );
  21709.         }
  21710.         // verify the required parameter 'file_name' is set
  21711.         if ($file_name === null || (is_array($file_name) && count($file_name) === 0)) {
  21712.             throw new \InvalidArgumentException(
  21713.                 'Missing the required parameter $file_name when calling getBankTransferAttachmentByFileName'
  21714.             );
  21715.         }
  21716.         // verify the required parameter 'content_type' is set
  21717.         if ($content_type === null || (is_array($content_type) && count($content_type) === 0)) {
  21718.             throw new \InvalidArgumentException(
  21719.                 'Missing the required parameter $content_type when calling getBankTransferAttachmentByFileName'
  21720.             );
  21721.         }
  21722.         $resourcePath '/BankTransfers/{BankTransferID}/Attachments/{FileName}';
  21723.         $formParams = [];
  21724.         $queryParams = [];
  21725.         $headerParams = [];
  21726.         $httpBody '';
  21727.         $multipart false;
  21728.         // header params
  21729.         if ($xero_tenant_id !== null) {
  21730.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  21731.         }
  21732.         // header params
  21733.         if ($content_type !== null) {
  21734.             $headerParams['contentType'] = AccountingObjectSerializer::toHeaderValue($content_type);
  21735.         }
  21736.         // path params
  21737.         if ($bank_transfer_id !== null) {
  21738.             $resourcePath str_replace(
  21739.                 '{' 'BankTransferID' '}',
  21740.                 AccountingObjectSerializer::toPathValue($bank_transfer_id),
  21741.                 $resourcePath
  21742.             );
  21743.         }
  21744.         // path params
  21745.         if ($file_name !== null) {
  21746.             $resourcePath str_replace(
  21747.                 '{' 'FileName' '}',
  21748.                 AccountingObjectSerializer::toPathValue($file_name),
  21749.                 $resourcePath
  21750.             );
  21751.         }
  21752.         // body params
  21753.         $_tempBody null;
  21754.         if ($multipart) {
  21755.             $headers $this->headerSelector->selectHeadersForMultipart(
  21756.                 ['application/octet-stream']
  21757.             );
  21758.         } else {
  21759.             $headers $this->headerSelector->selectHeaders(
  21760.                 ['application/octet-stream'],
  21761.                 []
  21762.             );
  21763.         }
  21764.         // for model (json/xml)
  21765.         if (isset($_tempBody)) {
  21766.             // $_tempBody is the method argument, if present
  21767.             if ($headers['Content-Type'] === 'application/json') {
  21768.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  21769.             } else {
  21770.                 $httpBody $_tempBody;
  21771.             }
  21772.         } elseif (count($formParams) > 0) {
  21773.             if ($multipart) {
  21774.                 $multipartContents = [
  21775.                     [
  21776.                         'Content-type' => 'multipart/form-data',
  21777.                     ]
  21778.                 ];
  21779.                 
  21780.                 // for HTTP post (form)
  21781.                 $httpBody = new MultipartStream($multipartContents);
  21782.             } elseif ($headers['Content-Type'] === 'application/json') {
  21783.                 $httpBody \GuzzleHttp\json_encode($formParams);
  21784.             } else {
  21785.                 // for HTTP post (form)
  21786.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  21787.             }
  21788.         }
  21789.         // this endpoint requires OAuth (access token)
  21790.         if ($this->config->getAccessToken() !== null) {
  21791.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  21792.         }
  21793.         $defaultHeaders = [];
  21794.         if ($this->config->getUserAgent()) {
  21795.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  21796.         }
  21797.         $headers array_merge(
  21798.             $defaultHeaders,
  21799.             $headerParams,
  21800.             $headers
  21801.         );
  21802.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  21803.         return new Request(
  21804.             'GET',
  21805.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  21806.             $headers,
  21807.             $httpBody
  21808.         );
  21809.     }
  21810.     /**
  21811.      * Operation getBankTransferAttachmentById
  21812.      * Retrieves a specific attachment from a specific bank transfer using a unique attachment ID
  21813.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  21814.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  21815.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  21816.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  21817.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  21818.      * @throws \InvalidArgumentException
  21819.      * @return \SplFileObject
  21820.      */
  21821.     public function getBankTransferAttachmentById($xero_tenant_id$bank_transfer_id$attachment_id$content_type)
  21822.     {
  21823.         list($response) = $this->getBankTransferAttachmentByIdWithHttpInfo($xero_tenant_id$bank_transfer_id$attachment_id$content_type);
  21824.         return $response;
  21825.     }
  21826.     /**
  21827.      * Operation getBankTransferAttachmentByIdWithHttpInfo
  21828.      * Retrieves a specific attachment from a specific bank transfer using a unique attachment ID
  21829.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  21830.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  21831.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  21832.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  21833.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  21834.      * @throws \InvalidArgumentException
  21835.      * @return array of \SplFileObject, HTTP status code, HTTP response headers (array of strings)
  21836.      */
  21837.     public function getBankTransferAttachmentByIdWithHttpInfo($xero_tenant_id$bank_transfer_id$attachment_id$content_type)
  21838.     {
  21839.         $request $this->getBankTransferAttachmentByIdRequest($xero_tenant_id$bank_transfer_id$attachment_id$content_type);
  21840.         try {
  21841.             $options $this->createHttpClientOption();
  21842.             try {
  21843.                 $response $this->client->send($request$options);
  21844.             } catch (RequestException $e) {
  21845.                 throw new ApiException(
  21846.                     "[{$e->getCode()}{$e->getMessage()}",
  21847.                     $e->getCode(),
  21848.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  21849.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  21850.                 );
  21851.             }
  21852.             $statusCode $response->getStatusCode();
  21853.             if ($statusCode 200 || $statusCode 299) {
  21854.                 throw new ApiException(
  21855.                     sprintf(
  21856.                         '[%d] Error connecting to the API (%s)',
  21857.                         $statusCode,
  21858.                         $request->getUri()
  21859.                     ),
  21860.                     $statusCode,
  21861.                     $response->getHeaders(),
  21862.                     $response->getBody()
  21863.                 );
  21864.             }
  21865.             $responseBody $response->getBody();
  21866.             switch($statusCode) {
  21867.                 case 200:
  21868.                     if ('\SplFileObject' === '\SplFileObject') {
  21869.                         $content $responseBody//stream goes to serializer
  21870.                     } else {
  21871.                         $content $responseBody->getContents();
  21872.                     }
  21873.                     return [
  21874.                         AccountingObjectSerializer::deserialize($content'\SplFileObject', []),
  21875.                         $response->getStatusCode(),
  21876.                         $response->getHeaders()
  21877.                     ];
  21878.             }
  21879.             $returnType '\SplFileObject';
  21880.             $responseBody $response->getBody();
  21881.             if ($returnType === '\SplFileObject') {
  21882.                 $content $responseBody//stream goes to serializer
  21883.             } else {
  21884.                 $content $responseBody->getContents();
  21885.             }
  21886.             return [
  21887.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  21888.                 $response->getStatusCode(),
  21889.                 $response->getHeaders()
  21890.             ];
  21891.         } catch (ApiException $e) {
  21892.             switch ($e->getCode()) {
  21893.                 case 200:
  21894.                     $data AccountingObjectSerializer::deserialize(
  21895.                         $e->getResponseBody(),
  21896.                         '\SplFileObject',
  21897.                         $e->getResponseHeaders()
  21898.                     );
  21899.                     $e->setResponseObject($data);
  21900.                     break;
  21901.             }
  21902.             throw $e;
  21903.         }
  21904.     }
  21905.     /**
  21906.      * Operation getBankTransferAttachmentByIdAsync
  21907.      * Retrieves a specific attachment from a specific bank transfer using a unique attachment ID
  21908.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  21909.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  21910.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  21911.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  21912.      * @throws \InvalidArgumentException
  21913.      * @return \GuzzleHttp\Promise\PromiseInterface
  21914.      */
  21915.     public function getBankTransferAttachmentByIdAsync($xero_tenant_id$bank_transfer_id$attachment_id$content_type)
  21916.     {
  21917.         return $this->getBankTransferAttachmentByIdAsyncWithHttpInfo($xero_tenant_id$bank_transfer_id$attachment_id$content_type)
  21918.             ->then(
  21919.                 function ($response) {
  21920.                     return $response[0];
  21921.                 }
  21922.             );
  21923.     }
  21924.     /**
  21925.      * Operation getBankTransferAttachmentByIdAsyncWithHttpInfo
  21926.      * Retrieves a specific attachment from a specific bank transfer using a unique attachment ID
  21927.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  21928.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  21929.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  21930.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  21931.      * @throws \InvalidArgumentException
  21932.      * @return \GuzzleHttp\Promise\PromiseInterface */
  21933.     public function getBankTransferAttachmentByIdAsyncWithHttpInfo($xero_tenant_id$bank_transfer_id$attachment_id$content_type)
  21934.     {
  21935.         $returnType '\SplFileObject';
  21936.         $request $this->getBankTransferAttachmentByIdRequest($xero_tenant_id$bank_transfer_id$attachment_id$content_type);
  21937.         return $this->client
  21938.             ->sendAsync($request$this->createHttpClientOption())
  21939.             ->then(
  21940.                 function ($response) use ($returnType) {
  21941.                     $responseBody $response->getBody();
  21942.                     if ($returnType === '\SplFileObject') {
  21943.                         $content $responseBody//stream goes to serializer
  21944.                     } else {
  21945.                         $content $responseBody->getContents();
  21946.                     }
  21947.                     return [
  21948.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  21949.                         $response->getStatusCode(),
  21950.                         $response->getHeaders()
  21951.                     ];
  21952.                 },
  21953.                 function ($exception) {
  21954.                     $response $exception->getResponse();
  21955.                     $statusCode $response->getStatusCode();
  21956.                     throw new ApiException(
  21957.                         sprintf(
  21958.                             '[%d] Error connecting to the API (%s)',
  21959.                             $statusCode,
  21960.                             $exception->getRequest()->getUri()
  21961.                         ),
  21962.                         $statusCode,
  21963.                         $response->getHeaders(),
  21964.                         $response->getBody()
  21965.                     );
  21966.                 }
  21967.             );
  21968.     }
  21969.     /**
  21970.      * Create request for operation 'getBankTransferAttachmentById'
  21971.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  21972.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  21973.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  21974.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  21975.      * @throws \InvalidArgumentException
  21976.      * @return \GuzzleHttp\Psr7\Request  */
  21977.     protected function getBankTransferAttachmentByIdRequest($xero_tenant_id$bank_transfer_id$attachment_id$content_type)
  21978.     {
  21979.         // verify the required parameter 'xero_tenant_id' is set
  21980.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  21981.             throw new \InvalidArgumentException(
  21982.                 'Missing the required parameter $xero_tenant_id when calling getBankTransferAttachmentById'
  21983.             );
  21984.         }
  21985.         // verify the required parameter 'bank_transfer_id' is set
  21986.         if ($bank_transfer_id === null || (is_array($bank_transfer_id) && count($bank_transfer_id) === 0)) {
  21987.             throw new \InvalidArgumentException(
  21988.                 'Missing the required parameter $bank_transfer_id when calling getBankTransferAttachmentById'
  21989.             );
  21990.         }
  21991.         // verify the required parameter 'attachment_id' is set
  21992.         if ($attachment_id === null || (is_array($attachment_id) && count($attachment_id) === 0)) {
  21993.             throw new \InvalidArgumentException(
  21994.                 'Missing the required parameter $attachment_id when calling getBankTransferAttachmentById'
  21995.             );
  21996.         }
  21997.         // verify the required parameter 'content_type' is set
  21998.         if ($content_type === null || (is_array($content_type) && count($content_type) === 0)) {
  21999.             throw new \InvalidArgumentException(
  22000.                 'Missing the required parameter $content_type when calling getBankTransferAttachmentById'
  22001.             );
  22002.         }
  22003.         $resourcePath '/BankTransfers/{BankTransferID}/Attachments/{AttachmentID}';
  22004.         $formParams = [];
  22005.         $queryParams = [];
  22006.         $headerParams = [];
  22007.         $httpBody '';
  22008.         $multipart false;
  22009.         // header params
  22010.         if ($xero_tenant_id !== null) {
  22011.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  22012.         }
  22013.         // header params
  22014.         if ($content_type !== null) {
  22015.             $headerParams['contentType'] = AccountingObjectSerializer::toHeaderValue($content_type);
  22016.         }
  22017.         // path params
  22018.         if ($bank_transfer_id !== null) {
  22019.             $resourcePath str_replace(
  22020.                 '{' 'BankTransferID' '}',
  22021.                 AccountingObjectSerializer::toPathValue($bank_transfer_id),
  22022.                 $resourcePath
  22023.             );
  22024.         }
  22025.         // path params
  22026.         if ($attachment_id !== null) {
  22027.             $resourcePath str_replace(
  22028.                 '{' 'AttachmentID' '}',
  22029.                 AccountingObjectSerializer::toPathValue($attachment_id),
  22030.                 $resourcePath
  22031.             );
  22032.         }
  22033.         // body params
  22034.         $_tempBody null;
  22035.         if ($multipart) {
  22036.             $headers $this->headerSelector->selectHeadersForMultipart(
  22037.                 ['application/octet-stream']
  22038.             );
  22039.         } else {
  22040.             $headers $this->headerSelector->selectHeaders(
  22041.                 ['application/octet-stream'],
  22042.                 []
  22043.             );
  22044.         }
  22045.         // for model (json/xml)
  22046.         if (isset($_tempBody)) {
  22047.             // $_tempBody is the method argument, if present
  22048.             if ($headers['Content-Type'] === 'application/json') {
  22049.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  22050.             } else {
  22051.                 $httpBody $_tempBody;
  22052.             }
  22053.         } elseif (count($formParams) > 0) {
  22054.             if ($multipart) {
  22055.                 $multipartContents = [
  22056.                     [
  22057.                         'Content-type' => 'multipart/form-data',
  22058.                     ]
  22059.                 ];
  22060.                 
  22061.                 // for HTTP post (form)
  22062.                 $httpBody = new MultipartStream($multipartContents);
  22063.             } elseif ($headers['Content-Type'] === 'application/json') {
  22064.                 $httpBody \GuzzleHttp\json_encode($formParams);
  22065.             } else {
  22066.                 // for HTTP post (form)
  22067.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  22068.             }
  22069.         }
  22070.         // this endpoint requires OAuth (access token)
  22071.         if ($this->config->getAccessToken() !== null) {
  22072.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  22073.         }
  22074.         $defaultHeaders = [];
  22075.         if ($this->config->getUserAgent()) {
  22076.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  22077.         }
  22078.         $headers array_merge(
  22079.             $defaultHeaders,
  22080.             $headerParams,
  22081.             $headers
  22082.         );
  22083.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  22084.         return new Request(
  22085.             'GET',
  22086.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  22087.             $headers,
  22088.             $httpBody
  22089.         );
  22090.     }
  22091.     /**
  22092.      * Operation getBankTransferAttachments
  22093.      * Retrieves attachments from a specific bank transfer
  22094.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  22095.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  22096.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  22097.      * @throws \InvalidArgumentException
  22098.      * @return \XeroAPI\XeroPHP\Models\Accounting\Attachments
  22099.      */
  22100.     public function getBankTransferAttachments($xero_tenant_id$bank_transfer_id)
  22101.     {
  22102.         list($response) = $this->getBankTransferAttachmentsWithHttpInfo($xero_tenant_id$bank_transfer_id);
  22103.         return $response;
  22104.     }
  22105.     /**
  22106.      * Operation getBankTransferAttachmentsWithHttpInfo
  22107.      * Retrieves attachments from a specific bank transfer
  22108.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  22109.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  22110.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  22111.      * @throws \InvalidArgumentException
  22112.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Attachments, HTTP status code, HTTP response headers (array of strings)
  22113.      */
  22114.     public function getBankTransferAttachmentsWithHttpInfo($xero_tenant_id$bank_transfer_id)
  22115.     {
  22116.         $request $this->getBankTransferAttachmentsRequest($xero_tenant_id$bank_transfer_id);
  22117.         try {
  22118.             $options $this->createHttpClientOption();
  22119.             try {
  22120.                 $response $this->client->send($request$options);
  22121.             } catch (RequestException $e) {
  22122.                 throw new ApiException(
  22123.                     "[{$e->getCode()}{$e->getMessage()}",
  22124.                     $e->getCode(),
  22125.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  22126.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  22127.                 );
  22128.             }
  22129.             $statusCode $response->getStatusCode();
  22130.             if ($statusCode 200 || $statusCode 299) {
  22131.                 throw new ApiException(
  22132.                     sprintf(
  22133.                         '[%d] Error connecting to the API (%s)',
  22134.                         $statusCode,
  22135.                         $request->getUri()
  22136.                     ),
  22137.                     $statusCode,
  22138.                     $response->getHeaders(),
  22139.                     $response->getBody()
  22140.                 );
  22141.             }
  22142.             $responseBody $response->getBody();
  22143.             switch($statusCode) {
  22144.                 case 200:
  22145.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Attachments' === '\SplFileObject') {
  22146.                         $content $responseBody//stream goes to serializer
  22147.                     } else {
  22148.                         $content $responseBody->getContents();
  22149.                     }
  22150.                     return [
  22151.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Attachments', []),
  22152.                         $response->getStatusCode(),
  22153.                         $response->getHeaders()
  22154.                     ];
  22155.             }
  22156.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  22157.             $responseBody $response->getBody();
  22158.             if ($returnType === '\SplFileObject') {
  22159.                 $content $responseBody//stream goes to serializer
  22160.             } else {
  22161.                 $content $responseBody->getContents();
  22162.             }
  22163.             return [
  22164.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  22165.                 $response->getStatusCode(),
  22166.                 $response->getHeaders()
  22167.             ];
  22168.         } catch (ApiException $e) {
  22169.             switch ($e->getCode()) {
  22170.                 case 200:
  22171.                     $data AccountingObjectSerializer::deserialize(
  22172.                         $e->getResponseBody(),
  22173.                         '\XeroAPI\XeroPHP\Models\Accounting\Attachments',
  22174.                         $e->getResponseHeaders()
  22175.                     );
  22176.                     $e->setResponseObject($data);
  22177.                     break;
  22178.             }
  22179.             throw $e;
  22180.         }
  22181.     }
  22182.     /**
  22183.      * Operation getBankTransferAttachmentsAsync
  22184.      * Retrieves attachments from a specific bank transfer
  22185.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  22186.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  22187.      * @throws \InvalidArgumentException
  22188.      * @return \GuzzleHttp\Promise\PromiseInterface
  22189.      */
  22190.     public function getBankTransferAttachmentsAsync($xero_tenant_id$bank_transfer_id)
  22191.     {
  22192.         return $this->getBankTransferAttachmentsAsyncWithHttpInfo($xero_tenant_id$bank_transfer_id)
  22193.             ->then(
  22194.                 function ($response) {
  22195.                     return $response[0];
  22196.                 }
  22197.             );
  22198.     }
  22199.     /**
  22200.      * Operation getBankTransferAttachmentsAsyncWithHttpInfo
  22201.      * Retrieves attachments from a specific bank transfer
  22202.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  22203.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  22204.      * @throws \InvalidArgumentException
  22205.      * @return \GuzzleHttp\Promise\PromiseInterface */
  22206.     public function getBankTransferAttachmentsAsyncWithHttpInfo($xero_tenant_id$bank_transfer_id)
  22207.     {
  22208.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  22209.         $request $this->getBankTransferAttachmentsRequest($xero_tenant_id$bank_transfer_id);
  22210.         return $this->client
  22211.             ->sendAsync($request$this->createHttpClientOption())
  22212.             ->then(
  22213.                 function ($response) use ($returnType) {
  22214.                     $responseBody $response->getBody();
  22215.                     if ($returnType === '\SplFileObject') {
  22216.                         $content $responseBody//stream goes to serializer
  22217.                     } else {
  22218.                         $content $responseBody->getContents();
  22219.                     }
  22220.                     return [
  22221.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  22222.                         $response->getStatusCode(),
  22223.                         $response->getHeaders()
  22224.                     ];
  22225.                 },
  22226.                 function ($exception) {
  22227.                     $response $exception->getResponse();
  22228.                     $statusCode $response->getStatusCode();
  22229.                     throw new ApiException(
  22230.                         sprintf(
  22231.                             '[%d] Error connecting to the API (%s)',
  22232.                             $statusCode,
  22233.                             $exception->getRequest()->getUri()
  22234.                         ),
  22235.                         $statusCode,
  22236.                         $response->getHeaders(),
  22237.                         $response->getBody()
  22238.                     );
  22239.                 }
  22240.             );
  22241.     }
  22242.     /**
  22243.      * Create request for operation 'getBankTransferAttachments'
  22244.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  22245.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  22246.      * @throws \InvalidArgumentException
  22247.      * @return \GuzzleHttp\Psr7\Request  */
  22248.     protected function getBankTransferAttachmentsRequest($xero_tenant_id$bank_transfer_id)
  22249.     {
  22250.         // verify the required parameter 'xero_tenant_id' is set
  22251.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  22252.             throw new \InvalidArgumentException(
  22253.                 'Missing the required parameter $xero_tenant_id when calling getBankTransferAttachments'
  22254.             );
  22255.         }
  22256.         // verify the required parameter 'bank_transfer_id' is set
  22257.         if ($bank_transfer_id === null || (is_array($bank_transfer_id) && count($bank_transfer_id) === 0)) {
  22258.             throw new \InvalidArgumentException(
  22259.                 'Missing the required parameter $bank_transfer_id when calling getBankTransferAttachments'
  22260.             );
  22261.         }
  22262.         $resourcePath '/BankTransfers/{BankTransferID}/Attachments';
  22263.         $formParams = [];
  22264.         $queryParams = [];
  22265.         $headerParams = [];
  22266.         $httpBody '';
  22267.         $multipart false;
  22268.         // header params
  22269.         if ($xero_tenant_id !== null) {
  22270.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  22271.         }
  22272.         // path params
  22273.         if ($bank_transfer_id !== null) {
  22274.             $resourcePath str_replace(
  22275.                 '{' 'BankTransferID' '}',
  22276.                 AccountingObjectSerializer::toPathValue($bank_transfer_id),
  22277.                 $resourcePath
  22278.             );
  22279.         }
  22280.         // body params
  22281.         $_tempBody null;
  22282.         if ($multipart) {
  22283.             $headers $this->headerSelector->selectHeadersForMultipart(
  22284.                 ['application/json']
  22285.             );
  22286.         } else {
  22287.             $headers $this->headerSelector->selectHeaders(
  22288.                 ['application/json'],
  22289.                 []
  22290.             );
  22291.         }
  22292.         // for model (json/xml)
  22293.         if (isset($_tempBody)) {
  22294.             // $_tempBody is the method argument, if present
  22295.             if ($headers['Content-Type'] === 'application/json') {
  22296.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  22297.             } else {
  22298.                 $httpBody $_tempBody;
  22299.             }
  22300.         } elseif (count($formParams) > 0) {
  22301.             if ($multipart) {
  22302.                 $multipartContents = [
  22303.                     [
  22304.                         'Content-type' => 'multipart/form-data',
  22305.                     ]
  22306.                 ];
  22307.                 
  22308.                 // for HTTP post (form)
  22309.                 $httpBody = new MultipartStream($multipartContents);
  22310.             } elseif ($headers['Content-Type'] === 'application/json') {
  22311.                 $httpBody \GuzzleHttp\json_encode($formParams);
  22312.             } else {
  22313.                 // for HTTP post (form)
  22314.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  22315.             }
  22316.         }
  22317.         // this endpoint requires OAuth (access token)
  22318.         if ($this->config->getAccessToken() !== null) {
  22319.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  22320.         }
  22321.         $defaultHeaders = [];
  22322.         if ($this->config->getUserAgent()) {
  22323.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  22324.         }
  22325.         $headers array_merge(
  22326.             $defaultHeaders,
  22327.             $headerParams,
  22328.             $headers
  22329.         );
  22330.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  22331.         return new Request(
  22332.             'GET',
  22333.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  22334.             $headers,
  22335.             $httpBody
  22336.         );
  22337.     }
  22338.     /**
  22339.      * Operation getBankTransferHistory
  22340.      * Retrieves history from a specific bank transfer using a unique bank transfer Id
  22341.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  22342.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  22343.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  22344.      * @throws \InvalidArgumentException
  22345.      * @return \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords
  22346.      */
  22347.     public function getBankTransferHistory($xero_tenant_id$bank_transfer_id)
  22348.     {
  22349.         list($response) = $this->getBankTransferHistoryWithHttpInfo($xero_tenant_id$bank_transfer_id);
  22350.         return $response;
  22351.     }
  22352.     /**
  22353.      * Operation getBankTransferHistoryWithHttpInfo
  22354.      * Retrieves history from a specific bank transfer using a unique bank transfer Id
  22355.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  22356.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  22357.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  22358.      * @throws \InvalidArgumentException
  22359.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords, HTTP status code, HTTP response headers (array of strings)
  22360.      */
  22361.     public function getBankTransferHistoryWithHttpInfo($xero_tenant_id$bank_transfer_id)
  22362.     {
  22363.         $request $this->getBankTransferHistoryRequest($xero_tenant_id$bank_transfer_id);
  22364.         try {
  22365.             $options $this->createHttpClientOption();
  22366.             try {
  22367.                 $response $this->client->send($request$options);
  22368.             } catch (RequestException $e) {
  22369.                 throw new ApiException(
  22370.                     "[{$e->getCode()}{$e->getMessage()}",
  22371.                     $e->getCode(),
  22372.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  22373.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  22374.                 );
  22375.             }
  22376.             $statusCode $response->getStatusCode();
  22377.             if ($statusCode 200 || $statusCode 299) {
  22378.                 throw new ApiException(
  22379.                     sprintf(
  22380.                         '[%d] Error connecting to the API (%s)',
  22381.                         $statusCode,
  22382.                         $request->getUri()
  22383.                     ),
  22384.                     $statusCode,
  22385.                     $response->getHeaders(),
  22386.                     $response->getBody()
  22387.                 );
  22388.             }
  22389.             $responseBody $response->getBody();
  22390.             switch($statusCode) {
  22391.                 case 200:
  22392.                     if ('\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords' === '\SplFileObject') {
  22393.                         $content $responseBody//stream goes to serializer
  22394.                     } else {
  22395.                         $content $responseBody->getContents();
  22396.                     }
  22397.                     return [
  22398.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords', []),
  22399.                         $response->getStatusCode(),
  22400.                         $response->getHeaders()
  22401.                     ];
  22402.             }
  22403.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  22404.             $responseBody $response->getBody();
  22405.             if ($returnType === '\SplFileObject') {
  22406.                 $content $responseBody//stream goes to serializer
  22407.             } else {
  22408.                 $content $responseBody->getContents();
  22409.             }
  22410.             return [
  22411.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  22412.                 $response->getStatusCode(),
  22413.                 $response->getHeaders()
  22414.             ];
  22415.         } catch (ApiException $e) {
  22416.             switch ($e->getCode()) {
  22417.                 case 200:
  22418.                     $data AccountingObjectSerializer::deserialize(
  22419.                         $e->getResponseBody(),
  22420.                         '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords',
  22421.                         $e->getResponseHeaders()
  22422.                     );
  22423.                     $e->setResponseObject($data);
  22424.                     break;
  22425.             }
  22426.             throw $e;
  22427.         }
  22428.     }
  22429.     /**
  22430.      * Operation getBankTransferHistoryAsync
  22431.      * Retrieves history from a specific bank transfer using a unique bank transfer Id
  22432.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  22433.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  22434.      * @throws \InvalidArgumentException
  22435.      * @return \GuzzleHttp\Promise\PromiseInterface
  22436.      */
  22437.     public function getBankTransferHistoryAsync($xero_tenant_id$bank_transfer_id)
  22438.     {
  22439.         return $this->getBankTransferHistoryAsyncWithHttpInfo($xero_tenant_id$bank_transfer_id)
  22440.             ->then(
  22441.                 function ($response) {
  22442.                     return $response[0];
  22443.                 }
  22444.             );
  22445.     }
  22446.     /**
  22447.      * Operation getBankTransferHistoryAsyncWithHttpInfo
  22448.      * Retrieves history from a specific bank transfer using a unique bank transfer Id
  22449.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  22450.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  22451.      * @throws \InvalidArgumentException
  22452.      * @return \GuzzleHttp\Promise\PromiseInterface */
  22453.     public function getBankTransferHistoryAsyncWithHttpInfo($xero_tenant_id$bank_transfer_id)
  22454.     {
  22455.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  22456.         $request $this->getBankTransferHistoryRequest($xero_tenant_id$bank_transfer_id);
  22457.         return $this->client
  22458.             ->sendAsync($request$this->createHttpClientOption())
  22459.             ->then(
  22460.                 function ($response) use ($returnType) {
  22461.                     $responseBody $response->getBody();
  22462.                     if ($returnType === '\SplFileObject') {
  22463.                         $content $responseBody//stream goes to serializer
  22464.                     } else {
  22465.                         $content $responseBody->getContents();
  22466.                     }
  22467.                     return [
  22468.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  22469.                         $response->getStatusCode(),
  22470.                         $response->getHeaders()
  22471.                     ];
  22472.                 },
  22473.                 function ($exception) {
  22474.                     $response $exception->getResponse();
  22475.                     $statusCode $response->getStatusCode();
  22476.                     throw new ApiException(
  22477.                         sprintf(
  22478.                             '[%d] Error connecting to the API (%s)',
  22479.                             $statusCode,
  22480.                             $exception->getRequest()->getUri()
  22481.                         ),
  22482.                         $statusCode,
  22483.                         $response->getHeaders(),
  22484.                         $response->getBody()
  22485.                     );
  22486.                 }
  22487.             );
  22488.     }
  22489.     /**
  22490.      * Create request for operation 'getBankTransferHistory'
  22491.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  22492.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  22493.      * @throws \InvalidArgumentException
  22494.      * @return \GuzzleHttp\Psr7\Request  */
  22495.     protected function getBankTransferHistoryRequest($xero_tenant_id$bank_transfer_id)
  22496.     {
  22497.         // verify the required parameter 'xero_tenant_id' is set
  22498.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  22499.             throw new \InvalidArgumentException(
  22500.                 'Missing the required parameter $xero_tenant_id when calling getBankTransferHistory'
  22501.             );
  22502.         }
  22503.         // verify the required parameter 'bank_transfer_id' is set
  22504.         if ($bank_transfer_id === null || (is_array($bank_transfer_id) && count($bank_transfer_id) === 0)) {
  22505.             throw new \InvalidArgumentException(
  22506.                 'Missing the required parameter $bank_transfer_id when calling getBankTransferHistory'
  22507.             );
  22508.         }
  22509.         $resourcePath '/BankTransfers/{BankTransferID}/History';
  22510.         $formParams = [];
  22511.         $queryParams = [];
  22512.         $headerParams = [];
  22513.         $httpBody '';
  22514.         $multipart false;
  22515.         // header params
  22516.         if ($xero_tenant_id !== null) {
  22517.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  22518.         }
  22519.         // path params
  22520.         if ($bank_transfer_id !== null) {
  22521.             $resourcePath str_replace(
  22522.                 '{' 'BankTransferID' '}',
  22523.                 AccountingObjectSerializer::toPathValue($bank_transfer_id),
  22524.                 $resourcePath
  22525.             );
  22526.         }
  22527.         // body params
  22528.         $_tempBody null;
  22529.         if ($multipart) {
  22530.             $headers $this->headerSelector->selectHeadersForMultipart(
  22531.                 ['application/json']
  22532.             );
  22533.         } else {
  22534.             $headers $this->headerSelector->selectHeaders(
  22535.                 ['application/json'],
  22536.                 []
  22537.             );
  22538.         }
  22539.         // for model (json/xml)
  22540.         if (isset($_tempBody)) {
  22541.             // $_tempBody is the method argument, if present
  22542.             if ($headers['Content-Type'] === 'application/json') {
  22543.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  22544.             } else {
  22545.                 $httpBody $_tempBody;
  22546.             }
  22547.         } elseif (count($formParams) > 0) {
  22548.             if ($multipart) {
  22549.                 $multipartContents = [
  22550.                     [
  22551.                         'Content-type' => 'multipart/form-data',
  22552.                     ]
  22553.                 ];
  22554.                 
  22555.                 // for HTTP post (form)
  22556.                 $httpBody = new MultipartStream($multipartContents);
  22557.             } elseif ($headers['Content-Type'] === 'application/json') {
  22558.                 $httpBody \GuzzleHttp\json_encode($formParams);
  22559.             } else {
  22560.                 // for HTTP post (form)
  22561.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  22562.             }
  22563.         }
  22564.         // this endpoint requires OAuth (access token)
  22565.         if ($this->config->getAccessToken() !== null) {
  22566.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  22567.         }
  22568.         $defaultHeaders = [];
  22569.         if ($this->config->getUserAgent()) {
  22570.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  22571.         }
  22572.         $headers array_merge(
  22573.             $defaultHeaders,
  22574.             $headerParams,
  22575.             $headers
  22576.         );
  22577.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  22578.         return new Request(
  22579.             'GET',
  22580.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  22581.             $headers,
  22582.             $httpBody
  22583.         );
  22584.     }
  22585.     /**
  22586.      * Operation getBankTransfers
  22587.      * Retrieves all bank transfers
  22588.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  22589.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  22590.      * @param  string $where Filter by an any element (optional)
  22591.      * @param  string $order Order by an any element (optional)
  22592.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  22593.      * @throws \InvalidArgumentException
  22594.      * @return \XeroAPI\XeroPHP\Models\Accounting\BankTransfers
  22595.      */
  22596.     public function getBankTransfers($xero_tenant_id$if_modified_since null$where null$order null)
  22597.     {
  22598.         list($response) = $this->getBankTransfersWithHttpInfo($xero_tenant_id$if_modified_since$where$order);
  22599.         return $response;
  22600.     }
  22601.     /**
  22602.      * Operation getBankTransfersWithHttpInfo
  22603.      * Retrieves all bank transfers
  22604.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  22605.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  22606.      * @param  string $where Filter by an any element (optional)
  22607.      * @param  string $order Order by an any element (optional)
  22608.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  22609.      * @throws \InvalidArgumentException
  22610.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\BankTransfers, HTTP status code, HTTP response headers (array of strings)
  22611.      */
  22612.     public function getBankTransfersWithHttpInfo($xero_tenant_id$if_modified_since null$where null$order null)
  22613.     {
  22614.         $request $this->getBankTransfersRequest($xero_tenant_id$if_modified_since$where$order);
  22615.         try {
  22616.             $options $this->createHttpClientOption();
  22617.             try {
  22618.                 $response $this->client->send($request$options);
  22619.             } catch (RequestException $e) {
  22620.                 throw new ApiException(
  22621.                     "[{$e->getCode()}{$e->getMessage()}",
  22622.                     $e->getCode(),
  22623.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  22624.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  22625.                 );
  22626.             }
  22627.             $statusCode $response->getStatusCode();
  22628.             if ($statusCode 200 || $statusCode 299) {
  22629.                 throw new ApiException(
  22630.                     sprintf(
  22631.                         '[%d] Error connecting to the API (%s)',
  22632.                         $statusCode,
  22633.                         $request->getUri()
  22634.                     ),
  22635.                     $statusCode,
  22636.                     $response->getHeaders(),
  22637.                     $response->getBody()
  22638.                 );
  22639.             }
  22640.             $responseBody $response->getBody();
  22641.             switch($statusCode) {
  22642.                 case 200:
  22643.                     if ('\XeroAPI\XeroPHP\Models\Accounting\BankTransfers' === '\SplFileObject') {
  22644.                         $content $responseBody//stream goes to serializer
  22645.                     } else {
  22646.                         $content $responseBody->getContents();
  22647.                     }
  22648.                     return [
  22649.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\BankTransfers', []),
  22650.                         $response->getStatusCode(),
  22651.                         $response->getHeaders()
  22652.                     ];
  22653.             }
  22654.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\BankTransfers';
  22655.             $responseBody $response->getBody();
  22656.             if ($returnType === '\SplFileObject') {
  22657.                 $content $responseBody//stream goes to serializer
  22658.             } else {
  22659.                 $content $responseBody->getContents();
  22660.             }
  22661.             return [
  22662.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  22663.                 $response->getStatusCode(),
  22664.                 $response->getHeaders()
  22665.             ];
  22666.         } catch (ApiException $e) {
  22667.             switch ($e->getCode()) {
  22668.                 case 200:
  22669.                     $data AccountingObjectSerializer::deserialize(
  22670.                         $e->getResponseBody(),
  22671.                         '\XeroAPI\XeroPHP\Models\Accounting\BankTransfers',
  22672.                         $e->getResponseHeaders()
  22673.                     );
  22674.                     $e->setResponseObject($data);
  22675.                     break;
  22676.             }
  22677.             throw $e;
  22678.         }
  22679.     }
  22680.     /**
  22681.      * Operation getBankTransfersAsync
  22682.      * Retrieves all bank transfers
  22683.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  22684.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  22685.      * @param  string $where Filter by an any element (optional)
  22686.      * @param  string $order Order by an any element (optional)
  22687.      * @throws \InvalidArgumentException
  22688.      * @return \GuzzleHttp\Promise\PromiseInterface
  22689.      */
  22690.     public function getBankTransfersAsync($xero_tenant_id$if_modified_since null$where null$order null)
  22691.     {
  22692.         return $this->getBankTransfersAsyncWithHttpInfo($xero_tenant_id$if_modified_since$where$order)
  22693.             ->then(
  22694.                 function ($response) {
  22695.                     return $response[0];
  22696.                 }
  22697.             );
  22698.     }
  22699.     /**
  22700.      * Operation getBankTransfersAsyncWithHttpInfo
  22701.      * Retrieves all bank transfers
  22702.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  22703.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  22704.      * @param  string $where Filter by an any element (optional)
  22705.      * @param  string $order Order by an any element (optional)
  22706.      * @throws \InvalidArgumentException
  22707.      * @return \GuzzleHttp\Promise\PromiseInterface */
  22708.     public function getBankTransfersAsyncWithHttpInfo($xero_tenant_id$if_modified_since null$where null$order null)
  22709.     {
  22710.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\BankTransfers';
  22711.         $request $this->getBankTransfersRequest($xero_tenant_id$if_modified_since$where$order);
  22712.         return $this->client
  22713.             ->sendAsync($request$this->createHttpClientOption())
  22714.             ->then(
  22715.                 function ($response) use ($returnType) {
  22716.                     $responseBody $response->getBody();
  22717.                     if ($returnType === '\SplFileObject') {
  22718.                         $content $responseBody//stream goes to serializer
  22719.                     } else {
  22720.                         $content $responseBody->getContents();
  22721.                     }
  22722.                     return [
  22723.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  22724.                         $response->getStatusCode(),
  22725.                         $response->getHeaders()
  22726.                     ];
  22727.                 },
  22728.                 function ($exception) {
  22729.                     $response $exception->getResponse();
  22730.                     $statusCode $response->getStatusCode();
  22731.                     throw new ApiException(
  22732.                         sprintf(
  22733.                             '[%d] Error connecting to the API (%s)',
  22734.                             $statusCode,
  22735.                             $exception->getRequest()->getUri()
  22736.                         ),
  22737.                         $statusCode,
  22738.                         $response->getHeaders(),
  22739.                         $response->getBody()
  22740.                     );
  22741.                 }
  22742.             );
  22743.     }
  22744.     /**
  22745.      * Create request for operation 'getBankTransfers'
  22746.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  22747.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  22748.      * @param  string $where Filter by an any element (optional)
  22749.      * @param  string $order Order by an any element (optional)
  22750.      * @throws \InvalidArgumentException
  22751.      * @return \GuzzleHttp\Psr7\Request  */
  22752.     protected function getBankTransfersRequest($xero_tenant_id$if_modified_since null$where null$order null)
  22753.     {
  22754.         // verify the required parameter 'xero_tenant_id' is set
  22755.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  22756.             throw new \InvalidArgumentException(
  22757.                 'Missing the required parameter $xero_tenant_id when calling getBankTransfers'
  22758.             );
  22759.         }
  22760.         $resourcePath '/BankTransfers';
  22761.         $formParams = [];
  22762.         $queryParams = [];
  22763.         $headerParams = [];
  22764.         $httpBody '';
  22765.         $multipart false;
  22766.         // query params
  22767.         if ($where !== null) {
  22768.             $queryParams['where'] = AccountingObjectSerializer::toQueryValue($where);
  22769.         }
  22770.         // query params
  22771.         if ($order !== null) {
  22772.             $queryParams['order'] = AccountingObjectSerializer::toQueryValue($order);
  22773.         }
  22774.         // header params
  22775.         if ($xero_tenant_id !== null) {
  22776.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  22777.         }
  22778.         // header params
  22779.         if ($if_modified_since !== null) {
  22780.             $headerParams['If-Modified-Since'] = AccountingObjectSerializer::toHeaderValue($if_modified_since);
  22781.         }
  22782.         // body params
  22783.         $_tempBody null;
  22784.         if ($multipart) {
  22785.             $headers $this->headerSelector->selectHeadersForMultipart(
  22786.                 ['application/json']
  22787.             );
  22788.         } else {
  22789.             $headers $this->headerSelector->selectHeaders(
  22790.                 ['application/json'],
  22791.                 []
  22792.             );
  22793.         }
  22794.         // for model (json/xml)
  22795.         if (isset($_tempBody)) {
  22796.             // $_tempBody is the method argument, if present
  22797.             if ($headers['Content-Type'] === 'application/json') {
  22798.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  22799.             } else {
  22800.                 $httpBody $_tempBody;
  22801.             }
  22802.         } elseif (count($formParams) > 0) {
  22803.             if ($multipart) {
  22804.                 $multipartContents = [
  22805.                     [
  22806.                         'Content-type' => 'multipart/form-data',
  22807.                     ]
  22808.                 ];
  22809.                 
  22810.                 // for HTTP post (form)
  22811.                 $httpBody = new MultipartStream($multipartContents);
  22812.             } elseif ($headers['Content-Type'] === 'application/json') {
  22813.                 $httpBody \GuzzleHttp\json_encode($formParams);
  22814.             } else {
  22815.                 // for HTTP post (form)
  22816.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  22817.             }
  22818.         }
  22819.         // this endpoint requires OAuth (access token)
  22820.         if ($this->config->getAccessToken() !== null) {
  22821.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  22822.         }
  22823.         $defaultHeaders = [];
  22824.         if ($this->config->getUserAgent()) {
  22825.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  22826.         }
  22827.         $headers array_merge(
  22828.             $defaultHeaders,
  22829.             $headerParams,
  22830.             $headers
  22831.         );
  22832.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  22833.         return new Request(
  22834.             'GET',
  22835.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  22836.             $headers,
  22837.             $httpBody
  22838.         );
  22839.     }
  22840.     /**
  22841.      * Operation getBatchPayment
  22842.      * Retrieves a specific batch payment using a unique batch payment Id
  22843.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  22844.      * @param  string $batch_payment_id Unique identifier for BatchPayment (required)
  22845.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  22846.      * @throws \InvalidArgumentException
  22847.      * @return \XeroAPI\XeroPHP\Models\Accounting\BatchPayments
  22848.      */
  22849.     public function getBatchPayment($xero_tenant_id$batch_payment_id)
  22850.     {
  22851.         list($response) = $this->getBatchPaymentWithHttpInfo($xero_tenant_id$batch_payment_id);
  22852.         return $response;
  22853.     }
  22854.     /**
  22855.      * Operation getBatchPaymentWithHttpInfo
  22856.      * Retrieves a specific batch payment using a unique batch payment Id
  22857.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  22858.      * @param  string $batch_payment_id Unique identifier for BatchPayment (required)
  22859.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  22860.      * @throws \InvalidArgumentException
  22861.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\BatchPayments, HTTP status code, HTTP response headers (array of strings)
  22862.      */
  22863.     public function getBatchPaymentWithHttpInfo($xero_tenant_id$batch_payment_id)
  22864.     {
  22865.         $request $this->getBatchPaymentRequest($xero_tenant_id$batch_payment_id);
  22866.         try {
  22867.             $options $this->createHttpClientOption();
  22868.             try {
  22869.                 $response $this->client->send($request$options);
  22870.             } catch (RequestException $e) {
  22871.                 throw new ApiException(
  22872.                     "[{$e->getCode()}{$e->getMessage()}",
  22873.                     $e->getCode(),
  22874.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  22875.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  22876.                 );
  22877.             }
  22878.             $statusCode $response->getStatusCode();
  22879.             if ($statusCode 200 || $statusCode 299) {
  22880.                 throw new ApiException(
  22881.                     sprintf(
  22882.                         '[%d] Error connecting to the API (%s)',
  22883.                         $statusCode,
  22884.                         $request->getUri()
  22885.                     ),
  22886.                     $statusCode,
  22887.                     $response->getHeaders(),
  22888.                     $response->getBody()
  22889.                 );
  22890.             }
  22891.             $responseBody $response->getBody();
  22892.             switch($statusCode) {
  22893.                 case 200:
  22894.                     if ('\XeroAPI\XeroPHP\Models\Accounting\BatchPayments' === '\SplFileObject') {
  22895.                         $content $responseBody//stream goes to serializer
  22896.                     } else {
  22897.                         $content $responseBody->getContents();
  22898.                     }
  22899.                     return [
  22900.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\BatchPayments', []),
  22901.                         $response->getStatusCode(),
  22902.                         $response->getHeaders()
  22903.                     ];
  22904.             }
  22905.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\BatchPayments';
  22906.             $responseBody $response->getBody();
  22907.             if ($returnType === '\SplFileObject') {
  22908.                 $content $responseBody//stream goes to serializer
  22909.             } else {
  22910.                 $content $responseBody->getContents();
  22911.             }
  22912.             return [
  22913.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  22914.                 $response->getStatusCode(),
  22915.                 $response->getHeaders()
  22916.             ];
  22917.         } catch (ApiException $e) {
  22918.             switch ($e->getCode()) {
  22919.                 case 200:
  22920.                     $data AccountingObjectSerializer::deserialize(
  22921.                         $e->getResponseBody(),
  22922.                         '\XeroAPI\XeroPHP\Models\Accounting\BatchPayments',
  22923.                         $e->getResponseHeaders()
  22924.                     );
  22925.                     $e->setResponseObject($data);
  22926.                     break;
  22927.             }
  22928.             throw $e;
  22929.         }
  22930.     }
  22931.     /**
  22932.      * Operation getBatchPaymentAsync
  22933.      * Retrieves a specific batch payment using a unique batch payment Id
  22934.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  22935.      * @param  string $batch_payment_id Unique identifier for BatchPayment (required)
  22936.      * @throws \InvalidArgumentException
  22937.      * @return \GuzzleHttp\Promise\PromiseInterface
  22938.      */
  22939.     public function getBatchPaymentAsync($xero_tenant_id$batch_payment_id)
  22940.     {
  22941.         return $this->getBatchPaymentAsyncWithHttpInfo($xero_tenant_id$batch_payment_id)
  22942.             ->then(
  22943.                 function ($response) {
  22944.                     return $response[0];
  22945.                 }
  22946.             );
  22947.     }
  22948.     /**
  22949.      * Operation getBatchPaymentAsyncWithHttpInfo
  22950.      * Retrieves a specific batch payment using a unique batch payment Id
  22951.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  22952.      * @param  string $batch_payment_id Unique identifier for BatchPayment (required)
  22953.      * @throws \InvalidArgumentException
  22954.      * @return \GuzzleHttp\Promise\PromiseInterface */
  22955.     public function getBatchPaymentAsyncWithHttpInfo($xero_tenant_id$batch_payment_id)
  22956.     {
  22957.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\BatchPayments';
  22958.         $request $this->getBatchPaymentRequest($xero_tenant_id$batch_payment_id);
  22959.         return $this->client
  22960.             ->sendAsync($request$this->createHttpClientOption())
  22961.             ->then(
  22962.                 function ($response) use ($returnType) {
  22963.                     $responseBody $response->getBody();
  22964.                     if ($returnType === '\SplFileObject') {
  22965.                         $content $responseBody//stream goes to serializer
  22966.                     } else {
  22967.                         $content $responseBody->getContents();
  22968.                     }
  22969.                     return [
  22970.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  22971.                         $response->getStatusCode(),
  22972.                         $response->getHeaders()
  22973.                     ];
  22974.                 },
  22975.                 function ($exception) {
  22976.                     $response $exception->getResponse();
  22977.                     $statusCode $response->getStatusCode();
  22978.                     throw new ApiException(
  22979.                         sprintf(
  22980.                             '[%d] Error connecting to the API (%s)',
  22981.                             $statusCode,
  22982.                             $exception->getRequest()->getUri()
  22983.                         ),
  22984.                         $statusCode,
  22985.                         $response->getHeaders(),
  22986.                         $response->getBody()
  22987.                     );
  22988.                 }
  22989.             );
  22990.     }
  22991.     /**
  22992.      * Create request for operation 'getBatchPayment'
  22993.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  22994.      * @param  string $batch_payment_id Unique identifier for BatchPayment (required)
  22995.      * @throws \InvalidArgumentException
  22996.      * @return \GuzzleHttp\Psr7\Request  */
  22997.     protected function getBatchPaymentRequest($xero_tenant_id$batch_payment_id)
  22998.     {
  22999.         // verify the required parameter 'xero_tenant_id' is set
  23000.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  23001.             throw new \InvalidArgumentException(
  23002.                 'Missing the required parameter $xero_tenant_id when calling getBatchPayment'
  23003.             );
  23004.         }
  23005.         // verify the required parameter 'batch_payment_id' is set
  23006.         if ($batch_payment_id === null || (is_array($batch_payment_id) && count($batch_payment_id) === 0)) {
  23007.             throw new \InvalidArgumentException(
  23008.                 'Missing the required parameter $batch_payment_id when calling getBatchPayment'
  23009.             );
  23010.         }
  23011.         $resourcePath '/BatchPayments/{BatchPaymentID}';
  23012.         $formParams = [];
  23013.         $queryParams = [];
  23014.         $headerParams = [];
  23015.         $httpBody '';
  23016.         $multipart false;
  23017.         // header params
  23018.         if ($xero_tenant_id !== null) {
  23019.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  23020.         }
  23021.         // path params
  23022.         if ($batch_payment_id !== null) {
  23023.             $resourcePath str_replace(
  23024.                 '{' 'BatchPaymentID' '}',
  23025.                 AccountingObjectSerializer::toPathValue($batch_payment_id),
  23026.                 $resourcePath
  23027.             );
  23028.         }
  23029.         // body params
  23030.         $_tempBody null;
  23031.         if ($multipart) {
  23032.             $headers $this->headerSelector->selectHeadersForMultipart(
  23033.                 ['application/json']
  23034.             );
  23035.         } else {
  23036.             $headers $this->headerSelector->selectHeaders(
  23037.                 ['application/json'],
  23038.                 []
  23039.             );
  23040.         }
  23041.         // for model (json/xml)
  23042.         if (isset($_tempBody)) {
  23043.             // $_tempBody is the method argument, if present
  23044.             if ($headers['Content-Type'] === 'application/json') {
  23045.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  23046.             } else {
  23047.                 $httpBody $_tempBody;
  23048.             }
  23049.         } elseif (count($formParams) > 0) {
  23050.             if ($multipart) {
  23051.                 $multipartContents = [
  23052.                     [
  23053.                         'Content-type' => 'multipart/form-data',
  23054.                     ]
  23055.                 ];
  23056.                 
  23057.                 // for HTTP post (form)
  23058.                 $httpBody = new MultipartStream($multipartContents);
  23059.             } elseif ($headers['Content-Type'] === 'application/json') {
  23060.                 $httpBody \GuzzleHttp\json_encode($formParams);
  23061.             } else {
  23062.                 // for HTTP post (form)
  23063.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  23064.             }
  23065.         }
  23066.         // this endpoint requires OAuth (access token)
  23067.         if ($this->config->getAccessToken() !== null) {
  23068.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  23069.         }
  23070.         $defaultHeaders = [];
  23071.         if ($this->config->getUserAgent()) {
  23072.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  23073.         }
  23074.         $headers array_merge(
  23075.             $defaultHeaders,
  23076.             $headerParams,
  23077.             $headers
  23078.         );
  23079.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  23080.         return new Request(
  23081.             'GET',
  23082.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  23083.             $headers,
  23084.             $httpBody
  23085.         );
  23086.     }
  23087.     /**
  23088.      * Operation getBatchPaymentHistory
  23089.      * Retrieves history from a specific batch payment
  23090.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  23091.      * @param  string $batch_payment_id Unique identifier for BatchPayment (required)
  23092.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  23093.      * @throws \InvalidArgumentException
  23094.      * @return \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords
  23095.      */
  23096.     public function getBatchPaymentHistory($xero_tenant_id$batch_payment_id)
  23097.     {
  23098.         list($response) = $this->getBatchPaymentHistoryWithHttpInfo($xero_tenant_id$batch_payment_id);
  23099.         return $response;
  23100.     }
  23101.     /**
  23102.      * Operation getBatchPaymentHistoryWithHttpInfo
  23103.      * Retrieves history from a specific batch payment
  23104.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  23105.      * @param  string $batch_payment_id Unique identifier for BatchPayment (required)
  23106.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  23107.      * @throws \InvalidArgumentException
  23108.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords, HTTP status code, HTTP response headers (array of strings)
  23109.      */
  23110.     public function getBatchPaymentHistoryWithHttpInfo($xero_tenant_id$batch_payment_id)
  23111.     {
  23112.         $request $this->getBatchPaymentHistoryRequest($xero_tenant_id$batch_payment_id);
  23113.         try {
  23114.             $options $this->createHttpClientOption();
  23115.             try {
  23116.                 $response $this->client->send($request$options);
  23117.             } catch (RequestException $e) {
  23118.                 throw new ApiException(
  23119.                     "[{$e->getCode()}{$e->getMessage()}",
  23120.                     $e->getCode(),
  23121.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  23122.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  23123.                 );
  23124.             }
  23125.             $statusCode $response->getStatusCode();
  23126.             if ($statusCode 200 || $statusCode 299) {
  23127.                 throw new ApiException(
  23128.                     sprintf(
  23129.                         '[%d] Error connecting to the API (%s)',
  23130.                         $statusCode,
  23131.                         $request->getUri()
  23132.                     ),
  23133.                     $statusCode,
  23134.                     $response->getHeaders(),
  23135.                     $response->getBody()
  23136.                 );
  23137.             }
  23138.             $responseBody $response->getBody();
  23139.             switch($statusCode) {
  23140.                 case 200:
  23141.                     if ('\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords' === '\SplFileObject') {
  23142.                         $content $responseBody//stream goes to serializer
  23143.                     } else {
  23144.                         $content $responseBody->getContents();
  23145.                     }
  23146.                     return [
  23147.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords', []),
  23148.                         $response->getStatusCode(),
  23149.                         $response->getHeaders()
  23150.                     ];
  23151.             }
  23152.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  23153.             $responseBody $response->getBody();
  23154.             if ($returnType === '\SplFileObject') {
  23155.                 $content $responseBody//stream goes to serializer
  23156.             } else {
  23157.                 $content $responseBody->getContents();
  23158.             }
  23159.             return [
  23160.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  23161.                 $response->getStatusCode(),
  23162.                 $response->getHeaders()
  23163.             ];
  23164.         } catch (ApiException $e) {
  23165.             switch ($e->getCode()) {
  23166.                 case 200:
  23167.                     $data AccountingObjectSerializer::deserialize(
  23168.                         $e->getResponseBody(),
  23169.                         '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords',
  23170.                         $e->getResponseHeaders()
  23171.                     );
  23172.                     $e->setResponseObject($data);
  23173.                     break;
  23174.             }
  23175.             throw $e;
  23176.         }
  23177.     }
  23178.     /**
  23179.      * Operation getBatchPaymentHistoryAsync
  23180.      * Retrieves history from a specific batch payment
  23181.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  23182.      * @param  string $batch_payment_id Unique identifier for BatchPayment (required)
  23183.      * @throws \InvalidArgumentException
  23184.      * @return \GuzzleHttp\Promise\PromiseInterface
  23185.      */
  23186.     public function getBatchPaymentHistoryAsync($xero_tenant_id$batch_payment_id)
  23187.     {
  23188.         return $this->getBatchPaymentHistoryAsyncWithHttpInfo($xero_tenant_id$batch_payment_id)
  23189.             ->then(
  23190.                 function ($response) {
  23191.                     return $response[0];
  23192.                 }
  23193.             );
  23194.     }
  23195.     /**
  23196.      * Operation getBatchPaymentHistoryAsyncWithHttpInfo
  23197.      * Retrieves history from a specific batch payment
  23198.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  23199.      * @param  string $batch_payment_id Unique identifier for BatchPayment (required)
  23200.      * @throws \InvalidArgumentException
  23201.      * @return \GuzzleHttp\Promise\PromiseInterface */
  23202.     public function getBatchPaymentHistoryAsyncWithHttpInfo($xero_tenant_id$batch_payment_id)
  23203.     {
  23204.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  23205.         $request $this->getBatchPaymentHistoryRequest($xero_tenant_id$batch_payment_id);
  23206.         return $this->client
  23207.             ->sendAsync($request$this->createHttpClientOption())
  23208.             ->then(
  23209.                 function ($response) use ($returnType) {
  23210.                     $responseBody $response->getBody();
  23211.                     if ($returnType === '\SplFileObject') {
  23212.                         $content $responseBody//stream goes to serializer
  23213.                     } else {
  23214.                         $content $responseBody->getContents();
  23215.                     }
  23216.                     return [
  23217.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  23218.                         $response->getStatusCode(),
  23219.                         $response->getHeaders()
  23220.                     ];
  23221.                 },
  23222.                 function ($exception) {
  23223.                     $response $exception->getResponse();
  23224.                     $statusCode $response->getStatusCode();
  23225.                     throw new ApiException(
  23226.                         sprintf(
  23227.                             '[%d] Error connecting to the API (%s)',
  23228.                             $statusCode,
  23229.                             $exception->getRequest()->getUri()
  23230.                         ),
  23231.                         $statusCode,
  23232.                         $response->getHeaders(),
  23233.                         $response->getBody()
  23234.                     );
  23235.                 }
  23236.             );
  23237.     }
  23238.     /**
  23239.      * Create request for operation 'getBatchPaymentHistory'
  23240.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  23241.      * @param  string $batch_payment_id Unique identifier for BatchPayment (required)
  23242.      * @throws \InvalidArgumentException
  23243.      * @return \GuzzleHttp\Psr7\Request  */
  23244.     protected function getBatchPaymentHistoryRequest($xero_tenant_id$batch_payment_id)
  23245.     {
  23246.         // verify the required parameter 'xero_tenant_id' is set
  23247.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  23248.             throw new \InvalidArgumentException(
  23249.                 'Missing the required parameter $xero_tenant_id when calling getBatchPaymentHistory'
  23250.             );
  23251.         }
  23252.         // verify the required parameter 'batch_payment_id' is set
  23253.         if ($batch_payment_id === null || (is_array($batch_payment_id) && count($batch_payment_id) === 0)) {
  23254.             throw new \InvalidArgumentException(
  23255.                 'Missing the required parameter $batch_payment_id when calling getBatchPaymentHistory'
  23256.             );
  23257.         }
  23258.         $resourcePath '/BatchPayments/{BatchPaymentID}/History';
  23259.         $formParams = [];
  23260.         $queryParams = [];
  23261.         $headerParams = [];
  23262.         $httpBody '';
  23263.         $multipart false;
  23264.         // header params
  23265.         if ($xero_tenant_id !== null) {
  23266.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  23267.         }
  23268.         // path params
  23269.         if ($batch_payment_id !== null) {
  23270.             $resourcePath str_replace(
  23271.                 '{' 'BatchPaymentID' '}',
  23272.                 AccountingObjectSerializer::toPathValue($batch_payment_id),
  23273.                 $resourcePath
  23274.             );
  23275.         }
  23276.         // body params
  23277.         $_tempBody null;
  23278.         if ($multipart) {
  23279.             $headers $this->headerSelector->selectHeadersForMultipart(
  23280.                 ['application/json']
  23281.             );
  23282.         } else {
  23283.             $headers $this->headerSelector->selectHeaders(
  23284.                 ['application/json'],
  23285.                 []
  23286.             );
  23287.         }
  23288.         // for model (json/xml)
  23289.         if (isset($_tempBody)) {
  23290.             // $_tempBody is the method argument, if present
  23291.             if ($headers['Content-Type'] === 'application/json') {
  23292.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  23293.             } else {
  23294.                 $httpBody $_tempBody;
  23295.             }
  23296.         } elseif (count($formParams) > 0) {
  23297.             if ($multipart) {
  23298.                 $multipartContents = [
  23299.                     [
  23300.                         'Content-type' => 'multipart/form-data',
  23301.                     ]
  23302.                 ];
  23303.                 
  23304.                 // for HTTP post (form)
  23305.                 $httpBody = new MultipartStream($multipartContents);
  23306.             } elseif ($headers['Content-Type'] === 'application/json') {
  23307.                 $httpBody \GuzzleHttp\json_encode($formParams);
  23308.             } else {
  23309.                 // for HTTP post (form)
  23310.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  23311.             }
  23312.         }
  23313.         // this endpoint requires OAuth (access token)
  23314.         if ($this->config->getAccessToken() !== null) {
  23315.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  23316.         }
  23317.         $defaultHeaders = [];
  23318.         if ($this->config->getUserAgent()) {
  23319.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  23320.         }
  23321.         $headers array_merge(
  23322.             $defaultHeaders,
  23323.             $headerParams,
  23324.             $headers
  23325.         );
  23326.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  23327.         return new Request(
  23328.             'GET',
  23329.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  23330.             $headers,
  23331.             $httpBody
  23332.         );
  23333.     }
  23334.     /**
  23335.      * Operation getBatchPayments
  23336.      * Retrieves either one or many batch payments for invoices
  23337.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  23338.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  23339.      * @param  string $where Filter by an any element (optional)
  23340.      * @param  string $order Order by an any element (optional)
  23341.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  23342.      * @throws \InvalidArgumentException
  23343.      * @return \XeroAPI\XeroPHP\Models\Accounting\BatchPayments
  23344.      */
  23345.     public function getBatchPayments($xero_tenant_id$if_modified_since null$where null$order null)
  23346.     {
  23347.         list($response) = $this->getBatchPaymentsWithHttpInfo($xero_tenant_id$if_modified_since$where$order);
  23348.         return $response;
  23349.     }
  23350.     /**
  23351.      * Operation getBatchPaymentsWithHttpInfo
  23352.      * Retrieves either one or many batch payments for invoices
  23353.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  23354.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  23355.      * @param  string $where Filter by an any element (optional)
  23356.      * @param  string $order Order by an any element (optional)
  23357.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  23358.      * @throws \InvalidArgumentException
  23359.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\BatchPayments, HTTP status code, HTTP response headers (array of strings)
  23360.      */
  23361.     public function getBatchPaymentsWithHttpInfo($xero_tenant_id$if_modified_since null$where null$order null)
  23362.     {
  23363.         $request $this->getBatchPaymentsRequest($xero_tenant_id$if_modified_since$where$order);
  23364.         try {
  23365.             $options $this->createHttpClientOption();
  23366.             try {
  23367.                 $response $this->client->send($request$options);
  23368.             } catch (RequestException $e) {
  23369.                 throw new ApiException(
  23370.                     "[{$e->getCode()}{$e->getMessage()}",
  23371.                     $e->getCode(),
  23372.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  23373.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  23374.                 );
  23375.             }
  23376.             $statusCode $response->getStatusCode();
  23377.             if ($statusCode 200 || $statusCode 299) {
  23378.                 throw new ApiException(
  23379.                     sprintf(
  23380.                         '[%d] Error connecting to the API (%s)',
  23381.                         $statusCode,
  23382.                         $request->getUri()
  23383.                     ),
  23384.                     $statusCode,
  23385.                     $response->getHeaders(),
  23386.                     $response->getBody()
  23387.                 );
  23388.             }
  23389.             $responseBody $response->getBody();
  23390.             switch($statusCode) {
  23391.                 case 200:
  23392.                     if ('\XeroAPI\XeroPHP\Models\Accounting\BatchPayments' === '\SplFileObject') {
  23393.                         $content $responseBody//stream goes to serializer
  23394.                     } else {
  23395.                         $content $responseBody->getContents();
  23396.                     }
  23397.                     return [
  23398.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\BatchPayments', []),
  23399.                         $response->getStatusCode(),
  23400.                         $response->getHeaders()
  23401.                     ];
  23402.             }
  23403.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\BatchPayments';
  23404.             $responseBody $response->getBody();
  23405.             if ($returnType === '\SplFileObject') {
  23406.                 $content $responseBody//stream goes to serializer
  23407.             } else {
  23408.                 $content $responseBody->getContents();
  23409.             }
  23410.             return [
  23411.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  23412.                 $response->getStatusCode(),
  23413.                 $response->getHeaders()
  23414.             ];
  23415.         } catch (ApiException $e) {
  23416.             switch ($e->getCode()) {
  23417.                 case 200:
  23418.                     $data AccountingObjectSerializer::deserialize(
  23419.                         $e->getResponseBody(),
  23420.                         '\XeroAPI\XeroPHP\Models\Accounting\BatchPayments',
  23421.                         $e->getResponseHeaders()
  23422.                     );
  23423.                     $e->setResponseObject($data);
  23424.                     break;
  23425.             }
  23426.             throw $e;
  23427.         }
  23428.     }
  23429.     /**
  23430.      * Operation getBatchPaymentsAsync
  23431.      * Retrieves either one or many batch payments for invoices
  23432.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  23433.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  23434.      * @param  string $where Filter by an any element (optional)
  23435.      * @param  string $order Order by an any element (optional)
  23436.      * @throws \InvalidArgumentException
  23437.      * @return \GuzzleHttp\Promise\PromiseInterface
  23438.      */
  23439.     public function getBatchPaymentsAsync($xero_tenant_id$if_modified_since null$where null$order null)
  23440.     {
  23441.         return $this->getBatchPaymentsAsyncWithHttpInfo($xero_tenant_id$if_modified_since$where$order)
  23442.             ->then(
  23443.                 function ($response) {
  23444.                     return $response[0];
  23445.                 }
  23446.             );
  23447.     }
  23448.     /**
  23449.      * Operation getBatchPaymentsAsyncWithHttpInfo
  23450.      * Retrieves either one or many batch payments for invoices
  23451.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  23452.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  23453.      * @param  string $where Filter by an any element (optional)
  23454.      * @param  string $order Order by an any element (optional)
  23455.      * @throws \InvalidArgumentException
  23456.      * @return \GuzzleHttp\Promise\PromiseInterface */
  23457.     public function getBatchPaymentsAsyncWithHttpInfo($xero_tenant_id$if_modified_since null$where null$order null)
  23458.     {
  23459.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\BatchPayments';
  23460.         $request $this->getBatchPaymentsRequest($xero_tenant_id$if_modified_since$where$order);
  23461.         return $this->client
  23462.             ->sendAsync($request$this->createHttpClientOption())
  23463.             ->then(
  23464.                 function ($response) use ($returnType) {
  23465.                     $responseBody $response->getBody();
  23466.                     if ($returnType === '\SplFileObject') {
  23467.                         $content $responseBody//stream goes to serializer
  23468.                     } else {
  23469.                         $content $responseBody->getContents();
  23470.                     }
  23471.                     return [
  23472.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  23473.                         $response->getStatusCode(),
  23474.                         $response->getHeaders()
  23475.                     ];
  23476.                 },
  23477.                 function ($exception) {
  23478.                     $response $exception->getResponse();
  23479.                     $statusCode $response->getStatusCode();
  23480.                     throw new ApiException(
  23481.                         sprintf(
  23482.                             '[%d] Error connecting to the API (%s)',
  23483.                             $statusCode,
  23484.                             $exception->getRequest()->getUri()
  23485.                         ),
  23486.                         $statusCode,
  23487.                         $response->getHeaders(),
  23488.                         $response->getBody()
  23489.                     );
  23490.                 }
  23491.             );
  23492.     }
  23493.     /**
  23494.      * Create request for operation 'getBatchPayments'
  23495.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  23496.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  23497.      * @param  string $where Filter by an any element (optional)
  23498.      * @param  string $order Order by an any element (optional)
  23499.      * @throws \InvalidArgumentException
  23500.      * @return \GuzzleHttp\Psr7\Request  */
  23501.     protected function getBatchPaymentsRequest($xero_tenant_id$if_modified_since null$where null$order null)
  23502.     {
  23503.         // verify the required parameter 'xero_tenant_id' is set
  23504.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  23505.             throw new \InvalidArgumentException(
  23506.                 'Missing the required parameter $xero_tenant_id when calling getBatchPayments'
  23507.             );
  23508.         }
  23509.         $resourcePath '/BatchPayments';
  23510.         $formParams = [];
  23511.         $queryParams = [];
  23512.         $headerParams = [];
  23513.         $httpBody '';
  23514.         $multipart false;
  23515.         // query params
  23516.         if ($where !== null) {
  23517.             $queryParams['where'] = AccountingObjectSerializer::toQueryValue($where);
  23518.         }
  23519.         // query params
  23520.         if ($order !== null) {
  23521.             $queryParams['order'] = AccountingObjectSerializer::toQueryValue($order);
  23522.         }
  23523.         // header params
  23524.         if ($xero_tenant_id !== null) {
  23525.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  23526.         }
  23527.         // header params
  23528.         if ($if_modified_since !== null) {
  23529.             $headerParams['If-Modified-Since'] = AccountingObjectSerializer::toHeaderValue($if_modified_since);
  23530.         }
  23531.         // body params
  23532.         $_tempBody null;
  23533.         if ($multipart) {
  23534.             $headers $this->headerSelector->selectHeadersForMultipart(
  23535.                 ['application/json']
  23536.             );
  23537.         } else {
  23538.             $headers $this->headerSelector->selectHeaders(
  23539.                 ['application/json'],
  23540.                 []
  23541.             );
  23542.         }
  23543.         // for model (json/xml)
  23544.         if (isset($_tempBody)) {
  23545.             // $_tempBody is the method argument, if present
  23546.             if ($headers['Content-Type'] === 'application/json') {
  23547.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  23548.             } else {
  23549.                 $httpBody $_tempBody;
  23550.             }
  23551.         } elseif (count($formParams) > 0) {
  23552.             if ($multipart) {
  23553.                 $multipartContents = [
  23554.                     [
  23555.                         'Content-type' => 'multipart/form-data',
  23556.                     ]
  23557.                 ];
  23558.                 
  23559.                 // for HTTP post (form)
  23560.                 $httpBody = new MultipartStream($multipartContents);
  23561.             } elseif ($headers['Content-Type'] === 'application/json') {
  23562.                 $httpBody \GuzzleHttp\json_encode($formParams);
  23563.             } else {
  23564.                 // for HTTP post (form)
  23565.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  23566.             }
  23567.         }
  23568.         // this endpoint requires OAuth (access token)
  23569.         if ($this->config->getAccessToken() !== null) {
  23570.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  23571.         }
  23572.         $defaultHeaders = [];
  23573.         if ($this->config->getUserAgent()) {
  23574.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  23575.         }
  23576.         $headers array_merge(
  23577.             $defaultHeaders,
  23578.             $headerParams,
  23579.             $headers
  23580.         );
  23581.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  23582.         return new Request(
  23583.             'GET',
  23584.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  23585.             $headers,
  23586.             $httpBody
  23587.         );
  23588.     }
  23589.     /**
  23590.      * Operation getBrandingTheme
  23591.      * Retrieves a specific branding theme using a unique branding theme Id
  23592.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  23593.      * @param  string $branding_theme_id Unique identifier for a Branding Theme (required)
  23594.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  23595.      * @throws \InvalidArgumentException
  23596.      * @return \XeroAPI\XeroPHP\Models\Accounting\BrandingThemes
  23597.      */
  23598.     public function getBrandingTheme($xero_tenant_id$branding_theme_id)
  23599.     {
  23600.         list($response) = $this->getBrandingThemeWithHttpInfo($xero_tenant_id$branding_theme_id);
  23601.         return $response;
  23602.     }
  23603.     /**
  23604.      * Operation getBrandingThemeWithHttpInfo
  23605.      * Retrieves a specific branding theme using a unique branding theme Id
  23606.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  23607.      * @param  string $branding_theme_id Unique identifier for a Branding Theme (required)
  23608.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  23609.      * @throws \InvalidArgumentException
  23610.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\BrandingThemes, HTTP status code, HTTP response headers (array of strings)
  23611.      */
  23612.     public function getBrandingThemeWithHttpInfo($xero_tenant_id$branding_theme_id)
  23613.     {
  23614.         $request $this->getBrandingThemeRequest($xero_tenant_id$branding_theme_id);
  23615.         try {
  23616.             $options $this->createHttpClientOption();
  23617.             try {
  23618.                 $response $this->client->send($request$options);
  23619.             } catch (RequestException $e) {
  23620.                 throw new ApiException(
  23621.                     "[{$e->getCode()}{$e->getMessage()}",
  23622.                     $e->getCode(),
  23623.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  23624.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  23625.                 );
  23626.             }
  23627.             $statusCode $response->getStatusCode();
  23628.             if ($statusCode 200 || $statusCode 299) {
  23629.                 throw new ApiException(
  23630.                     sprintf(
  23631.                         '[%d] Error connecting to the API (%s)',
  23632.                         $statusCode,
  23633.                         $request->getUri()
  23634.                     ),
  23635.                     $statusCode,
  23636.                     $response->getHeaders(),
  23637.                     $response->getBody()
  23638.                 );
  23639.             }
  23640.             $responseBody $response->getBody();
  23641.             switch($statusCode) {
  23642.                 case 200:
  23643.                     if ('\XeroAPI\XeroPHP\Models\Accounting\BrandingThemes' === '\SplFileObject') {
  23644.                         $content $responseBody//stream goes to serializer
  23645.                     } else {
  23646.                         $content $responseBody->getContents();
  23647.                     }
  23648.                     return [
  23649.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\BrandingThemes', []),
  23650.                         $response->getStatusCode(),
  23651.                         $response->getHeaders()
  23652.                     ];
  23653.             }
  23654.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\BrandingThemes';
  23655.             $responseBody $response->getBody();
  23656.             if ($returnType === '\SplFileObject') {
  23657.                 $content $responseBody//stream goes to serializer
  23658.             } else {
  23659.                 $content $responseBody->getContents();
  23660.             }
  23661.             return [
  23662.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  23663.                 $response->getStatusCode(),
  23664.                 $response->getHeaders()
  23665.             ];
  23666.         } catch (ApiException $e) {
  23667.             switch ($e->getCode()) {
  23668.                 case 200:
  23669.                     $data AccountingObjectSerializer::deserialize(
  23670.                         $e->getResponseBody(),
  23671.                         '\XeroAPI\XeroPHP\Models\Accounting\BrandingThemes',
  23672.                         $e->getResponseHeaders()
  23673.                     );
  23674.                     $e->setResponseObject($data);
  23675.                     break;
  23676.             }
  23677.             throw $e;
  23678.         }
  23679.     }
  23680.     /**
  23681.      * Operation getBrandingThemeAsync
  23682.      * Retrieves a specific branding theme using a unique branding theme Id
  23683.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  23684.      * @param  string $branding_theme_id Unique identifier for a Branding Theme (required)
  23685.      * @throws \InvalidArgumentException
  23686.      * @return \GuzzleHttp\Promise\PromiseInterface
  23687.      */
  23688.     public function getBrandingThemeAsync($xero_tenant_id$branding_theme_id)
  23689.     {
  23690.         return $this->getBrandingThemeAsyncWithHttpInfo($xero_tenant_id$branding_theme_id)
  23691.             ->then(
  23692.                 function ($response) {
  23693.                     return $response[0];
  23694.                 }
  23695.             );
  23696.     }
  23697.     /**
  23698.      * Operation getBrandingThemeAsyncWithHttpInfo
  23699.      * Retrieves a specific branding theme using a unique branding theme Id
  23700.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  23701.      * @param  string $branding_theme_id Unique identifier for a Branding Theme (required)
  23702.      * @throws \InvalidArgumentException
  23703.      * @return \GuzzleHttp\Promise\PromiseInterface */
  23704.     public function getBrandingThemeAsyncWithHttpInfo($xero_tenant_id$branding_theme_id)
  23705.     {
  23706.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\BrandingThemes';
  23707.         $request $this->getBrandingThemeRequest($xero_tenant_id$branding_theme_id);
  23708.         return $this->client
  23709.             ->sendAsync($request$this->createHttpClientOption())
  23710.             ->then(
  23711.                 function ($response) use ($returnType) {
  23712.                     $responseBody $response->getBody();
  23713.                     if ($returnType === '\SplFileObject') {
  23714.                         $content $responseBody//stream goes to serializer
  23715.                     } else {
  23716.                         $content $responseBody->getContents();
  23717.                     }
  23718.                     return [
  23719.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  23720.                         $response->getStatusCode(),
  23721.                         $response->getHeaders()
  23722.                     ];
  23723.                 },
  23724.                 function ($exception) {
  23725.                     $response $exception->getResponse();
  23726.                     $statusCode $response->getStatusCode();
  23727.                     throw new ApiException(
  23728.                         sprintf(
  23729.                             '[%d] Error connecting to the API (%s)',
  23730.                             $statusCode,
  23731.                             $exception->getRequest()->getUri()
  23732.                         ),
  23733.                         $statusCode,
  23734.                         $response->getHeaders(),
  23735.                         $response->getBody()
  23736.                     );
  23737.                 }
  23738.             );
  23739.     }
  23740.     /**
  23741.      * Create request for operation 'getBrandingTheme'
  23742.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  23743.      * @param  string $branding_theme_id Unique identifier for a Branding Theme (required)
  23744.      * @throws \InvalidArgumentException
  23745.      * @return \GuzzleHttp\Psr7\Request  */
  23746.     protected function getBrandingThemeRequest($xero_tenant_id$branding_theme_id)
  23747.     {
  23748.         // verify the required parameter 'xero_tenant_id' is set
  23749.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  23750.             throw new \InvalidArgumentException(
  23751.                 'Missing the required parameter $xero_tenant_id when calling getBrandingTheme'
  23752.             );
  23753.         }
  23754.         // verify the required parameter 'branding_theme_id' is set
  23755.         if ($branding_theme_id === null || (is_array($branding_theme_id) && count($branding_theme_id) === 0)) {
  23756.             throw new \InvalidArgumentException(
  23757.                 'Missing the required parameter $branding_theme_id when calling getBrandingTheme'
  23758.             );
  23759.         }
  23760.         $resourcePath '/BrandingThemes/{BrandingThemeID}';
  23761.         $formParams = [];
  23762.         $queryParams = [];
  23763.         $headerParams = [];
  23764.         $httpBody '';
  23765.         $multipart false;
  23766.         // header params
  23767.         if ($xero_tenant_id !== null) {
  23768.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  23769.         }
  23770.         // path params
  23771.         if ($branding_theme_id !== null) {
  23772.             $resourcePath str_replace(
  23773.                 '{' 'BrandingThemeID' '}',
  23774.                 AccountingObjectSerializer::toPathValue($branding_theme_id),
  23775.                 $resourcePath
  23776.             );
  23777.         }
  23778.         // body params
  23779.         $_tempBody null;
  23780.         if ($multipart) {
  23781.             $headers $this->headerSelector->selectHeadersForMultipart(
  23782.                 ['application/json']
  23783.             );
  23784.         } else {
  23785.             $headers $this->headerSelector->selectHeaders(
  23786.                 ['application/json'],
  23787.                 []
  23788.             );
  23789.         }
  23790.         // for model (json/xml)
  23791.         if (isset($_tempBody)) {
  23792.             // $_tempBody is the method argument, if present
  23793.             if ($headers['Content-Type'] === 'application/json') {
  23794.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  23795.             } else {
  23796.                 $httpBody $_tempBody;
  23797.             }
  23798.         } elseif (count($formParams) > 0) {
  23799.             if ($multipart) {
  23800.                 $multipartContents = [
  23801.                     [
  23802.                         'Content-type' => 'multipart/form-data',
  23803.                     ]
  23804.                 ];
  23805.                 
  23806.                 // for HTTP post (form)
  23807.                 $httpBody = new MultipartStream($multipartContents);
  23808.             } elseif ($headers['Content-Type'] === 'application/json') {
  23809.                 $httpBody \GuzzleHttp\json_encode($formParams);
  23810.             } else {
  23811.                 // for HTTP post (form)
  23812.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  23813.             }
  23814.         }
  23815.         // this endpoint requires OAuth (access token)
  23816.         if ($this->config->getAccessToken() !== null) {
  23817.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  23818.         }
  23819.         $defaultHeaders = [];
  23820.         if ($this->config->getUserAgent()) {
  23821.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  23822.         }
  23823.         $headers array_merge(
  23824.             $defaultHeaders,
  23825.             $headerParams,
  23826.             $headers
  23827.         );
  23828.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  23829.         return new Request(
  23830.             'GET',
  23831.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  23832.             $headers,
  23833.             $httpBody
  23834.         );
  23835.     }
  23836.     /**
  23837.      * Operation getBrandingThemePaymentServices
  23838.      * Retrieves the payment services for a specific branding theme
  23839.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  23840.      * @param  string $branding_theme_id Unique identifier for a Branding Theme (required)
  23841.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  23842.      * @throws \InvalidArgumentException
  23843.      * @return \XeroAPI\XeroPHP\Models\Accounting\PaymentServices
  23844.      */
  23845.     public function getBrandingThemePaymentServices($xero_tenant_id$branding_theme_id)
  23846.     {
  23847.         list($response) = $this->getBrandingThemePaymentServicesWithHttpInfo($xero_tenant_id$branding_theme_id);
  23848.         return $response;
  23849.     }
  23850.     /**
  23851.      * Operation getBrandingThemePaymentServicesWithHttpInfo
  23852.      * Retrieves the payment services for a specific branding theme
  23853.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  23854.      * @param  string $branding_theme_id Unique identifier for a Branding Theme (required)
  23855.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  23856.      * @throws \InvalidArgumentException
  23857.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\PaymentServices, HTTP status code, HTTP response headers (array of strings)
  23858.      */
  23859.     public function getBrandingThemePaymentServicesWithHttpInfo($xero_tenant_id$branding_theme_id)
  23860.     {
  23861.         $request $this->getBrandingThemePaymentServicesRequest($xero_tenant_id$branding_theme_id);
  23862.         try {
  23863.             $options $this->createHttpClientOption();
  23864.             try {
  23865.                 $response $this->client->send($request$options);
  23866.             } catch (RequestException $e) {
  23867.                 throw new ApiException(
  23868.                     "[{$e->getCode()}{$e->getMessage()}",
  23869.                     $e->getCode(),
  23870.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  23871.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  23872.                 );
  23873.             }
  23874.             $statusCode $response->getStatusCode();
  23875.             if ($statusCode 200 || $statusCode 299) {
  23876.                 throw new ApiException(
  23877.                     sprintf(
  23878.                         '[%d] Error connecting to the API (%s)',
  23879.                         $statusCode,
  23880.                         $request->getUri()
  23881.                     ),
  23882.                     $statusCode,
  23883.                     $response->getHeaders(),
  23884.                     $response->getBody()
  23885.                 );
  23886.             }
  23887.             $responseBody $response->getBody();
  23888.             switch($statusCode) {
  23889.                 case 200:
  23890.                     if ('\XeroAPI\XeroPHP\Models\Accounting\PaymentServices' === '\SplFileObject') {
  23891.                         $content $responseBody//stream goes to serializer
  23892.                     } else {
  23893.                         $content $responseBody->getContents();
  23894.                     }
  23895.                     return [
  23896.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\PaymentServices', []),
  23897.                         $response->getStatusCode(),
  23898.                         $response->getHeaders()
  23899.                     ];
  23900.             }
  23901.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\PaymentServices';
  23902.             $responseBody $response->getBody();
  23903.             if ($returnType === '\SplFileObject') {
  23904.                 $content $responseBody//stream goes to serializer
  23905.             } else {
  23906.                 $content $responseBody->getContents();
  23907.             }
  23908.             return [
  23909.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  23910.                 $response->getStatusCode(),
  23911.                 $response->getHeaders()
  23912.             ];
  23913.         } catch (ApiException $e) {
  23914.             switch ($e->getCode()) {
  23915.                 case 200:
  23916.                     $data AccountingObjectSerializer::deserialize(
  23917.                         $e->getResponseBody(),
  23918.                         '\XeroAPI\XeroPHP\Models\Accounting\PaymentServices',
  23919.                         $e->getResponseHeaders()
  23920.                     );
  23921.                     $e->setResponseObject($data);
  23922.                     break;
  23923.             }
  23924.             throw $e;
  23925.         }
  23926.     }
  23927.     /**
  23928.      * Operation getBrandingThemePaymentServicesAsync
  23929.      * Retrieves the payment services for a specific branding theme
  23930.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  23931.      * @param  string $branding_theme_id Unique identifier for a Branding Theme (required)
  23932.      * @throws \InvalidArgumentException
  23933.      * @return \GuzzleHttp\Promise\PromiseInterface
  23934.      */
  23935.     public function getBrandingThemePaymentServicesAsync($xero_tenant_id$branding_theme_id)
  23936.     {
  23937.         return $this->getBrandingThemePaymentServicesAsyncWithHttpInfo($xero_tenant_id$branding_theme_id)
  23938.             ->then(
  23939.                 function ($response) {
  23940.                     return $response[0];
  23941.                 }
  23942.             );
  23943.     }
  23944.     /**
  23945.      * Operation getBrandingThemePaymentServicesAsyncWithHttpInfo
  23946.      * Retrieves the payment services for a specific branding theme
  23947.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  23948.      * @param  string $branding_theme_id Unique identifier for a Branding Theme (required)
  23949.      * @throws \InvalidArgumentException
  23950.      * @return \GuzzleHttp\Promise\PromiseInterface */
  23951.     public function getBrandingThemePaymentServicesAsyncWithHttpInfo($xero_tenant_id$branding_theme_id)
  23952.     {
  23953.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\PaymentServices';
  23954.         $request $this->getBrandingThemePaymentServicesRequest($xero_tenant_id$branding_theme_id);
  23955.         return $this->client
  23956.             ->sendAsync($request$this->createHttpClientOption())
  23957.             ->then(
  23958.                 function ($response) use ($returnType) {
  23959.                     $responseBody $response->getBody();
  23960.                     if ($returnType === '\SplFileObject') {
  23961.                         $content $responseBody//stream goes to serializer
  23962.                     } else {
  23963.                         $content $responseBody->getContents();
  23964.                     }
  23965.                     return [
  23966.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  23967.                         $response->getStatusCode(),
  23968.                         $response->getHeaders()
  23969.                     ];
  23970.                 },
  23971.                 function ($exception) {
  23972.                     $response $exception->getResponse();
  23973.                     $statusCode $response->getStatusCode();
  23974.                     throw new ApiException(
  23975.                         sprintf(
  23976.                             '[%d] Error connecting to the API (%s)',
  23977.                             $statusCode,
  23978.                             $exception->getRequest()->getUri()
  23979.                         ),
  23980.                         $statusCode,
  23981.                         $response->getHeaders(),
  23982.                         $response->getBody()
  23983.                     );
  23984.                 }
  23985.             );
  23986.     }
  23987.     /**
  23988.      * Create request for operation 'getBrandingThemePaymentServices'
  23989.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  23990.      * @param  string $branding_theme_id Unique identifier for a Branding Theme (required)
  23991.      * @throws \InvalidArgumentException
  23992.      * @return \GuzzleHttp\Psr7\Request  */
  23993.     protected function getBrandingThemePaymentServicesRequest($xero_tenant_id$branding_theme_id)
  23994.     {
  23995.         // verify the required parameter 'xero_tenant_id' is set
  23996.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  23997.             throw new \InvalidArgumentException(
  23998.                 'Missing the required parameter $xero_tenant_id when calling getBrandingThemePaymentServices'
  23999.             );
  24000.         }
  24001.         // verify the required parameter 'branding_theme_id' is set
  24002.         if ($branding_theme_id === null || (is_array($branding_theme_id) && count($branding_theme_id) === 0)) {
  24003.             throw new \InvalidArgumentException(
  24004.                 'Missing the required parameter $branding_theme_id when calling getBrandingThemePaymentServices'
  24005.             );
  24006.         }
  24007.         $resourcePath '/BrandingThemes/{BrandingThemeID}/PaymentServices';
  24008.         $formParams = [];
  24009.         $queryParams = [];
  24010.         $headerParams = [];
  24011.         $httpBody '';
  24012.         $multipart false;
  24013.         // header params
  24014.         if ($xero_tenant_id !== null) {
  24015.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  24016.         }
  24017.         // path params
  24018.         if ($branding_theme_id !== null) {
  24019.             $resourcePath str_replace(
  24020.                 '{' 'BrandingThemeID' '}',
  24021.                 AccountingObjectSerializer::toPathValue($branding_theme_id),
  24022.                 $resourcePath
  24023.             );
  24024.         }
  24025.         // body params
  24026.         $_tempBody null;
  24027.         if ($multipart) {
  24028.             $headers $this->headerSelector->selectHeadersForMultipart(
  24029.                 ['application/json']
  24030.             );
  24031.         } else {
  24032.             $headers $this->headerSelector->selectHeaders(
  24033.                 ['application/json'],
  24034.                 []
  24035.             );
  24036.         }
  24037.         // for model (json/xml)
  24038.         if (isset($_tempBody)) {
  24039.             // $_tempBody is the method argument, if present
  24040.             if ($headers['Content-Type'] === 'application/json') {
  24041.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  24042.             } else {
  24043.                 $httpBody $_tempBody;
  24044.             }
  24045.         } elseif (count($formParams) > 0) {
  24046.             if ($multipart) {
  24047.                 $multipartContents = [
  24048.                     [
  24049.                         'Content-type' => 'multipart/form-data',
  24050.                     ]
  24051.                 ];
  24052.                 
  24053.                 // for HTTP post (form)
  24054.                 $httpBody = new MultipartStream($multipartContents);
  24055.             } elseif ($headers['Content-Type'] === 'application/json') {
  24056.                 $httpBody \GuzzleHttp\json_encode($formParams);
  24057.             } else {
  24058.                 // for HTTP post (form)
  24059.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  24060.             }
  24061.         }
  24062.         // this endpoint requires OAuth (access token)
  24063.         if ($this->config->getAccessToken() !== null) {
  24064.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  24065.         }
  24066.         $defaultHeaders = [];
  24067.         if ($this->config->getUserAgent()) {
  24068.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  24069.         }
  24070.         $headers array_merge(
  24071.             $defaultHeaders,
  24072.             $headerParams,
  24073.             $headers
  24074.         );
  24075.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  24076.         return new Request(
  24077.             'GET',
  24078.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  24079.             $headers,
  24080.             $httpBody
  24081.         );
  24082.     }
  24083.     /**
  24084.      * Operation getBrandingThemes
  24085.      * Retrieves all the branding themes
  24086.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  24087.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  24088.      * @throws \InvalidArgumentException
  24089.      * @return \XeroAPI\XeroPHP\Models\Accounting\BrandingThemes
  24090.      */
  24091.     public function getBrandingThemes($xero_tenant_id)
  24092.     {
  24093.         list($response) = $this->getBrandingThemesWithHttpInfo($xero_tenant_id);
  24094.         return $response;
  24095.     }
  24096.     /**
  24097.      * Operation getBrandingThemesWithHttpInfo
  24098.      * Retrieves all the branding themes
  24099.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  24100.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  24101.      * @throws \InvalidArgumentException
  24102.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\BrandingThemes, HTTP status code, HTTP response headers (array of strings)
  24103.      */
  24104.     public function getBrandingThemesWithHttpInfo($xero_tenant_id)
  24105.     {
  24106.         $request $this->getBrandingThemesRequest($xero_tenant_id);
  24107.         try {
  24108.             $options $this->createHttpClientOption();
  24109.             try {
  24110.                 $response $this->client->send($request$options);
  24111.             } catch (RequestException $e) {
  24112.                 throw new ApiException(
  24113.                     "[{$e->getCode()}{$e->getMessage()}",
  24114.                     $e->getCode(),
  24115.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  24116.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  24117.                 );
  24118.             }
  24119.             $statusCode $response->getStatusCode();
  24120.             if ($statusCode 200 || $statusCode 299) {
  24121.                 throw new ApiException(
  24122.                     sprintf(
  24123.                         '[%d] Error connecting to the API (%s)',
  24124.                         $statusCode,
  24125.                         $request->getUri()
  24126.                     ),
  24127.                     $statusCode,
  24128.                     $response->getHeaders(),
  24129.                     $response->getBody()
  24130.                 );
  24131.             }
  24132.             $responseBody $response->getBody();
  24133.             switch($statusCode) {
  24134.                 case 200:
  24135.                     if ('\XeroAPI\XeroPHP\Models\Accounting\BrandingThemes' === '\SplFileObject') {
  24136.                         $content $responseBody//stream goes to serializer
  24137.                     } else {
  24138.                         $content $responseBody->getContents();
  24139.                     }
  24140.                     return [
  24141.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\BrandingThemes', []),
  24142.                         $response->getStatusCode(),
  24143.                         $response->getHeaders()
  24144.                     ];
  24145.             }
  24146.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\BrandingThemes';
  24147.             $responseBody $response->getBody();
  24148.             if ($returnType === '\SplFileObject') {
  24149.                 $content $responseBody//stream goes to serializer
  24150.             } else {
  24151.                 $content $responseBody->getContents();
  24152.             }
  24153.             return [
  24154.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  24155.                 $response->getStatusCode(),
  24156.                 $response->getHeaders()
  24157.             ];
  24158.         } catch (ApiException $e) {
  24159.             switch ($e->getCode()) {
  24160.                 case 200:
  24161.                     $data AccountingObjectSerializer::deserialize(
  24162.                         $e->getResponseBody(),
  24163.                         '\XeroAPI\XeroPHP\Models\Accounting\BrandingThemes',
  24164.                         $e->getResponseHeaders()
  24165.                     );
  24166.                     $e->setResponseObject($data);
  24167.                     break;
  24168.             }
  24169.             throw $e;
  24170.         }
  24171.     }
  24172.     /**
  24173.      * Operation getBrandingThemesAsync
  24174.      * Retrieves all the branding themes
  24175.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  24176.      * @throws \InvalidArgumentException
  24177.      * @return \GuzzleHttp\Promise\PromiseInterface
  24178.      */
  24179.     public function getBrandingThemesAsync($xero_tenant_id)
  24180.     {
  24181.         return $this->getBrandingThemesAsyncWithHttpInfo($xero_tenant_id)
  24182.             ->then(
  24183.                 function ($response) {
  24184.                     return $response[0];
  24185.                 }
  24186.             );
  24187.     }
  24188.     /**
  24189.      * Operation getBrandingThemesAsyncWithHttpInfo
  24190.      * Retrieves all the branding themes
  24191.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  24192.      * @throws \InvalidArgumentException
  24193.      * @return \GuzzleHttp\Promise\PromiseInterface */
  24194.     public function getBrandingThemesAsyncWithHttpInfo($xero_tenant_id)
  24195.     {
  24196.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\BrandingThemes';
  24197.         $request $this->getBrandingThemesRequest($xero_tenant_id);
  24198.         return $this->client
  24199.             ->sendAsync($request$this->createHttpClientOption())
  24200.             ->then(
  24201.                 function ($response) use ($returnType) {
  24202.                     $responseBody $response->getBody();
  24203.                     if ($returnType === '\SplFileObject') {
  24204.                         $content $responseBody//stream goes to serializer
  24205.                     } else {
  24206.                         $content $responseBody->getContents();
  24207.                     }
  24208.                     return [
  24209.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  24210.                         $response->getStatusCode(),
  24211.                         $response->getHeaders()
  24212.                     ];
  24213.                 },
  24214.                 function ($exception) {
  24215.                     $response $exception->getResponse();
  24216.                     $statusCode $response->getStatusCode();
  24217.                     throw new ApiException(
  24218.                         sprintf(
  24219.                             '[%d] Error connecting to the API (%s)',
  24220.                             $statusCode,
  24221.                             $exception->getRequest()->getUri()
  24222.                         ),
  24223.                         $statusCode,
  24224.                         $response->getHeaders(),
  24225.                         $response->getBody()
  24226.                     );
  24227.                 }
  24228.             );
  24229.     }
  24230.     /**
  24231.      * Create request for operation 'getBrandingThemes'
  24232.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  24233.      * @throws \InvalidArgumentException
  24234.      * @return \GuzzleHttp\Psr7\Request  */
  24235.     protected function getBrandingThemesRequest($xero_tenant_id)
  24236.     {
  24237.         // verify the required parameter 'xero_tenant_id' is set
  24238.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  24239.             throw new \InvalidArgumentException(
  24240.                 'Missing the required parameter $xero_tenant_id when calling getBrandingThemes'
  24241.             );
  24242.         }
  24243.         $resourcePath '/BrandingThemes';
  24244.         $formParams = [];
  24245.         $queryParams = [];
  24246.         $headerParams = [];
  24247.         $httpBody '';
  24248.         $multipart false;
  24249.         // header params
  24250.         if ($xero_tenant_id !== null) {
  24251.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  24252.         }
  24253.         // body params
  24254.         $_tempBody null;
  24255.         if ($multipart) {
  24256.             $headers $this->headerSelector->selectHeadersForMultipart(
  24257.                 ['application/json']
  24258.             );
  24259.         } else {
  24260.             $headers $this->headerSelector->selectHeaders(
  24261.                 ['application/json'],
  24262.                 []
  24263.             );
  24264.         }
  24265.         // for model (json/xml)
  24266.         if (isset($_tempBody)) {
  24267.             // $_tempBody is the method argument, if present
  24268.             if ($headers['Content-Type'] === 'application/json') {
  24269.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  24270.             } else {
  24271.                 $httpBody $_tempBody;
  24272.             }
  24273.         } elseif (count($formParams) > 0) {
  24274.             if ($multipart) {
  24275.                 $multipartContents = [
  24276.                     [
  24277.                         'Content-type' => 'multipart/form-data',
  24278.                     ]
  24279.                 ];
  24280.                 
  24281.                 // for HTTP post (form)
  24282.                 $httpBody = new MultipartStream($multipartContents);
  24283.             } elseif ($headers['Content-Type'] === 'application/json') {
  24284.                 $httpBody \GuzzleHttp\json_encode($formParams);
  24285.             } else {
  24286.                 // for HTTP post (form)
  24287.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  24288.             }
  24289.         }
  24290.         // this endpoint requires OAuth (access token)
  24291.         if ($this->config->getAccessToken() !== null) {
  24292.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  24293.         }
  24294.         $defaultHeaders = [];
  24295.         if ($this->config->getUserAgent()) {
  24296.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  24297.         }
  24298.         $headers array_merge(
  24299.             $defaultHeaders,
  24300.             $headerParams,
  24301.             $headers
  24302.         );
  24303.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  24304.         return new Request(
  24305.             'GET',
  24306.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  24307.             $headers,
  24308.             $httpBody
  24309.         );
  24310.     }
  24311.     /**
  24312.      * Operation getBudget
  24313.      * Retrieves a specific budget, which includes budget lines
  24314.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  24315.      * @param  string $budget_id Unique identifier for Budgets (required)
  24316.      * @param  \DateTime $date_to Filter by start date (optional)
  24317.      * @param  \DateTime $date_from Filter by end date (optional)
  24318.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  24319.      * @throws \InvalidArgumentException
  24320.      * @return \XeroAPI\XeroPHP\Models\Accounting\Budgets
  24321.      */
  24322.     public function getBudget($xero_tenant_id$budget_id$date_to null$date_from null)
  24323.     {
  24324.         list($response) = $this->getBudgetWithHttpInfo($xero_tenant_id$budget_id$date_to$date_from);
  24325.         return $response;
  24326.     }
  24327.     /**
  24328.      * Operation getBudgetWithHttpInfo
  24329.      * Retrieves a specific budget, which includes budget lines
  24330.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  24331.      * @param  string $budget_id Unique identifier for Budgets (required)
  24332.      * @param  \DateTime $date_to Filter by start date (optional)
  24333.      * @param  \DateTime $date_from Filter by end date (optional)
  24334.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  24335.      * @throws \InvalidArgumentException
  24336.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Budgets, HTTP status code, HTTP response headers (array of strings)
  24337.      */
  24338.     public function getBudgetWithHttpInfo($xero_tenant_id$budget_id$date_to null$date_from null)
  24339.     {
  24340.         $request $this->getBudgetRequest($xero_tenant_id$budget_id$date_to$date_from);
  24341.         try {
  24342.             $options $this->createHttpClientOption();
  24343.             try {
  24344.                 $response $this->client->send($request$options);
  24345.             } catch (RequestException $e) {
  24346.                 throw new ApiException(
  24347.                     "[{$e->getCode()}{$e->getMessage()}",
  24348.                     $e->getCode(),
  24349.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  24350.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  24351.                 );
  24352.             }
  24353.             $statusCode $response->getStatusCode();
  24354.             if ($statusCode 200 || $statusCode 299) {
  24355.                 throw new ApiException(
  24356.                     sprintf(
  24357.                         '[%d] Error connecting to the API (%s)',
  24358.                         $statusCode,
  24359.                         $request->getUri()
  24360.                     ),
  24361.                     $statusCode,
  24362.                     $response->getHeaders(),
  24363.                     $response->getBody()
  24364.                 );
  24365.             }
  24366.             $responseBody $response->getBody();
  24367.             switch($statusCode) {
  24368.                 case 200:
  24369.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Budgets' === '\SplFileObject') {
  24370.                         $content $responseBody//stream goes to serializer
  24371.                     } else {
  24372.                         $content $responseBody->getContents();
  24373.                     }
  24374.                     return [
  24375.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Budgets', []),
  24376.                         $response->getStatusCode(),
  24377.                         $response->getHeaders()
  24378.                     ];
  24379.             }
  24380.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Budgets';
  24381.             $responseBody $response->getBody();
  24382.             if ($returnType === '\SplFileObject') {
  24383.                 $content $responseBody//stream goes to serializer
  24384.             } else {
  24385.                 $content $responseBody->getContents();
  24386.             }
  24387.             return [
  24388.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  24389.                 $response->getStatusCode(),
  24390.                 $response->getHeaders()
  24391.             ];
  24392.         } catch (ApiException $e) {
  24393.             switch ($e->getCode()) {
  24394.                 case 200:
  24395.                     $data AccountingObjectSerializer::deserialize(
  24396.                         $e->getResponseBody(),
  24397.                         '\XeroAPI\XeroPHP\Models\Accounting\Budgets',
  24398.                         $e->getResponseHeaders()
  24399.                     );
  24400.                     $e->setResponseObject($data);
  24401.                     break;
  24402.             }
  24403.             throw $e;
  24404.         }
  24405.     }
  24406.     /**
  24407.      * Operation getBudgetAsync
  24408.      * Retrieves a specific budget, which includes budget lines
  24409.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  24410.      * @param  string $budget_id Unique identifier for Budgets (required)
  24411.      * @param  \DateTime $date_to Filter by start date (optional)
  24412.      * @param  \DateTime $date_from Filter by end date (optional)
  24413.      * @throws \InvalidArgumentException
  24414.      * @return \GuzzleHttp\Promise\PromiseInterface
  24415.      */
  24416.     public function getBudgetAsync($xero_tenant_id$budget_id$date_to null$date_from null)
  24417.     {
  24418.         return $this->getBudgetAsyncWithHttpInfo($xero_tenant_id$budget_id$date_to$date_from)
  24419.             ->then(
  24420.                 function ($response) {
  24421.                     return $response[0];
  24422.                 }
  24423.             );
  24424.     }
  24425.     /**
  24426.      * Operation getBudgetAsyncWithHttpInfo
  24427.      * Retrieves a specific budget, which includes budget lines
  24428.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  24429.      * @param  string $budget_id Unique identifier for Budgets (required)
  24430.      * @param  \DateTime $date_to Filter by start date (optional)
  24431.      * @param  \DateTime $date_from Filter by end date (optional)
  24432.      * @throws \InvalidArgumentException
  24433.      * @return \GuzzleHttp\Promise\PromiseInterface */
  24434.     public function getBudgetAsyncWithHttpInfo($xero_tenant_id$budget_id$date_to null$date_from null)
  24435.     {
  24436.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Budgets';
  24437.         $request $this->getBudgetRequest($xero_tenant_id$budget_id$date_to$date_from);
  24438.         return $this->client
  24439.             ->sendAsync($request$this->createHttpClientOption())
  24440.             ->then(
  24441.                 function ($response) use ($returnType) {
  24442.                     $responseBody $response->getBody();
  24443.                     if ($returnType === '\SplFileObject') {
  24444.                         $content $responseBody//stream goes to serializer
  24445.                     } else {
  24446.                         $content $responseBody->getContents();
  24447.                     }
  24448.                     return [
  24449.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  24450.                         $response->getStatusCode(),
  24451.                         $response->getHeaders()
  24452.                     ];
  24453.                 },
  24454.                 function ($exception) {
  24455.                     $response $exception->getResponse();
  24456.                     $statusCode $response->getStatusCode();
  24457.                     throw new ApiException(
  24458.                         sprintf(
  24459.                             '[%d] Error connecting to the API (%s)',
  24460.                             $statusCode,
  24461.                             $exception->getRequest()->getUri()
  24462.                         ),
  24463.                         $statusCode,
  24464.                         $response->getHeaders(),
  24465.                         $response->getBody()
  24466.                     );
  24467.                 }
  24468.             );
  24469.     }
  24470.     /**
  24471.      * Create request for operation 'getBudget'
  24472.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  24473.      * @param  string $budget_id Unique identifier for Budgets (required)
  24474.      * @param  \DateTime $date_to Filter by start date (optional)
  24475.      * @param  \DateTime $date_from Filter by end date (optional)
  24476.      * @throws \InvalidArgumentException
  24477.      * @return \GuzzleHttp\Psr7\Request  */
  24478.     protected function getBudgetRequest($xero_tenant_id$budget_id$date_to null$date_from null)
  24479.     {
  24480.         // verify the required parameter 'xero_tenant_id' is set
  24481.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  24482.             throw new \InvalidArgumentException(
  24483.                 'Missing the required parameter $xero_tenant_id when calling getBudget'
  24484.             );
  24485.         }
  24486.         // verify the required parameter 'budget_id' is set
  24487.         if ($budget_id === null || (is_array($budget_id) && count($budget_id) === 0)) {
  24488.             throw new \InvalidArgumentException(
  24489.                 'Missing the required parameter $budget_id when calling getBudget'
  24490.             );
  24491.         }
  24492.         $resourcePath '/Budgets/{BudgetID}';
  24493.         $formParams = [];
  24494.         $queryParams = [];
  24495.         $headerParams = [];
  24496.         $httpBody '';
  24497.         $multipart false;
  24498.         // query params
  24499.         if ($date_to !== null) {
  24500.             $queryParams['DateTo'] = AccountingObjectSerializer::toQueryValue($date_to);
  24501.         }
  24502.         // query params
  24503.         if ($date_from !== null) {
  24504.             $queryParams['DateFrom'] = AccountingObjectSerializer::toQueryValue($date_from);
  24505.         }
  24506.         // header params
  24507.         if ($xero_tenant_id !== null) {
  24508.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  24509.         }
  24510.         // path params
  24511.         if ($budget_id !== null) {
  24512.             $resourcePath str_replace(
  24513.                 '{' 'BudgetID' '}',
  24514.                 AccountingObjectSerializer::toPathValue($budget_id),
  24515.                 $resourcePath
  24516.             );
  24517.         }
  24518.         // body params
  24519.         $_tempBody null;
  24520.         if ($multipart) {
  24521.             $headers $this->headerSelector->selectHeadersForMultipart(
  24522.                 ['application/json']
  24523.             );
  24524.         } else {
  24525.             $headers $this->headerSelector->selectHeaders(
  24526.                 ['application/json'],
  24527.                 []
  24528.             );
  24529.         }
  24530.         // for model (json/xml)
  24531.         if (isset($_tempBody)) {
  24532.             // $_tempBody is the method argument, if present
  24533.             if ($headers['Content-Type'] === 'application/json') {
  24534.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  24535.             } else {
  24536.                 $httpBody $_tempBody;
  24537.             }
  24538.         } elseif (count($formParams) > 0) {
  24539.             if ($multipart) {
  24540.                 $multipartContents = [
  24541.                     [
  24542.                         'Content-type' => 'multipart/form-data',
  24543.                     ]
  24544.                 ];
  24545.                 
  24546.                 // for HTTP post (form)
  24547.                 $httpBody = new MultipartStream($multipartContents);
  24548.             } elseif ($headers['Content-Type'] === 'application/json') {
  24549.                 $httpBody \GuzzleHttp\json_encode($formParams);
  24550.             } else {
  24551.                 // for HTTP post (form)
  24552.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  24553.             }
  24554.         }
  24555.         // this endpoint requires OAuth (access token)
  24556.         if ($this->config->getAccessToken() !== null) {
  24557.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  24558.         }
  24559.         $defaultHeaders = [];
  24560.         if ($this->config->getUserAgent()) {
  24561.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  24562.         }
  24563.         $headers array_merge(
  24564.             $defaultHeaders,
  24565.             $headerParams,
  24566.             $headers
  24567.         );
  24568.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  24569.         return new Request(
  24570.             'GET',
  24571.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  24572.             $headers,
  24573.             $httpBody
  24574.         );
  24575.     }
  24576.     /**
  24577.      * Operation getBudgets
  24578.      * Retrieve a list of budgets
  24579.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  24580.      * @param  string[] $ids Filter by BudgetID. Allows you to retrieve a specific individual budget. (optional)
  24581.      * @param  \DateTime $date_to Filter by start date (optional)
  24582.      * @param  \DateTime $date_from Filter by end date (optional)
  24583.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  24584.      * @throws \InvalidArgumentException
  24585.      * @return \XeroAPI\XeroPHP\Models\Accounting\Budgets
  24586.      */
  24587.     public function getBudgets($xero_tenant_id$ids null$date_to null$date_from null)
  24588.     {
  24589.         list($response) = $this->getBudgetsWithHttpInfo($xero_tenant_id$ids$date_to$date_from);
  24590.         return $response;
  24591.     }
  24592.     /**
  24593.      * Operation getBudgetsWithHttpInfo
  24594.      * Retrieve a list of budgets
  24595.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  24596.      * @param  string[] $ids Filter by BudgetID. Allows you to retrieve a specific individual budget. (optional)
  24597.      * @param  \DateTime $date_to Filter by start date (optional)
  24598.      * @param  \DateTime $date_from Filter by end date (optional)
  24599.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  24600.      * @throws \InvalidArgumentException
  24601.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Budgets, HTTP status code, HTTP response headers (array of strings)
  24602.      */
  24603.     public function getBudgetsWithHttpInfo($xero_tenant_id$ids null$date_to null$date_from null)
  24604.     {
  24605.         $request $this->getBudgetsRequest($xero_tenant_id$ids$date_to$date_from);
  24606.         try {
  24607.             $options $this->createHttpClientOption();
  24608.             try {
  24609.                 $response $this->client->send($request$options);
  24610.             } catch (RequestException $e) {
  24611.                 throw new ApiException(
  24612.                     "[{$e->getCode()}{$e->getMessage()}",
  24613.                     $e->getCode(),
  24614.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  24615.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  24616.                 );
  24617.             }
  24618.             $statusCode $response->getStatusCode();
  24619.             if ($statusCode 200 || $statusCode 299) {
  24620.                 throw new ApiException(
  24621.                     sprintf(
  24622.                         '[%d] Error connecting to the API (%s)',
  24623.                         $statusCode,
  24624.                         $request->getUri()
  24625.                     ),
  24626.                     $statusCode,
  24627.                     $response->getHeaders(),
  24628.                     $response->getBody()
  24629.                 );
  24630.             }
  24631.             $responseBody $response->getBody();
  24632.             switch($statusCode) {
  24633.                 case 200:
  24634.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Budgets' === '\SplFileObject') {
  24635.                         $content $responseBody//stream goes to serializer
  24636.                     } else {
  24637.                         $content $responseBody->getContents();
  24638.                     }
  24639.                     return [
  24640.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Budgets', []),
  24641.                         $response->getStatusCode(),
  24642.                         $response->getHeaders()
  24643.                     ];
  24644.             }
  24645.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Budgets';
  24646.             $responseBody $response->getBody();
  24647.             if ($returnType === '\SplFileObject') {
  24648.                 $content $responseBody//stream goes to serializer
  24649.             } else {
  24650.                 $content $responseBody->getContents();
  24651.             }
  24652.             return [
  24653.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  24654.                 $response->getStatusCode(),
  24655.                 $response->getHeaders()
  24656.             ];
  24657.         } catch (ApiException $e) {
  24658.             switch ($e->getCode()) {
  24659.                 case 200:
  24660.                     $data AccountingObjectSerializer::deserialize(
  24661.                         $e->getResponseBody(),
  24662.                         '\XeroAPI\XeroPHP\Models\Accounting\Budgets',
  24663.                         $e->getResponseHeaders()
  24664.                     );
  24665.                     $e->setResponseObject($data);
  24666.                     break;
  24667.             }
  24668.             throw $e;
  24669.         }
  24670.     }
  24671.     /**
  24672.      * Operation getBudgetsAsync
  24673.      * Retrieve a list of budgets
  24674.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  24675.      * @param  string[] $ids Filter by BudgetID. Allows you to retrieve a specific individual budget. (optional)
  24676.      * @param  \DateTime $date_to Filter by start date (optional)
  24677.      * @param  \DateTime $date_from Filter by end date (optional)
  24678.      * @throws \InvalidArgumentException
  24679.      * @return \GuzzleHttp\Promise\PromiseInterface
  24680.      */
  24681.     public function getBudgetsAsync($xero_tenant_id$ids null$date_to null$date_from null)
  24682.     {
  24683.         return $this->getBudgetsAsyncWithHttpInfo($xero_tenant_id$ids$date_to$date_from)
  24684.             ->then(
  24685.                 function ($response) {
  24686.                     return $response[0];
  24687.                 }
  24688.             );
  24689.     }
  24690.     /**
  24691.      * Operation getBudgetsAsyncWithHttpInfo
  24692.      * Retrieve a list of budgets
  24693.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  24694.      * @param  string[] $ids Filter by BudgetID. Allows you to retrieve a specific individual budget. (optional)
  24695.      * @param  \DateTime $date_to Filter by start date (optional)
  24696.      * @param  \DateTime $date_from Filter by end date (optional)
  24697.      * @throws \InvalidArgumentException
  24698.      * @return \GuzzleHttp\Promise\PromiseInterface */
  24699.     public function getBudgetsAsyncWithHttpInfo($xero_tenant_id$ids null$date_to null$date_from null)
  24700.     {
  24701.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Budgets';
  24702.         $request $this->getBudgetsRequest($xero_tenant_id$ids$date_to$date_from);
  24703.         return $this->client
  24704.             ->sendAsync($request$this->createHttpClientOption())
  24705.             ->then(
  24706.                 function ($response) use ($returnType) {
  24707.                     $responseBody $response->getBody();
  24708.                     if ($returnType === '\SplFileObject') {
  24709.                         $content $responseBody//stream goes to serializer
  24710.                     } else {
  24711.                         $content $responseBody->getContents();
  24712.                     }
  24713.                     return [
  24714.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  24715.                         $response->getStatusCode(),
  24716.                         $response->getHeaders()
  24717.                     ];
  24718.                 },
  24719.                 function ($exception) {
  24720.                     $response $exception->getResponse();
  24721.                     $statusCode $response->getStatusCode();
  24722.                     throw new ApiException(
  24723.                         sprintf(
  24724.                             '[%d] Error connecting to the API (%s)',
  24725.                             $statusCode,
  24726.                             $exception->getRequest()->getUri()
  24727.                         ),
  24728.                         $statusCode,
  24729.                         $response->getHeaders(),
  24730.                         $response->getBody()
  24731.                     );
  24732.                 }
  24733.             );
  24734.     }
  24735.     /**
  24736.      * Create request for operation 'getBudgets'
  24737.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  24738.      * @param  string[] $ids Filter by BudgetID. Allows you to retrieve a specific individual budget. (optional)
  24739.      * @param  \DateTime $date_to Filter by start date (optional)
  24740.      * @param  \DateTime $date_from Filter by end date (optional)
  24741.      * @throws \InvalidArgumentException
  24742.      * @return \GuzzleHttp\Psr7\Request  */
  24743.     protected function getBudgetsRequest($xero_tenant_id$ids null$date_to null$date_from null)
  24744.     {
  24745.         // verify the required parameter 'xero_tenant_id' is set
  24746.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  24747.             throw new \InvalidArgumentException(
  24748.                 'Missing the required parameter $xero_tenant_id when calling getBudgets'
  24749.             );
  24750.         }
  24751.         $resourcePath '/Budgets';
  24752.         $formParams = [];
  24753.         $queryParams = [];
  24754.         $headerParams = [];
  24755.         $httpBody '';
  24756.         $multipart false;
  24757.         // query params
  24758.         if (is_array($ids)) {
  24759.             $ids AccountingObjectSerializer::serializeCollection($ids'csv'true);
  24760.         }
  24761.         if ($ids !== null) {
  24762.             $queryParams['IDs'] = AccountingObjectSerializer::toQueryValue($ids);
  24763.         }
  24764.         // query params
  24765.         if ($date_to !== null) {
  24766.             $queryParams['DateTo'] = AccountingObjectSerializer::toQueryValue($date_to);
  24767.         }
  24768.         // query params
  24769.         if ($date_from !== null) {
  24770.             $queryParams['DateFrom'] = AccountingObjectSerializer::toQueryValue($date_from);
  24771.         }
  24772.         // header params
  24773.         if ($xero_tenant_id !== null) {
  24774.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  24775.         }
  24776.         // body params
  24777.         $_tempBody null;
  24778.         if ($multipart) {
  24779.             $headers $this->headerSelector->selectHeadersForMultipart(
  24780.                 ['application/json']
  24781.             );
  24782.         } else {
  24783.             $headers $this->headerSelector->selectHeaders(
  24784.                 ['application/json'],
  24785.                 []
  24786.             );
  24787.         }
  24788.         // for model (json/xml)
  24789.         if (isset($_tempBody)) {
  24790.             // $_tempBody is the method argument, if present
  24791.             if ($headers['Content-Type'] === 'application/json') {
  24792.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  24793.             } else {
  24794.                 $httpBody $_tempBody;
  24795.             }
  24796.         } elseif (count($formParams) > 0) {
  24797.             if ($multipart) {
  24798.                 $multipartContents = [
  24799.                     [
  24800.                         'Content-type' => 'multipart/form-data',
  24801.                     ]
  24802.                 ];
  24803.                 
  24804.                 // for HTTP post (form)
  24805.                 $httpBody = new MultipartStream($multipartContents);
  24806.             } elseif ($headers['Content-Type'] === 'application/json') {
  24807.                 $httpBody \GuzzleHttp\json_encode($formParams);
  24808.             } else {
  24809.                 // for HTTP post (form)
  24810.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  24811.             }
  24812.         }
  24813.         // this endpoint requires OAuth (access token)
  24814.         if ($this->config->getAccessToken() !== null) {
  24815.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  24816.         }
  24817.         $defaultHeaders = [];
  24818.         if ($this->config->getUserAgent()) {
  24819.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  24820.         }
  24821.         $headers array_merge(
  24822.             $defaultHeaders,
  24823.             $headerParams,
  24824.             $headers
  24825.         );
  24826.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  24827.         return new Request(
  24828.             'GET',
  24829.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  24830.             $headers,
  24831.             $httpBody
  24832.         );
  24833.     }
  24834.     /**
  24835.      * Operation getContact
  24836.      * Retrieves a specific contacts in a Xero organisation using a unique contact Id
  24837.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  24838.      * @param  string $contact_id Unique identifier for a Contact (required)
  24839.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  24840.      * @throws \InvalidArgumentException
  24841.      * @return \XeroAPI\XeroPHP\Models\Accounting\Contacts
  24842.      */
  24843.     public function getContact($xero_tenant_id$contact_id)
  24844.     {
  24845.         list($response) = $this->getContactWithHttpInfo($xero_tenant_id$contact_id);
  24846.         return $response;
  24847.     }
  24848.     /**
  24849.      * Operation getContactWithHttpInfo
  24850.      * Retrieves a specific contacts in a Xero organisation using a unique contact Id
  24851.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  24852.      * @param  string $contact_id Unique identifier for a Contact (required)
  24853.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  24854.      * @throws \InvalidArgumentException
  24855.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Contacts, HTTP status code, HTTP response headers (array of strings)
  24856.      */
  24857.     public function getContactWithHttpInfo($xero_tenant_id$contact_id)
  24858.     {
  24859.         $request $this->getContactRequest($xero_tenant_id$contact_id);
  24860.         try {
  24861.             $options $this->createHttpClientOption();
  24862.             try {
  24863.                 $response $this->client->send($request$options);
  24864.             } catch (RequestException $e) {
  24865.                 throw new ApiException(
  24866.                     "[{$e->getCode()}{$e->getMessage()}",
  24867.                     $e->getCode(),
  24868.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  24869.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  24870.                 );
  24871.             }
  24872.             $statusCode $response->getStatusCode();
  24873.             if ($statusCode 200 || $statusCode 299) {
  24874.                 throw new ApiException(
  24875.                     sprintf(
  24876.                         '[%d] Error connecting to the API (%s)',
  24877.                         $statusCode,
  24878.                         $request->getUri()
  24879.                     ),
  24880.                     $statusCode,
  24881.                     $response->getHeaders(),
  24882.                     $response->getBody()
  24883.                 );
  24884.             }
  24885.             $responseBody $response->getBody();
  24886.             switch($statusCode) {
  24887.                 case 200:
  24888.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Contacts' === '\SplFileObject') {
  24889.                         $content $responseBody//stream goes to serializer
  24890.                     } else {
  24891.                         $content $responseBody->getContents();
  24892.                     }
  24893.                     return [
  24894.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Contacts', []),
  24895.                         $response->getStatusCode(),
  24896.                         $response->getHeaders()
  24897.                     ];
  24898.             }
  24899.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Contacts';
  24900.             $responseBody $response->getBody();
  24901.             if ($returnType === '\SplFileObject') {
  24902.                 $content $responseBody//stream goes to serializer
  24903.             } else {
  24904.                 $content $responseBody->getContents();
  24905.             }
  24906.             return [
  24907.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  24908.                 $response->getStatusCode(),
  24909.                 $response->getHeaders()
  24910.             ];
  24911.         } catch (ApiException $e) {
  24912.             switch ($e->getCode()) {
  24913.                 case 200:
  24914.                     $data AccountingObjectSerializer::deserialize(
  24915.                         $e->getResponseBody(),
  24916.                         '\XeroAPI\XeroPHP\Models\Accounting\Contacts',
  24917.                         $e->getResponseHeaders()
  24918.                     );
  24919.                     $e->setResponseObject($data);
  24920.                     break;
  24921.             }
  24922.             throw $e;
  24923.         }
  24924.     }
  24925.     /**
  24926.      * Operation getContactAsync
  24927.      * Retrieves a specific contacts in a Xero organisation using a unique contact Id
  24928.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  24929.      * @param  string $contact_id Unique identifier for a Contact (required)
  24930.      * @throws \InvalidArgumentException
  24931.      * @return \GuzzleHttp\Promise\PromiseInterface
  24932.      */
  24933.     public function getContactAsync($xero_tenant_id$contact_id)
  24934.     {
  24935.         return $this->getContactAsyncWithHttpInfo($xero_tenant_id$contact_id)
  24936.             ->then(
  24937.                 function ($response) {
  24938.                     return $response[0];
  24939.                 }
  24940.             );
  24941.     }
  24942.     /**
  24943.      * Operation getContactAsyncWithHttpInfo
  24944.      * Retrieves a specific contacts in a Xero organisation using a unique contact Id
  24945.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  24946.      * @param  string $contact_id Unique identifier for a Contact (required)
  24947.      * @throws \InvalidArgumentException
  24948.      * @return \GuzzleHttp\Promise\PromiseInterface */
  24949.     public function getContactAsyncWithHttpInfo($xero_tenant_id$contact_id)
  24950.     {
  24951.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Contacts';
  24952.         $request $this->getContactRequest($xero_tenant_id$contact_id);
  24953.         return $this->client
  24954.             ->sendAsync($request$this->createHttpClientOption())
  24955.             ->then(
  24956.                 function ($response) use ($returnType) {
  24957.                     $responseBody $response->getBody();
  24958.                     if ($returnType === '\SplFileObject') {
  24959.                         $content $responseBody//stream goes to serializer
  24960.                     } else {
  24961.                         $content $responseBody->getContents();
  24962.                     }
  24963.                     return [
  24964.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  24965.                         $response->getStatusCode(),
  24966.                         $response->getHeaders()
  24967.                     ];
  24968.                 },
  24969.                 function ($exception) {
  24970.                     $response $exception->getResponse();
  24971.                     $statusCode $response->getStatusCode();
  24972.                     throw new ApiException(
  24973.                         sprintf(
  24974.                             '[%d] Error connecting to the API (%s)',
  24975.                             $statusCode,
  24976.                             $exception->getRequest()->getUri()
  24977.                         ),
  24978.                         $statusCode,
  24979.                         $response->getHeaders(),
  24980.                         $response->getBody()
  24981.                     );
  24982.                 }
  24983.             );
  24984.     }
  24985.     /**
  24986.      * Create request for operation 'getContact'
  24987.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  24988.      * @param  string $contact_id Unique identifier for a Contact (required)
  24989.      * @throws \InvalidArgumentException
  24990.      * @return \GuzzleHttp\Psr7\Request  */
  24991.     protected function getContactRequest($xero_tenant_id$contact_id)
  24992.     {
  24993.         // verify the required parameter 'xero_tenant_id' is set
  24994.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  24995.             throw new \InvalidArgumentException(
  24996.                 'Missing the required parameter $xero_tenant_id when calling getContact'
  24997.             );
  24998.         }
  24999.         // verify the required parameter 'contact_id' is set
  25000.         if ($contact_id === null || (is_array($contact_id) && count($contact_id) === 0)) {
  25001.             throw new \InvalidArgumentException(
  25002.                 'Missing the required parameter $contact_id when calling getContact'
  25003.             );
  25004.         }
  25005.         $resourcePath '/Contacts/{ContactID}';
  25006.         $formParams = [];
  25007.         $queryParams = [];
  25008.         $headerParams = [];
  25009.         $httpBody '';
  25010.         $multipart false;
  25011.         // header params
  25012.         if ($xero_tenant_id !== null) {
  25013.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  25014.         }
  25015.         // path params
  25016.         if ($contact_id !== null) {
  25017.             $resourcePath str_replace(
  25018.                 '{' 'ContactID' '}',
  25019.                 AccountingObjectSerializer::toPathValue($contact_id),
  25020.                 $resourcePath
  25021.             );
  25022.         }
  25023.         // body params
  25024.         $_tempBody null;
  25025.         if ($multipart) {
  25026.             $headers $this->headerSelector->selectHeadersForMultipart(
  25027.                 ['application/json']
  25028.             );
  25029.         } else {
  25030.             $headers $this->headerSelector->selectHeaders(
  25031.                 ['application/json'],
  25032.                 []
  25033.             );
  25034.         }
  25035.         // for model (json/xml)
  25036.         if (isset($_tempBody)) {
  25037.             // $_tempBody is the method argument, if present
  25038.             if ($headers['Content-Type'] === 'application/json') {
  25039.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  25040.             } else {
  25041.                 $httpBody $_tempBody;
  25042.             }
  25043.         } elseif (count($formParams) > 0) {
  25044.             if ($multipart) {
  25045.                 $multipartContents = [
  25046.                     [
  25047.                         'Content-type' => 'multipart/form-data',
  25048.                     ]
  25049.                 ];
  25050.                 
  25051.                 // for HTTP post (form)
  25052.                 $httpBody = new MultipartStream($multipartContents);
  25053.             } elseif ($headers['Content-Type'] === 'application/json') {
  25054.                 $httpBody \GuzzleHttp\json_encode($formParams);
  25055.             } else {
  25056.                 // for HTTP post (form)
  25057.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  25058.             }
  25059.         }
  25060.         // this endpoint requires OAuth (access token)
  25061.         if ($this->config->getAccessToken() !== null) {
  25062.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  25063.         }
  25064.         $defaultHeaders = [];
  25065.         if ($this->config->getUserAgent()) {
  25066.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  25067.         }
  25068.         $headers array_merge(
  25069.             $defaultHeaders,
  25070.             $headerParams,
  25071.             $headers
  25072.         );
  25073.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  25074.         return new Request(
  25075.             'GET',
  25076.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  25077.             $headers,
  25078.             $httpBody
  25079.         );
  25080.     }
  25081.     /**
  25082.      * Operation getContactAttachmentByFileName
  25083.      * Retrieves a specific attachment from a specific contact by file name
  25084.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  25085.      * @param  string $contact_id Unique identifier for a Contact (required)
  25086.      * @param  string $file_name Name of the attachment (required)
  25087.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  25088.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  25089.      * @throws \InvalidArgumentException
  25090.      * @return \SplFileObject
  25091.      */
  25092.     public function getContactAttachmentByFileName($xero_tenant_id$contact_id$file_name$content_type)
  25093.     {
  25094.         list($response) = $this->getContactAttachmentByFileNameWithHttpInfo($xero_tenant_id$contact_id$file_name$content_type);
  25095.         return $response;
  25096.     }
  25097.     /**
  25098.      * Operation getContactAttachmentByFileNameWithHttpInfo
  25099.      * Retrieves a specific attachment from a specific contact by file name
  25100.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  25101.      * @param  string $contact_id Unique identifier for a Contact (required)
  25102.      * @param  string $file_name Name of the attachment (required)
  25103.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  25104.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  25105.      * @throws \InvalidArgumentException
  25106.      * @return array of \SplFileObject, HTTP status code, HTTP response headers (array of strings)
  25107.      */
  25108.     public function getContactAttachmentByFileNameWithHttpInfo($xero_tenant_id$contact_id$file_name$content_type)
  25109.     {
  25110.         $request $this->getContactAttachmentByFileNameRequest($xero_tenant_id$contact_id$file_name$content_type);
  25111.         try {
  25112.             $options $this->createHttpClientOption();
  25113.             try {
  25114.                 $response $this->client->send($request$options);
  25115.             } catch (RequestException $e) {
  25116.                 throw new ApiException(
  25117.                     "[{$e->getCode()}{$e->getMessage()}",
  25118.                     $e->getCode(),
  25119.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  25120.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  25121.                 );
  25122.             }
  25123.             $statusCode $response->getStatusCode();
  25124.             if ($statusCode 200 || $statusCode 299) {
  25125.                 throw new ApiException(
  25126.                     sprintf(
  25127.                         '[%d] Error connecting to the API (%s)',
  25128.                         $statusCode,
  25129.                         $request->getUri()
  25130.                     ),
  25131.                     $statusCode,
  25132.                     $response->getHeaders(),
  25133.                     $response->getBody()
  25134.                 );
  25135.             }
  25136.             $responseBody $response->getBody();
  25137.             switch($statusCode) {
  25138.                 case 200:
  25139.                     if ('\SplFileObject' === '\SplFileObject') {
  25140.                         $content $responseBody//stream goes to serializer
  25141.                     } else {
  25142.                         $content $responseBody->getContents();
  25143.                     }
  25144.                     return [
  25145.                         AccountingObjectSerializer::deserialize($content'\SplFileObject', []),
  25146.                         $response->getStatusCode(),
  25147.                         $response->getHeaders()
  25148.                     ];
  25149.             }
  25150.             $returnType '\SplFileObject';
  25151.             $responseBody $response->getBody();
  25152.             if ($returnType === '\SplFileObject') {
  25153.                 $content $responseBody//stream goes to serializer
  25154.             } else {
  25155.                 $content $responseBody->getContents();
  25156.             }
  25157.             return [
  25158.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  25159.                 $response->getStatusCode(),
  25160.                 $response->getHeaders()
  25161.             ];
  25162.         } catch (ApiException $e) {
  25163.             switch ($e->getCode()) {
  25164.                 case 200:
  25165.                     $data AccountingObjectSerializer::deserialize(
  25166.                         $e->getResponseBody(),
  25167.                         '\SplFileObject',
  25168.                         $e->getResponseHeaders()
  25169.                     );
  25170.                     $e->setResponseObject($data);
  25171.                     break;
  25172.             }
  25173.             throw $e;
  25174.         }
  25175.     }
  25176.     /**
  25177.      * Operation getContactAttachmentByFileNameAsync
  25178.      * Retrieves a specific attachment from a specific contact by file name
  25179.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  25180.      * @param  string $contact_id Unique identifier for a Contact (required)
  25181.      * @param  string $file_name Name of the attachment (required)
  25182.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  25183.      * @throws \InvalidArgumentException
  25184.      * @return \GuzzleHttp\Promise\PromiseInterface
  25185.      */
  25186.     public function getContactAttachmentByFileNameAsync($xero_tenant_id$contact_id$file_name$content_type)
  25187.     {
  25188.         return $this->getContactAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$contact_id$file_name$content_type)
  25189.             ->then(
  25190.                 function ($response) {
  25191.                     return $response[0];
  25192.                 }
  25193.             );
  25194.     }
  25195.     /**
  25196.      * Operation getContactAttachmentByFileNameAsyncWithHttpInfo
  25197.      * Retrieves a specific attachment from a specific contact by file name
  25198.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  25199.      * @param  string $contact_id Unique identifier for a Contact (required)
  25200.      * @param  string $file_name Name of the attachment (required)
  25201.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  25202.      * @throws \InvalidArgumentException
  25203.      * @return \GuzzleHttp\Promise\PromiseInterface */
  25204.     public function getContactAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$contact_id$file_name$content_type)
  25205.     {
  25206.         $returnType '\SplFileObject';
  25207.         $request $this->getContactAttachmentByFileNameRequest($xero_tenant_id$contact_id$file_name$content_type);
  25208.         return $this->client
  25209.             ->sendAsync($request$this->createHttpClientOption())
  25210.             ->then(
  25211.                 function ($response) use ($returnType) {
  25212.                     $responseBody $response->getBody();
  25213.                     if ($returnType === '\SplFileObject') {
  25214.                         $content $responseBody//stream goes to serializer
  25215.                     } else {
  25216.                         $content $responseBody->getContents();
  25217.                     }
  25218.                     return [
  25219.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  25220.                         $response->getStatusCode(),
  25221.                         $response->getHeaders()
  25222.                     ];
  25223.                 },
  25224.                 function ($exception) {
  25225.                     $response $exception->getResponse();
  25226.                     $statusCode $response->getStatusCode();
  25227.                     throw new ApiException(
  25228.                         sprintf(
  25229.                             '[%d] Error connecting to the API (%s)',
  25230.                             $statusCode,
  25231.                             $exception->getRequest()->getUri()
  25232.                         ),
  25233.                         $statusCode,
  25234.                         $response->getHeaders(),
  25235.                         $response->getBody()
  25236.                     );
  25237.                 }
  25238.             );
  25239.     }
  25240.     /**
  25241.      * Create request for operation 'getContactAttachmentByFileName'
  25242.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  25243.      * @param  string $contact_id Unique identifier for a Contact (required)
  25244.      * @param  string $file_name Name of the attachment (required)
  25245.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  25246.      * @throws \InvalidArgumentException
  25247.      * @return \GuzzleHttp\Psr7\Request  */
  25248.     protected function getContactAttachmentByFileNameRequest($xero_tenant_id$contact_id$file_name$content_type)
  25249.     {
  25250.         // verify the required parameter 'xero_tenant_id' is set
  25251.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  25252.             throw new \InvalidArgumentException(
  25253.                 'Missing the required parameter $xero_tenant_id when calling getContactAttachmentByFileName'
  25254.             );
  25255.         }
  25256.         // verify the required parameter 'contact_id' is set
  25257.         if ($contact_id === null || (is_array($contact_id) && count($contact_id) === 0)) {
  25258.             throw new \InvalidArgumentException(
  25259.                 'Missing the required parameter $contact_id when calling getContactAttachmentByFileName'
  25260.             );
  25261.         }
  25262.         // verify the required parameter 'file_name' is set
  25263.         if ($file_name === null || (is_array($file_name) && count($file_name) === 0)) {
  25264.             throw new \InvalidArgumentException(
  25265.                 'Missing the required parameter $file_name when calling getContactAttachmentByFileName'
  25266.             );
  25267.         }
  25268.         // verify the required parameter 'content_type' is set
  25269.         if ($content_type === null || (is_array($content_type) && count($content_type) === 0)) {
  25270.             throw new \InvalidArgumentException(
  25271.                 'Missing the required parameter $content_type when calling getContactAttachmentByFileName'
  25272.             );
  25273.         }
  25274.         $resourcePath '/Contacts/{ContactID}/Attachments/{FileName}';
  25275.         $formParams = [];
  25276.         $queryParams = [];
  25277.         $headerParams = [];
  25278.         $httpBody '';
  25279.         $multipart false;
  25280.         // header params
  25281.         if ($xero_tenant_id !== null) {
  25282.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  25283.         }
  25284.         // header params
  25285.         if ($content_type !== null) {
  25286.             $headerParams['contentType'] = AccountingObjectSerializer::toHeaderValue($content_type);
  25287.         }
  25288.         // path params
  25289.         if ($contact_id !== null) {
  25290.             $resourcePath str_replace(
  25291.                 '{' 'ContactID' '}',
  25292.                 AccountingObjectSerializer::toPathValue($contact_id),
  25293.                 $resourcePath
  25294.             );
  25295.         }
  25296.         // path params
  25297.         if ($file_name !== null) {
  25298.             $resourcePath str_replace(
  25299.                 '{' 'FileName' '}',
  25300.                 AccountingObjectSerializer::toPathValue($file_name),
  25301.                 $resourcePath
  25302.             );
  25303.         }
  25304.         // body params
  25305.         $_tempBody null;
  25306.         if ($multipart) {
  25307.             $headers $this->headerSelector->selectHeadersForMultipart(
  25308.                 ['application/octet-stream']
  25309.             );
  25310.         } else {
  25311.             $headers $this->headerSelector->selectHeaders(
  25312.                 ['application/octet-stream'],
  25313.                 []
  25314.             );
  25315.         }
  25316.         // for model (json/xml)
  25317.         if (isset($_tempBody)) {
  25318.             // $_tempBody is the method argument, if present
  25319.             if ($headers['Content-Type'] === 'application/json') {
  25320.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  25321.             } else {
  25322.                 $httpBody $_tempBody;
  25323.             }
  25324.         } elseif (count($formParams) > 0) {
  25325.             if ($multipart) {
  25326.                 $multipartContents = [
  25327.                     [
  25328.                         'Content-type' => 'multipart/form-data',
  25329.                     ]
  25330.                 ];
  25331.                 
  25332.                 // for HTTP post (form)
  25333.                 $httpBody = new MultipartStream($multipartContents);
  25334.             } elseif ($headers['Content-Type'] === 'application/json') {
  25335.                 $httpBody \GuzzleHttp\json_encode($formParams);
  25336.             } else {
  25337.                 // for HTTP post (form)
  25338.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  25339.             }
  25340.         }
  25341.         // this endpoint requires OAuth (access token)
  25342.         if ($this->config->getAccessToken() !== null) {
  25343.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  25344.         }
  25345.         $defaultHeaders = [];
  25346.         if ($this->config->getUserAgent()) {
  25347.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  25348.         }
  25349.         $headers array_merge(
  25350.             $defaultHeaders,
  25351.             $headerParams,
  25352.             $headers
  25353.         );
  25354.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  25355.         return new Request(
  25356.             'GET',
  25357.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  25358.             $headers,
  25359.             $httpBody
  25360.         );
  25361.     }
  25362.     /**
  25363.      * Operation getContactAttachmentById
  25364.      * Retrieves a specific attachment from a specific contact using a unique attachment Id
  25365.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  25366.      * @param  string $contact_id Unique identifier for a Contact (required)
  25367.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  25368.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  25369.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  25370.      * @throws \InvalidArgumentException
  25371.      * @return \SplFileObject
  25372.      */
  25373.     public function getContactAttachmentById($xero_tenant_id$contact_id$attachment_id$content_type)
  25374.     {
  25375.         list($response) = $this->getContactAttachmentByIdWithHttpInfo($xero_tenant_id$contact_id$attachment_id$content_type);
  25376.         return $response;
  25377.     }
  25378.     /**
  25379.      * Operation getContactAttachmentByIdWithHttpInfo
  25380.      * Retrieves a specific attachment from a specific contact using a unique attachment Id
  25381.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  25382.      * @param  string $contact_id Unique identifier for a Contact (required)
  25383.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  25384.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  25385.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  25386.      * @throws \InvalidArgumentException
  25387.      * @return array of \SplFileObject, HTTP status code, HTTP response headers (array of strings)
  25388.      */
  25389.     public function getContactAttachmentByIdWithHttpInfo($xero_tenant_id$contact_id$attachment_id$content_type)
  25390.     {
  25391.         $request $this->getContactAttachmentByIdRequest($xero_tenant_id$contact_id$attachment_id$content_type);
  25392.         try {
  25393.             $options $this->createHttpClientOption();
  25394.             try {
  25395.                 $response $this->client->send($request$options);
  25396.             } catch (RequestException $e) {
  25397.                 throw new ApiException(
  25398.                     "[{$e->getCode()}{$e->getMessage()}",
  25399.                     $e->getCode(),
  25400.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  25401.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  25402.                 );
  25403.             }
  25404.             $statusCode $response->getStatusCode();
  25405.             if ($statusCode 200 || $statusCode 299) {
  25406.                 throw new ApiException(
  25407.                     sprintf(
  25408.                         '[%d] Error connecting to the API (%s)',
  25409.                         $statusCode,
  25410.                         $request->getUri()
  25411.                     ),
  25412.                     $statusCode,
  25413.                     $response->getHeaders(),
  25414.                     $response->getBody()
  25415.                 );
  25416.             }
  25417.             $responseBody $response->getBody();
  25418.             switch($statusCode) {
  25419.                 case 200:
  25420.                     if ('\SplFileObject' === '\SplFileObject') {
  25421.                         $content $responseBody//stream goes to serializer
  25422.                     } else {
  25423.                         $content $responseBody->getContents();
  25424.                     }
  25425.                     return [
  25426.                         AccountingObjectSerializer::deserialize($content'\SplFileObject', []),
  25427.                         $response->getStatusCode(),
  25428.                         $response->getHeaders()
  25429.                     ];
  25430.             }
  25431.             $returnType '\SplFileObject';
  25432.             $responseBody $response->getBody();
  25433.             if ($returnType === '\SplFileObject') {
  25434.                 $content $responseBody//stream goes to serializer
  25435.             } else {
  25436.                 $content $responseBody->getContents();
  25437.             }
  25438.             return [
  25439.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  25440.                 $response->getStatusCode(),
  25441.                 $response->getHeaders()
  25442.             ];
  25443.         } catch (ApiException $e) {
  25444.             switch ($e->getCode()) {
  25445.                 case 200:
  25446.                     $data AccountingObjectSerializer::deserialize(
  25447.                         $e->getResponseBody(),
  25448.                         '\SplFileObject',
  25449.                         $e->getResponseHeaders()
  25450.                     );
  25451.                     $e->setResponseObject($data);
  25452.                     break;
  25453.             }
  25454.             throw $e;
  25455.         }
  25456.     }
  25457.     /**
  25458.      * Operation getContactAttachmentByIdAsync
  25459.      * Retrieves a specific attachment from a specific contact using a unique attachment Id
  25460.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  25461.      * @param  string $contact_id Unique identifier for a Contact (required)
  25462.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  25463.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  25464.      * @throws \InvalidArgumentException
  25465.      * @return \GuzzleHttp\Promise\PromiseInterface
  25466.      */
  25467.     public function getContactAttachmentByIdAsync($xero_tenant_id$contact_id$attachment_id$content_type)
  25468.     {
  25469.         return $this->getContactAttachmentByIdAsyncWithHttpInfo($xero_tenant_id$contact_id$attachment_id$content_type)
  25470.             ->then(
  25471.                 function ($response) {
  25472.                     return $response[0];
  25473.                 }
  25474.             );
  25475.     }
  25476.     /**
  25477.      * Operation getContactAttachmentByIdAsyncWithHttpInfo
  25478.      * Retrieves a specific attachment from a specific contact using a unique attachment Id
  25479.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  25480.      * @param  string $contact_id Unique identifier for a Contact (required)
  25481.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  25482.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  25483.      * @throws \InvalidArgumentException
  25484.      * @return \GuzzleHttp\Promise\PromiseInterface */
  25485.     public function getContactAttachmentByIdAsyncWithHttpInfo($xero_tenant_id$contact_id$attachment_id$content_type)
  25486.     {
  25487.         $returnType '\SplFileObject';
  25488.         $request $this->getContactAttachmentByIdRequest($xero_tenant_id$contact_id$attachment_id$content_type);
  25489.         return $this->client
  25490.             ->sendAsync($request$this->createHttpClientOption())
  25491.             ->then(
  25492.                 function ($response) use ($returnType) {
  25493.                     $responseBody $response->getBody();
  25494.                     if ($returnType === '\SplFileObject') {
  25495.                         $content $responseBody//stream goes to serializer
  25496.                     } else {
  25497.                         $content $responseBody->getContents();
  25498.                     }
  25499.                     return [
  25500.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  25501.                         $response->getStatusCode(),
  25502.                         $response->getHeaders()
  25503.                     ];
  25504.                 },
  25505.                 function ($exception) {
  25506.                     $response $exception->getResponse();
  25507.                     $statusCode $response->getStatusCode();
  25508.                     throw new ApiException(
  25509.                         sprintf(
  25510.                             '[%d] Error connecting to the API (%s)',
  25511.                             $statusCode,
  25512.                             $exception->getRequest()->getUri()
  25513.                         ),
  25514.                         $statusCode,
  25515.                         $response->getHeaders(),
  25516.                         $response->getBody()
  25517.                     );
  25518.                 }
  25519.             );
  25520.     }
  25521.     /**
  25522.      * Create request for operation 'getContactAttachmentById'
  25523.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  25524.      * @param  string $contact_id Unique identifier for a Contact (required)
  25525.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  25526.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  25527.      * @throws \InvalidArgumentException
  25528.      * @return \GuzzleHttp\Psr7\Request  */
  25529.     protected function getContactAttachmentByIdRequest($xero_tenant_id$contact_id$attachment_id$content_type)
  25530.     {
  25531.         // verify the required parameter 'xero_tenant_id' is set
  25532.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  25533.             throw new \InvalidArgumentException(
  25534.                 'Missing the required parameter $xero_tenant_id when calling getContactAttachmentById'
  25535.             );
  25536.         }
  25537.         // verify the required parameter 'contact_id' is set
  25538.         if ($contact_id === null || (is_array($contact_id) && count($contact_id) === 0)) {
  25539.             throw new \InvalidArgumentException(
  25540.                 'Missing the required parameter $contact_id when calling getContactAttachmentById'
  25541.             );
  25542.         }
  25543.         // verify the required parameter 'attachment_id' is set
  25544.         if ($attachment_id === null || (is_array($attachment_id) && count($attachment_id) === 0)) {
  25545.             throw new \InvalidArgumentException(
  25546.                 'Missing the required parameter $attachment_id when calling getContactAttachmentById'
  25547.             );
  25548.         }
  25549.         // verify the required parameter 'content_type' is set
  25550.         if ($content_type === null || (is_array($content_type) && count($content_type) === 0)) {
  25551.             throw new \InvalidArgumentException(
  25552.                 'Missing the required parameter $content_type when calling getContactAttachmentById'
  25553.             );
  25554.         }
  25555.         $resourcePath '/Contacts/{ContactID}/Attachments/{AttachmentID}';
  25556.         $formParams = [];
  25557.         $queryParams = [];
  25558.         $headerParams = [];
  25559.         $httpBody '';
  25560.         $multipart false;
  25561.         // header params
  25562.         if ($xero_tenant_id !== null) {
  25563.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  25564.         }
  25565.         // header params
  25566.         if ($content_type !== null) {
  25567.             $headerParams['contentType'] = AccountingObjectSerializer::toHeaderValue($content_type);
  25568.         }
  25569.         // path params
  25570.         if ($contact_id !== null) {
  25571.             $resourcePath str_replace(
  25572.                 '{' 'ContactID' '}',
  25573.                 AccountingObjectSerializer::toPathValue($contact_id),
  25574.                 $resourcePath
  25575.             );
  25576.         }
  25577.         // path params
  25578.         if ($attachment_id !== null) {
  25579.             $resourcePath str_replace(
  25580.                 '{' 'AttachmentID' '}',
  25581.                 AccountingObjectSerializer::toPathValue($attachment_id),
  25582.                 $resourcePath
  25583.             );
  25584.         }
  25585.         // body params
  25586.         $_tempBody null;
  25587.         if ($multipart) {
  25588.             $headers $this->headerSelector->selectHeadersForMultipart(
  25589.                 ['application/octet-stream']
  25590.             );
  25591.         } else {
  25592.             $headers $this->headerSelector->selectHeaders(
  25593.                 ['application/octet-stream'],
  25594.                 []
  25595.             );
  25596.         }
  25597.         // for model (json/xml)
  25598.         if (isset($_tempBody)) {
  25599.             // $_tempBody is the method argument, if present
  25600.             if ($headers['Content-Type'] === 'application/json') {
  25601.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  25602.             } else {
  25603.                 $httpBody $_tempBody;
  25604.             }
  25605.         } elseif (count($formParams) > 0) {
  25606.             if ($multipart) {
  25607.                 $multipartContents = [
  25608.                     [
  25609.                         'Content-type' => 'multipart/form-data',
  25610.                     ]
  25611.                 ];
  25612.                 
  25613.                 // for HTTP post (form)
  25614.                 $httpBody = new MultipartStream($multipartContents);
  25615.             } elseif ($headers['Content-Type'] === 'application/json') {
  25616.                 $httpBody \GuzzleHttp\json_encode($formParams);
  25617.             } else {
  25618.                 // for HTTP post (form)
  25619.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  25620.             }
  25621.         }
  25622.         // this endpoint requires OAuth (access token)
  25623.         if ($this->config->getAccessToken() !== null) {
  25624.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  25625.         }
  25626.         $defaultHeaders = [];
  25627.         if ($this->config->getUserAgent()) {
  25628.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  25629.         }
  25630.         $headers array_merge(
  25631.             $defaultHeaders,
  25632.             $headerParams,
  25633.             $headers
  25634.         );
  25635.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  25636.         return new Request(
  25637.             'GET',
  25638.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  25639.             $headers,
  25640.             $httpBody
  25641.         );
  25642.     }
  25643.     /**
  25644.      * Operation getContactAttachments
  25645.      * Retrieves attachments for a specific contact in a Xero organisation
  25646.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  25647.      * @param  string $contact_id Unique identifier for a Contact (required)
  25648.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  25649.      * @throws \InvalidArgumentException
  25650.      * @return \XeroAPI\XeroPHP\Models\Accounting\Attachments
  25651.      */
  25652.     public function getContactAttachments($xero_tenant_id$contact_id)
  25653.     {
  25654.         list($response) = $this->getContactAttachmentsWithHttpInfo($xero_tenant_id$contact_id);
  25655.         return $response;
  25656.     }
  25657.     /**
  25658.      * Operation getContactAttachmentsWithHttpInfo
  25659.      * Retrieves attachments for a specific contact in a Xero organisation
  25660.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  25661.      * @param  string $contact_id Unique identifier for a Contact (required)
  25662.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  25663.      * @throws \InvalidArgumentException
  25664.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Attachments, HTTP status code, HTTP response headers (array of strings)
  25665.      */
  25666.     public function getContactAttachmentsWithHttpInfo($xero_tenant_id$contact_id)
  25667.     {
  25668.         $request $this->getContactAttachmentsRequest($xero_tenant_id$contact_id);
  25669.         try {
  25670.             $options $this->createHttpClientOption();
  25671.             try {
  25672.                 $response $this->client->send($request$options);
  25673.             } catch (RequestException $e) {
  25674.                 throw new ApiException(
  25675.                     "[{$e->getCode()}{$e->getMessage()}",
  25676.                     $e->getCode(),
  25677.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  25678.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  25679.                 );
  25680.             }
  25681.             $statusCode $response->getStatusCode();
  25682.             if ($statusCode 200 || $statusCode 299) {
  25683.                 throw new ApiException(
  25684.                     sprintf(
  25685.                         '[%d] Error connecting to the API (%s)',
  25686.                         $statusCode,
  25687.                         $request->getUri()
  25688.                     ),
  25689.                     $statusCode,
  25690.                     $response->getHeaders(),
  25691.                     $response->getBody()
  25692.                 );
  25693.             }
  25694.             $responseBody $response->getBody();
  25695.             switch($statusCode) {
  25696.                 case 200:
  25697.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Attachments' === '\SplFileObject') {
  25698.                         $content $responseBody//stream goes to serializer
  25699.                     } else {
  25700.                         $content $responseBody->getContents();
  25701.                     }
  25702.                     return [
  25703.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Attachments', []),
  25704.                         $response->getStatusCode(),
  25705.                         $response->getHeaders()
  25706.                     ];
  25707.             }
  25708.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  25709.             $responseBody $response->getBody();
  25710.             if ($returnType === '\SplFileObject') {
  25711.                 $content $responseBody//stream goes to serializer
  25712.             } else {
  25713.                 $content $responseBody->getContents();
  25714.             }
  25715.             return [
  25716.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  25717.                 $response->getStatusCode(),
  25718.                 $response->getHeaders()
  25719.             ];
  25720.         } catch (ApiException $e) {
  25721.             switch ($e->getCode()) {
  25722.                 case 200:
  25723.                     $data AccountingObjectSerializer::deserialize(
  25724.                         $e->getResponseBody(),
  25725.                         '\XeroAPI\XeroPHP\Models\Accounting\Attachments',
  25726.                         $e->getResponseHeaders()
  25727.                     );
  25728.                     $e->setResponseObject($data);
  25729.                     break;
  25730.             }
  25731.             throw $e;
  25732.         }
  25733.     }
  25734.     /**
  25735.      * Operation getContactAttachmentsAsync
  25736.      * Retrieves attachments for a specific contact in a Xero organisation
  25737.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  25738.      * @param  string $contact_id Unique identifier for a Contact (required)
  25739.      * @throws \InvalidArgumentException
  25740.      * @return \GuzzleHttp\Promise\PromiseInterface
  25741.      */
  25742.     public function getContactAttachmentsAsync($xero_tenant_id$contact_id)
  25743.     {
  25744.         return $this->getContactAttachmentsAsyncWithHttpInfo($xero_tenant_id$contact_id)
  25745.             ->then(
  25746.                 function ($response) {
  25747.                     return $response[0];
  25748.                 }
  25749.             );
  25750.     }
  25751.     /**
  25752.      * Operation getContactAttachmentsAsyncWithHttpInfo
  25753.      * Retrieves attachments for a specific contact in a Xero organisation
  25754.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  25755.      * @param  string $contact_id Unique identifier for a Contact (required)
  25756.      * @throws \InvalidArgumentException
  25757.      * @return \GuzzleHttp\Promise\PromiseInterface */
  25758.     public function getContactAttachmentsAsyncWithHttpInfo($xero_tenant_id$contact_id)
  25759.     {
  25760.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  25761.         $request $this->getContactAttachmentsRequest($xero_tenant_id$contact_id);
  25762.         return $this->client
  25763.             ->sendAsync($request$this->createHttpClientOption())
  25764.             ->then(
  25765.                 function ($response) use ($returnType) {
  25766.                     $responseBody $response->getBody();
  25767.                     if ($returnType === '\SplFileObject') {
  25768.                         $content $responseBody//stream goes to serializer
  25769.                     } else {
  25770.                         $content $responseBody->getContents();
  25771.                     }
  25772.                     return [
  25773.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  25774.                         $response->getStatusCode(),
  25775.                         $response->getHeaders()
  25776.                     ];
  25777.                 },
  25778.                 function ($exception) {
  25779.                     $response $exception->getResponse();
  25780.                     $statusCode $response->getStatusCode();
  25781.                     throw new ApiException(
  25782.                         sprintf(
  25783.                             '[%d] Error connecting to the API (%s)',
  25784.                             $statusCode,
  25785.                             $exception->getRequest()->getUri()
  25786.                         ),
  25787.                         $statusCode,
  25788.                         $response->getHeaders(),
  25789.                         $response->getBody()
  25790.                     );
  25791.                 }
  25792.             );
  25793.     }
  25794.     /**
  25795.      * Create request for operation 'getContactAttachments'
  25796.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  25797.      * @param  string $contact_id Unique identifier for a Contact (required)
  25798.      * @throws \InvalidArgumentException
  25799.      * @return \GuzzleHttp\Psr7\Request  */
  25800.     protected function getContactAttachmentsRequest($xero_tenant_id$contact_id)
  25801.     {
  25802.         // verify the required parameter 'xero_tenant_id' is set
  25803.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  25804.             throw new \InvalidArgumentException(
  25805.                 'Missing the required parameter $xero_tenant_id when calling getContactAttachments'
  25806.             );
  25807.         }
  25808.         // verify the required parameter 'contact_id' is set
  25809.         if ($contact_id === null || (is_array($contact_id) && count($contact_id) === 0)) {
  25810.             throw new \InvalidArgumentException(
  25811.                 'Missing the required parameter $contact_id when calling getContactAttachments'
  25812.             );
  25813.         }
  25814.         $resourcePath '/Contacts/{ContactID}/Attachments';
  25815.         $formParams = [];
  25816.         $queryParams = [];
  25817.         $headerParams = [];
  25818.         $httpBody '';
  25819.         $multipart false;
  25820.         // header params
  25821.         if ($xero_tenant_id !== null) {
  25822.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  25823.         }
  25824.         // path params
  25825.         if ($contact_id !== null) {
  25826.             $resourcePath str_replace(
  25827.                 '{' 'ContactID' '}',
  25828.                 AccountingObjectSerializer::toPathValue($contact_id),
  25829.                 $resourcePath
  25830.             );
  25831.         }
  25832.         // body params
  25833.         $_tempBody null;
  25834.         if ($multipart) {
  25835.             $headers $this->headerSelector->selectHeadersForMultipart(
  25836.                 ['application/json']
  25837.             );
  25838.         } else {
  25839.             $headers $this->headerSelector->selectHeaders(
  25840.                 ['application/json'],
  25841.                 []
  25842.             );
  25843.         }
  25844.         // for model (json/xml)
  25845.         if (isset($_tempBody)) {
  25846.             // $_tempBody is the method argument, if present
  25847.             if ($headers['Content-Type'] === 'application/json') {
  25848.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  25849.             } else {
  25850.                 $httpBody $_tempBody;
  25851.             }
  25852.         } elseif (count($formParams) > 0) {
  25853.             if ($multipart) {
  25854.                 $multipartContents = [
  25855.                     [
  25856.                         'Content-type' => 'multipart/form-data',
  25857.                     ]
  25858.                 ];
  25859.                 
  25860.                 // for HTTP post (form)
  25861.                 $httpBody = new MultipartStream($multipartContents);
  25862.             } elseif ($headers['Content-Type'] === 'application/json') {
  25863.                 $httpBody \GuzzleHttp\json_encode($formParams);
  25864.             } else {
  25865.                 // for HTTP post (form)
  25866.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  25867.             }
  25868.         }
  25869.         // this endpoint requires OAuth (access token)
  25870.         if ($this->config->getAccessToken() !== null) {
  25871.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  25872.         }
  25873.         $defaultHeaders = [];
  25874.         if ($this->config->getUserAgent()) {
  25875.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  25876.         }
  25877.         $headers array_merge(
  25878.             $defaultHeaders,
  25879.             $headerParams,
  25880.             $headers
  25881.         );
  25882.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  25883.         return new Request(
  25884.             'GET',
  25885.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  25886.             $headers,
  25887.             $httpBody
  25888.         );
  25889.     }
  25890.     /**
  25891.      * Operation getContactByContactNumber
  25892.      * Retrieves a specific contact by contact number in a Xero organisation
  25893.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  25894.      * @param  string $contact_number This field is read only on the Xero contact screen, used to identify contacts in external systems (max length &#x3D; 50). (required)
  25895.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  25896.      * @throws \InvalidArgumentException
  25897.      * @return \XeroAPI\XeroPHP\Models\Accounting\Contacts
  25898.      */
  25899.     public function getContactByContactNumber($xero_tenant_id$contact_number)
  25900.     {
  25901.         list($response) = $this->getContactByContactNumberWithHttpInfo($xero_tenant_id$contact_number);
  25902.         return $response;
  25903.     }
  25904.     /**
  25905.      * Operation getContactByContactNumberWithHttpInfo
  25906.      * Retrieves a specific contact by contact number in a Xero organisation
  25907.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  25908.      * @param  string $contact_number This field is read only on the Xero contact screen, used to identify contacts in external systems (max length &#x3D; 50). (required)
  25909.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  25910.      * @throws \InvalidArgumentException
  25911.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Contacts, HTTP status code, HTTP response headers (array of strings)
  25912.      */
  25913.     public function getContactByContactNumberWithHttpInfo($xero_tenant_id$contact_number)
  25914.     {
  25915.         $request $this->getContactByContactNumberRequest($xero_tenant_id$contact_number);
  25916.         try {
  25917.             $options $this->createHttpClientOption();
  25918.             try {
  25919.                 $response $this->client->send($request$options);
  25920.             } catch (RequestException $e) {
  25921.                 throw new ApiException(
  25922.                     "[{$e->getCode()}{$e->getMessage()}",
  25923.                     $e->getCode(),
  25924.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  25925.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  25926.                 );
  25927.             }
  25928.             $statusCode $response->getStatusCode();
  25929.             if ($statusCode 200 || $statusCode 299) {
  25930.                 throw new ApiException(
  25931.                     sprintf(
  25932.                         '[%d] Error connecting to the API (%s)',
  25933.                         $statusCode,
  25934.                         $request->getUri()
  25935.                     ),
  25936.                     $statusCode,
  25937.                     $response->getHeaders(),
  25938.                     $response->getBody()
  25939.                 );
  25940.             }
  25941.             $responseBody $response->getBody();
  25942.             switch($statusCode) {
  25943.                 case 200:
  25944.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Contacts' === '\SplFileObject') {
  25945.                         $content $responseBody//stream goes to serializer
  25946.                     } else {
  25947.                         $content $responseBody->getContents();
  25948.                     }
  25949.                     return [
  25950.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Contacts', []),
  25951.                         $response->getStatusCode(),
  25952.                         $response->getHeaders()
  25953.                     ];
  25954.             }
  25955.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Contacts';
  25956.             $responseBody $response->getBody();
  25957.             if ($returnType === '\SplFileObject') {
  25958.                 $content $responseBody//stream goes to serializer
  25959.             } else {
  25960.                 $content $responseBody->getContents();
  25961.             }
  25962.             return [
  25963.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  25964.                 $response->getStatusCode(),
  25965.                 $response->getHeaders()
  25966.             ];
  25967.         } catch (ApiException $e) {
  25968.             switch ($e->getCode()) {
  25969.                 case 200:
  25970.                     $data AccountingObjectSerializer::deserialize(
  25971.                         $e->getResponseBody(),
  25972.                         '\XeroAPI\XeroPHP\Models\Accounting\Contacts',
  25973.                         $e->getResponseHeaders()
  25974.                     );
  25975.                     $e->setResponseObject($data);
  25976.                     break;
  25977.             }
  25978.             throw $e;
  25979.         }
  25980.     }
  25981.     /**
  25982.      * Operation getContactByContactNumberAsync
  25983.      * Retrieves a specific contact by contact number in a Xero organisation
  25984.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  25985.      * @param  string $contact_number This field is read only on the Xero contact screen, used to identify contacts in external systems (max length &#x3D; 50). (required)
  25986.      * @throws \InvalidArgumentException
  25987.      * @return \GuzzleHttp\Promise\PromiseInterface
  25988.      */
  25989.     public function getContactByContactNumberAsync($xero_tenant_id$contact_number)
  25990.     {
  25991.         return $this->getContactByContactNumberAsyncWithHttpInfo($xero_tenant_id$contact_number)
  25992.             ->then(
  25993.                 function ($response) {
  25994.                     return $response[0];
  25995.                 }
  25996.             );
  25997.     }
  25998.     /**
  25999.      * Operation getContactByContactNumberAsyncWithHttpInfo
  26000.      * Retrieves a specific contact by contact number in a Xero organisation
  26001.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  26002.      * @param  string $contact_number This field is read only on the Xero contact screen, used to identify contacts in external systems (max length &#x3D; 50). (required)
  26003.      * @throws \InvalidArgumentException
  26004.      * @return \GuzzleHttp\Promise\PromiseInterface */
  26005.     public function getContactByContactNumberAsyncWithHttpInfo($xero_tenant_id$contact_number)
  26006.     {
  26007.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Contacts';
  26008.         $request $this->getContactByContactNumberRequest($xero_tenant_id$contact_number);
  26009.         return $this->client
  26010.             ->sendAsync($request$this->createHttpClientOption())
  26011.             ->then(
  26012.                 function ($response) use ($returnType) {
  26013.                     $responseBody $response->getBody();
  26014.                     if ($returnType === '\SplFileObject') {
  26015.                         $content $responseBody//stream goes to serializer
  26016.                     } else {
  26017.                         $content $responseBody->getContents();
  26018.                     }
  26019.                     return [
  26020.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  26021.                         $response->getStatusCode(),
  26022.                         $response->getHeaders()
  26023.                     ];
  26024.                 },
  26025.                 function ($exception) {
  26026.                     $response $exception->getResponse();
  26027.                     $statusCode $response->getStatusCode();
  26028.                     throw new ApiException(
  26029.                         sprintf(
  26030.                             '[%d] Error connecting to the API (%s)',
  26031.                             $statusCode,
  26032.                             $exception->getRequest()->getUri()
  26033.                         ),
  26034.                         $statusCode,
  26035.                         $response->getHeaders(),
  26036.                         $response->getBody()
  26037.                     );
  26038.                 }
  26039.             );
  26040.     }
  26041.     /**
  26042.      * Create request for operation 'getContactByContactNumber'
  26043.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  26044.      * @param  string $contact_number This field is read only on the Xero contact screen, used to identify contacts in external systems (max length &#x3D; 50). (required)
  26045.      * @throws \InvalidArgumentException
  26046.      * @return \GuzzleHttp\Psr7\Request  */
  26047.     protected function getContactByContactNumberRequest($xero_tenant_id$contact_number)
  26048.     {
  26049.         // verify the required parameter 'xero_tenant_id' is set
  26050.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  26051.             throw new \InvalidArgumentException(
  26052.                 'Missing the required parameter $xero_tenant_id when calling getContactByContactNumber'
  26053.             );
  26054.         }
  26055.         // verify the required parameter 'contact_number' is set
  26056.         if ($contact_number === null || (is_array($contact_number) && count($contact_number) === 0)) {
  26057.             throw new \InvalidArgumentException(
  26058.                 'Missing the required parameter $contact_number when calling getContactByContactNumber'
  26059.             );
  26060.         }
  26061.         $resourcePath '/Contacts/{ContactNumber}';
  26062.         $formParams = [];
  26063.         $queryParams = [];
  26064.         $headerParams = [];
  26065.         $httpBody '';
  26066.         $multipart false;
  26067.         // header params
  26068.         if ($xero_tenant_id !== null) {
  26069.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  26070.         }
  26071.         // path params
  26072.         if ($contact_number !== null) {
  26073.             $resourcePath str_replace(
  26074.                 '{' 'ContactNumber' '}',
  26075.                 AccountingObjectSerializer::toPathValue($contact_number),
  26076.                 $resourcePath
  26077.             );
  26078.         }
  26079.         // body params
  26080.         $_tempBody null;
  26081.         if ($multipart) {
  26082.             $headers $this->headerSelector->selectHeadersForMultipart(
  26083.                 ['application/json']
  26084.             );
  26085.         } else {
  26086.             $headers $this->headerSelector->selectHeaders(
  26087.                 ['application/json'],
  26088.                 []
  26089.             );
  26090.         }
  26091.         // for model (json/xml)
  26092.         if (isset($_tempBody)) {
  26093.             // $_tempBody is the method argument, if present
  26094.             if ($headers['Content-Type'] === 'application/json') {
  26095.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  26096.             } else {
  26097.                 $httpBody $_tempBody;
  26098.             }
  26099.         } elseif (count($formParams) > 0) {
  26100.             if ($multipart) {
  26101.                 $multipartContents = [
  26102.                     [
  26103.                         'Content-type' => 'multipart/form-data',
  26104.                     ]
  26105.                 ];
  26106.                 
  26107.                 // for HTTP post (form)
  26108.                 $httpBody = new MultipartStream($multipartContents);
  26109.             } elseif ($headers['Content-Type'] === 'application/json') {
  26110.                 $httpBody \GuzzleHttp\json_encode($formParams);
  26111.             } else {
  26112.                 // for HTTP post (form)
  26113.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  26114.             }
  26115.         }
  26116.         // this endpoint requires OAuth (access token)
  26117.         if ($this->config->getAccessToken() !== null) {
  26118.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  26119.         }
  26120.         $defaultHeaders = [];
  26121.         if ($this->config->getUserAgent()) {
  26122.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  26123.         }
  26124.         $headers array_merge(
  26125.             $defaultHeaders,
  26126.             $headerParams,
  26127.             $headers
  26128.         );
  26129.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  26130.         return new Request(
  26131.             'GET',
  26132.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  26133.             $headers,
  26134.             $httpBody
  26135.         );
  26136.     }
  26137.     /**
  26138.      * Operation getContactCISSettings
  26139.      * Retrieves CIS settings for a specific contact in a Xero organisation
  26140.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  26141.      * @param  string $contact_id Unique identifier for a Contact (required)
  26142.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  26143.      * @throws \InvalidArgumentException
  26144.      * @return \XeroAPI\XeroPHP\Models\Accounting\CISSettings
  26145.      */
  26146.     public function getContactCISSettings($xero_tenant_id$contact_id)
  26147.     {
  26148.         list($response) = $this->getContactCISSettingsWithHttpInfo($xero_tenant_id$contact_id);
  26149.         return $response;
  26150.     }
  26151.     /**
  26152.      * Operation getContactCISSettingsWithHttpInfo
  26153.      * Retrieves CIS settings for a specific contact in a Xero organisation
  26154.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  26155.      * @param  string $contact_id Unique identifier for a Contact (required)
  26156.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  26157.      * @throws \InvalidArgumentException
  26158.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\CISSettings, HTTP status code, HTTP response headers (array of strings)
  26159.      */
  26160.     public function getContactCISSettingsWithHttpInfo($xero_tenant_id$contact_id)
  26161.     {
  26162.         $request $this->getContactCISSettingsRequest($xero_tenant_id$contact_id);
  26163.         try {
  26164.             $options $this->createHttpClientOption();
  26165.             try {
  26166.                 $response $this->client->send($request$options);
  26167.             } catch (RequestException $e) {
  26168.                 throw new ApiException(
  26169.                     "[{$e->getCode()}{$e->getMessage()}",
  26170.                     $e->getCode(),
  26171.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  26172.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  26173.                 );
  26174.             }
  26175.             $statusCode $response->getStatusCode();
  26176.             if ($statusCode 200 || $statusCode 299) {
  26177.                 throw new ApiException(
  26178.                     sprintf(
  26179.                         '[%d] Error connecting to the API (%s)',
  26180.                         $statusCode,
  26181.                         $request->getUri()
  26182.                     ),
  26183.                     $statusCode,
  26184.                     $response->getHeaders(),
  26185.                     $response->getBody()
  26186.                 );
  26187.             }
  26188.             $responseBody $response->getBody();
  26189.             switch($statusCode) {
  26190.                 case 200:
  26191.                     if ('\XeroAPI\XeroPHP\Models\Accounting\CISSettings' === '\SplFileObject') {
  26192.                         $content $responseBody//stream goes to serializer
  26193.                     } else {
  26194.                         $content $responseBody->getContents();
  26195.                     }
  26196.                     return [
  26197.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\CISSettings', []),
  26198.                         $response->getStatusCode(),
  26199.                         $response->getHeaders()
  26200.                     ];
  26201.             }
  26202.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\CISSettings';
  26203.             $responseBody $response->getBody();
  26204.             if ($returnType === '\SplFileObject') {
  26205.                 $content $responseBody//stream goes to serializer
  26206.             } else {
  26207.                 $content $responseBody->getContents();
  26208.             }
  26209.             return [
  26210.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  26211.                 $response->getStatusCode(),
  26212.                 $response->getHeaders()
  26213.             ];
  26214.         } catch (ApiException $e) {
  26215.             switch ($e->getCode()) {
  26216.                 case 200:
  26217.                     $data AccountingObjectSerializer::deserialize(
  26218.                         $e->getResponseBody(),
  26219.                         '\XeroAPI\XeroPHP\Models\Accounting\CISSettings',
  26220.                         $e->getResponseHeaders()
  26221.                     );
  26222.                     $e->setResponseObject($data);
  26223.                     break;
  26224.             }
  26225.             throw $e;
  26226.         }
  26227.     }
  26228.     /**
  26229.      * Operation getContactCISSettingsAsync
  26230.      * Retrieves CIS settings for a specific contact in a Xero organisation
  26231.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  26232.      * @param  string $contact_id Unique identifier for a Contact (required)
  26233.      * @throws \InvalidArgumentException
  26234.      * @return \GuzzleHttp\Promise\PromiseInterface
  26235.      */
  26236.     public function getContactCISSettingsAsync($xero_tenant_id$contact_id)
  26237.     {
  26238.         return $this->getContactCISSettingsAsyncWithHttpInfo($xero_tenant_id$contact_id)
  26239.             ->then(
  26240.                 function ($response) {
  26241.                     return $response[0];
  26242.                 }
  26243.             );
  26244.     }
  26245.     /**
  26246.      * Operation getContactCISSettingsAsyncWithHttpInfo
  26247.      * Retrieves CIS settings for a specific contact in a Xero organisation
  26248.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  26249.      * @param  string $contact_id Unique identifier for a Contact (required)
  26250.      * @throws \InvalidArgumentException
  26251.      * @return \GuzzleHttp\Promise\PromiseInterface */
  26252.     public function getContactCISSettingsAsyncWithHttpInfo($xero_tenant_id$contact_id)
  26253.     {
  26254.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\CISSettings';
  26255.         $request $this->getContactCISSettingsRequest($xero_tenant_id$contact_id);
  26256.         return $this->client
  26257.             ->sendAsync($request$this->createHttpClientOption())
  26258.             ->then(
  26259.                 function ($response) use ($returnType) {
  26260.                     $responseBody $response->getBody();
  26261.                     if ($returnType === '\SplFileObject') {
  26262.                         $content $responseBody//stream goes to serializer
  26263.                     } else {
  26264.                         $content $responseBody->getContents();
  26265.                     }
  26266.                     return [
  26267.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  26268.                         $response->getStatusCode(),
  26269.                         $response->getHeaders()
  26270.                     ];
  26271.                 },
  26272.                 function ($exception) {
  26273.                     $response $exception->getResponse();
  26274.                     $statusCode $response->getStatusCode();
  26275.                     throw new ApiException(
  26276.                         sprintf(
  26277.                             '[%d] Error connecting to the API (%s)',
  26278.                             $statusCode,
  26279.                             $exception->getRequest()->getUri()
  26280.                         ),
  26281.                         $statusCode,
  26282.                         $response->getHeaders(),
  26283.                         $response->getBody()
  26284.                     );
  26285.                 }
  26286.             );
  26287.     }
  26288.     /**
  26289.      * Create request for operation 'getContactCISSettings'
  26290.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  26291.      * @param  string $contact_id Unique identifier for a Contact (required)
  26292.      * @throws \InvalidArgumentException
  26293.      * @return \GuzzleHttp\Psr7\Request  */
  26294.     protected function getContactCISSettingsRequest($xero_tenant_id$contact_id)
  26295.     {
  26296.         // verify the required parameter 'xero_tenant_id' is set
  26297.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  26298.             throw new \InvalidArgumentException(
  26299.                 'Missing the required parameter $xero_tenant_id when calling getContactCISSettings'
  26300.             );
  26301.         }
  26302.         // verify the required parameter 'contact_id' is set
  26303.         if ($contact_id === null || (is_array($contact_id) && count($contact_id) === 0)) {
  26304.             throw new \InvalidArgumentException(
  26305.                 'Missing the required parameter $contact_id when calling getContactCISSettings'
  26306.             );
  26307.         }
  26308.         $resourcePath '/Contacts/{ContactID}/CISSettings';
  26309.         $formParams = [];
  26310.         $queryParams = [];
  26311.         $headerParams = [];
  26312.         $httpBody '';
  26313.         $multipart false;
  26314.         // header params
  26315.         if ($xero_tenant_id !== null) {
  26316.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  26317.         }
  26318.         // path params
  26319.         if ($contact_id !== null) {
  26320.             $resourcePath str_replace(
  26321.                 '{' 'ContactID' '}',
  26322.                 AccountingObjectSerializer::toPathValue($contact_id),
  26323.                 $resourcePath
  26324.             );
  26325.         }
  26326.         // body params
  26327.         $_tempBody null;
  26328.         if ($multipart) {
  26329.             $headers $this->headerSelector->selectHeadersForMultipart(
  26330.                 ['application/json']
  26331.             );
  26332.         } else {
  26333.             $headers $this->headerSelector->selectHeaders(
  26334.                 ['application/json'],
  26335.                 []
  26336.             );
  26337.         }
  26338.         // for model (json/xml)
  26339.         if (isset($_tempBody)) {
  26340.             // $_tempBody is the method argument, if present
  26341.             if ($headers['Content-Type'] === 'application/json') {
  26342.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  26343.             } else {
  26344.                 $httpBody $_tempBody;
  26345.             }
  26346.         } elseif (count($formParams) > 0) {
  26347.             if ($multipart) {
  26348.                 $multipartContents = [
  26349.                     [
  26350.                         'Content-type' => 'multipart/form-data',
  26351.                     ]
  26352.                 ];
  26353.                 
  26354.                 // for HTTP post (form)
  26355.                 $httpBody = new MultipartStream($multipartContents);
  26356.             } elseif ($headers['Content-Type'] === 'application/json') {
  26357.                 $httpBody \GuzzleHttp\json_encode($formParams);
  26358.             } else {
  26359.                 // for HTTP post (form)
  26360.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  26361.             }
  26362.         }
  26363.         // this endpoint requires OAuth (access token)
  26364.         if ($this->config->getAccessToken() !== null) {
  26365.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  26366.         }
  26367.         $defaultHeaders = [];
  26368.         if ($this->config->getUserAgent()) {
  26369.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  26370.         }
  26371.         $headers array_merge(
  26372.             $defaultHeaders,
  26373.             $headerParams,
  26374.             $headers
  26375.         );
  26376.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  26377.         return new Request(
  26378.             'GET',
  26379.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  26380.             $headers,
  26381.             $httpBody
  26382.         );
  26383.     }
  26384.     /**
  26385.      * Operation getContactGroup
  26386.      * Retrieves a specific contact group by using a unique contact group Id
  26387.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  26388.      * @param  string $contact_group_id Unique identifier for a Contact Group (required)
  26389.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  26390.      * @throws \InvalidArgumentException
  26391.      * @return \XeroAPI\XeroPHP\Models\Accounting\ContactGroups
  26392.      */
  26393.     public function getContactGroup($xero_tenant_id$contact_group_id)
  26394.     {
  26395.         list($response) = $this->getContactGroupWithHttpInfo($xero_tenant_id$contact_group_id);
  26396.         return $response;
  26397.     }
  26398.     /**
  26399.      * Operation getContactGroupWithHttpInfo
  26400.      * Retrieves a specific contact group by using a unique contact group Id
  26401.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  26402.      * @param  string $contact_group_id Unique identifier for a Contact Group (required)
  26403.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  26404.      * @throws \InvalidArgumentException
  26405.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\ContactGroups, HTTP status code, HTTP response headers (array of strings)
  26406.      */
  26407.     public function getContactGroupWithHttpInfo($xero_tenant_id$contact_group_id)
  26408.     {
  26409.         $request $this->getContactGroupRequest($xero_tenant_id$contact_group_id);
  26410.         try {
  26411.             $options $this->createHttpClientOption();
  26412.             try {
  26413.                 $response $this->client->send($request$options);
  26414.             } catch (RequestException $e) {
  26415.                 throw new ApiException(
  26416.                     "[{$e->getCode()}{$e->getMessage()}",
  26417.                     $e->getCode(),
  26418.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  26419.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  26420.                 );
  26421.             }
  26422.             $statusCode $response->getStatusCode();
  26423.             if ($statusCode 200 || $statusCode 299) {
  26424.                 throw new ApiException(
  26425.                     sprintf(
  26426.                         '[%d] Error connecting to the API (%s)',
  26427.                         $statusCode,
  26428.                         $request->getUri()
  26429.                     ),
  26430.                     $statusCode,
  26431.                     $response->getHeaders(),
  26432.                     $response->getBody()
  26433.                 );
  26434.             }
  26435.             $responseBody $response->getBody();
  26436.             switch($statusCode) {
  26437.                 case 200:
  26438.                     if ('\XeroAPI\XeroPHP\Models\Accounting\ContactGroups' === '\SplFileObject') {
  26439.                         $content $responseBody//stream goes to serializer
  26440.                     } else {
  26441.                         $content $responseBody->getContents();
  26442.                     }
  26443.                     return [
  26444.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\ContactGroups', []),
  26445.                         $response->getStatusCode(),
  26446.                         $response->getHeaders()
  26447.                     ];
  26448.             }
  26449.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\ContactGroups';
  26450.             $responseBody $response->getBody();
  26451.             if ($returnType === '\SplFileObject') {
  26452.                 $content $responseBody//stream goes to serializer
  26453.             } else {
  26454.                 $content $responseBody->getContents();
  26455.             }
  26456.             return [
  26457.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  26458.                 $response->getStatusCode(),
  26459.                 $response->getHeaders()
  26460.             ];
  26461.         } catch (ApiException $e) {
  26462.             switch ($e->getCode()) {
  26463.                 case 200:
  26464.                     $data AccountingObjectSerializer::deserialize(
  26465.                         $e->getResponseBody(),
  26466.                         '\XeroAPI\XeroPHP\Models\Accounting\ContactGroups',
  26467.                         $e->getResponseHeaders()
  26468.                     );
  26469.                     $e->setResponseObject($data);
  26470.                     break;
  26471.             }
  26472.             throw $e;
  26473.         }
  26474.     }
  26475.     /**
  26476.      * Operation getContactGroupAsync
  26477.      * Retrieves a specific contact group by using a unique contact group Id
  26478.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  26479.      * @param  string $contact_group_id Unique identifier for a Contact Group (required)
  26480.      * @throws \InvalidArgumentException
  26481.      * @return \GuzzleHttp\Promise\PromiseInterface
  26482.      */
  26483.     public function getContactGroupAsync($xero_tenant_id$contact_group_id)
  26484.     {
  26485.         return $this->getContactGroupAsyncWithHttpInfo($xero_tenant_id$contact_group_id)
  26486.             ->then(
  26487.                 function ($response) {
  26488.                     return $response[0];
  26489.                 }
  26490.             );
  26491.     }
  26492.     /**
  26493.      * Operation getContactGroupAsyncWithHttpInfo
  26494.      * Retrieves a specific contact group by using a unique contact group Id
  26495.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  26496.      * @param  string $contact_group_id Unique identifier for a Contact Group (required)
  26497.      * @throws \InvalidArgumentException
  26498.      * @return \GuzzleHttp\Promise\PromiseInterface */
  26499.     public function getContactGroupAsyncWithHttpInfo($xero_tenant_id$contact_group_id)
  26500.     {
  26501.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\ContactGroups';
  26502.         $request $this->getContactGroupRequest($xero_tenant_id$contact_group_id);
  26503.         return $this->client
  26504.             ->sendAsync($request$this->createHttpClientOption())
  26505.             ->then(
  26506.                 function ($response) use ($returnType) {
  26507.                     $responseBody $response->getBody();
  26508.                     if ($returnType === '\SplFileObject') {
  26509.                         $content $responseBody//stream goes to serializer
  26510.                     } else {
  26511.                         $content $responseBody->getContents();
  26512.                     }
  26513.                     return [
  26514.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  26515.                         $response->getStatusCode(),
  26516.                         $response->getHeaders()
  26517.                     ];
  26518.                 },
  26519.                 function ($exception) {
  26520.                     $response $exception->getResponse();
  26521.                     $statusCode $response->getStatusCode();
  26522.                     throw new ApiException(
  26523.                         sprintf(
  26524.                             '[%d] Error connecting to the API (%s)',
  26525.                             $statusCode,
  26526.                             $exception->getRequest()->getUri()
  26527.                         ),
  26528.                         $statusCode,
  26529.                         $response->getHeaders(),
  26530.                         $response->getBody()
  26531.                     );
  26532.                 }
  26533.             );
  26534.     }
  26535.     /**
  26536.      * Create request for operation 'getContactGroup'
  26537.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  26538.      * @param  string $contact_group_id Unique identifier for a Contact Group (required)
  26539.      * @throws \InvalidArgumentException
  26540.      * @return \GuzzleHttp\Psr7\Request  */
  26541.     protected function getContactGroupRequest($xero_tenant_id$contact_group_id)
  26542.     {
  26543.         // verify the required parameter 'xero_tenant_id' is set
  26544.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  26545.             throw new \InvalidArgumentException(
  26546.                 'Missing the required parameter $xero_tenant_id when calling getContactGroup'
  26547.             );
  26548.         }
  26549.         // verify the required parameter 'contact_group_id' is set
  26550.         if ($contact_group_id === null || (is_array($contact_group_id) && count($contact_group_id) === 0)) {
  26551.             throw new \InvalidArgumentException(
  26552.                 'Missing the required parameter $contact_group_id when calling getContactGroup'
  26553.             );
  26554.         }
  26555.         $resourcePath '/ContactGroups/{ContactGroupID}';
  26556.         $formParams = [];
  26557.         $queryParams = [];
  26558.         $headerParams = [];
  26559.         $httpBody '';
  26560.         $multipart false;
  26561.         // header params
  26562.         if ($xero_tenant_id !== null) {
  26563.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  26564.         }
  26565.         // path params
  26566.         if ($contact_group_id !== null) {
  26567.             $resourcePath str_replace(
  26568.                 '{' 'ContactGroupID' '}',
  26569.                 AccountingObjectSerializer::toPathValue($contact_group_id),
  26570.                 $resourcePath
  26571.             );
  26572.         }
  26573.         // body params
  26574.         $_tempBody null;
  26575.         if ($multipart) {
  26576.             $headers $this->headerSelector->selectHeadersForMultipart(
  26577.                 ['application/json']
  26578.             );
  26579.         } else {
  26580.             $headers $this->headerSelector->selectHeaders(
  26581.                 ['application/json'],
  26582.                 []
  26583.             );
  26584.         }
  26585.         // for model (json/xml)
  26586.         if (isset($_tempBody)) {
  26587.             // $_tempBody is the method argument, if present
  26588.             if ($headers['Content-Type'] === 'application/json') {
  26589.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  26590.             } else {
  26591.                 $httpBody $_tempBody;
  26592.             }
  26593.         } elseif (count($formParams) > 0) {
  26594.             if ($multipart) {
  26595.                 $multipartContents = [
  26596.                     [
  26597.                         'Content-type' => 'multipart/form-data',
  26598.                     ]
  26599.                 ];
  26600.                 
  26601.                 // for HTTP post (form)
  26602.                 $httpBody = new MultipartStream($multipartContents);
  26603.             } elseif ($headers['Content-Type'] === 'application/json') {
  26604.                 $httpBody \GuzzleHttp\json_encode($formParams);
  26605.             } else {
  26606.                 // for HTTP post (form)
  26607.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  26608.             }
  26609.         }
  26610.         // this endpoint requires OAuth (access token)
  26611.         if ($this->config->getAccessToken() !== null) {
  26612.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  26613.         }
  26614.         $defaultHeaders = [];
  26615.         if ($this->config->getUserAgent()) {
  26616.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  26617.         }
  26618.         $headers array_merge(
  26619.             $defaultHeaders,
  26620.             $headerParams,
  26621.             $headers
  26622.         );
  26623.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  26624.         return new Request(
  26625.             'GET',
  26626.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  26627.             $headers,
  26628.             $httpBody
  26629.         );
  26630.     }
  26631.     /**
  26632.      * Operation getContactGroups
  26633.      * Retrieves the contact Id and name of each contact group
  26634.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  26635.      * @param  string $where Filter by an any element (optional)
  26636.      * @param  string $order Order by an any element (optional)
  26637.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  26638.      * @throws \InvalidArgumentException
  26639.      * @return \XeroAPI\XeroPHP\Models\Accounting\ContactGroups
  26640.      */
  26641.     public function getContactGroups($xero_tenant_id$where null$order null)
  26642.     {
  26643.         list($response) = $this->getContactGroupsWithHttpInfo($xero_tenant_id$where$order);
  26644.         return $response;
  26645.     }
  26646.     /**
  26647.      * Operation getContactGroupsWithHttpInfo
  26648.      * Retrieves the contact Id and name of each contact group
  26649.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  26650.      * @param  string $where Filter by an any element (optional)
  26651.      * @param  string $order Order by an any element (optional)
  26652.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  26653.      * @throws \InvalidArgumentException
  26654.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\ContactGroups, HTTP status code, HTTP response headers (array of strings)
  26655.      */
  26656.     public function getContactGroupsWithHttpInfo($xero_tenant_id$where null$order null)
  26657.     {
  26658.         $request $this->getContactGroupsRequest($xero_tenant_id$where$order);
  26659.         try {
  26660.             $options $this->createHttpClientOption();
  26661.             try {
  26662.                 $response $this->client->send($request$options);
  26663.             } catch (RequestException $e) {
  26664.                 throw new ApiException(
  26665.                     "[{$e->getCode()}{$e->getMessage()}",
  26666.                     $e->getCode(),
  26667.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  26668.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  26669.                 );
  26670.             }
  26671.             $statusCode $response->getStatusCode();
  26672.             if ($statusCode 200 || $statusCode 299) {
  26673.                 throw new ApiException(
  26674.                     sprintf(
  26675.                         '[%d] Error connecting to the API (%s)',
  26676.                         $statusCode,
  26677.                         $request->getUri()
  26678.                     ),
  26679.                     $statusCode,
  26680.                     $response->getHeaders(),
  26681.                     $response->getBody()
  26682.                 );
  26683.             }
  26684.             $responseBody $response->getBody();
  26685.             switch($statusCode) {
  26686.                 case 200:
  26687.                     if ('\XeroAPI\XeroPHP\Models\Accounting\ContactGroups' === '\SplFileObject') {
  26688.                         $content $responseBody//stream goes to serializer
  26689.                     } else {
  26690.                         $content $responseBody->getContents();
  26691.                     }
  26692.                     return [
  26693.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\ContactGroups', []),
  26694.                         $response->getStatusCode(),
  26695.                         $response->getHeaders()
  26696.                     ];
  26697.             }
  26698.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\ContactGroups';
  26699.             $responseBody $response->getBody();
  26700.             if ($returnType === '\SplFileObject') {
  26701.                 $content $responseBody//stream goes to serializer
  26702.             } else {
  26703.                 $content $responseBody->getContents();
  26704.             }
  26705.             return [
  26706.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  26707.                 $response->getStatusCode(),
  26708.                 $response->getHeaders()
  26709.             ];
  26710.         } catch (ApiException $e) {
  26711.             switch ($e->getCode()) {
  26712.                 case 200:
  26713.                     $data AccountingObjectSerializer::deserialize(
  26714.                         $e->getResponseBody(),
  26715.                         '\XeroAPI\XeroPHP\Models\Accounting\ContactGroups',
  26716.                         $e->getResponseHeaders()
  26717.                     );
  26718.                     $e->setResponseObject($data);
  26719.                     break;
  26720.             }
  26721.             throw $e;
  26722.         }
  26723.     }
  26724.     /**
  26725.      * Operation getContactGroupsAsync
  26726.      * Retrieves the contact Id and name of each contact group
  26727.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  26728.      * @param  string $where Filter by an any element (optional)
  26729.      * @param  string $order Order by an any element (optional)
  26730.      * @throws \InvalidArgumentException
  26731.      * @return \GuzzleHttp\Promise\PromiseInterface
  26732.      */
  26733.     public function getContactGroupsAsync($xero_tenant_id$where null$order null)
  26734.     {
  26735.         return $this->getContactGroupsAsyncWithHttpInfo($xero_tenant_id$where$order)
  26736.             ->then(
  26737.                 function ($response) {
  26738.                     return $response[0];
  26739.                 }
  26740.             );
  26741.     }
  26742.     /**
  26743.      * Operation getContactGroupsAsyncWithHttpInfo
  26744.      * Retrieves the contact Id and name of each contact group
  26745.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  26746.      * @param  string $where Filter by an any element (optional)
  26747.      * @param  string $order Order by an any element (optional)
  26748.      * @throws \InvalidArgumentException
  26749.      * @return \GuzzleHttp\Promise\PromiseInterface */
  26750.     public function getContactGroupsAsyncWithHttpInfo($xero_tenant_id$where null$order null)
  26751.     {
  26752.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\ContactGroups';
  26753.         $request $this->getContactGroupsRequest($xero_tenant_id$where$order);
  26754.         return $this->client
  26755.             ->sendAsync($request$this->createHttpClientOption())
  26756.             ->then(
  26757.                 function ($response) use ($returnType) {
  26758.                     $responseBody $response->getBody();
  26759.                     if ($returnType === '\SplFileObject') {
  26760.                         $content $responseBody//stream goes to serializer
  26761.                     } else {
  26762.                         $content $responseBody->getContents();
  26763.                     }
  26764.                     return [
  26765.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  26766.                         $response->getStatusCode(),
  26767.                         $response->getHeaders()
  26768.                     ];
  26769.                 },
  26770.                 function ($exception) {
  26771.                     $response $exception->getResponse();
  26772.                     $statusCode $response->getStatusCode();
  26773.                     throw new ApiException(
  26774.                         sprintf(
  26775.                             '[%d] Error connecting to the API (%s)',
  26776.                             $statusCode,
  26777.                             $exception->getRequest()->getUri()
  26778.                         ),
  26779.                         $statusCode,
  26780.                         $response->getHeaders(),
  26781.                         $response->getBody()
  26782.                     );
  26783.                 }
  26784.             );
  26785.     }
  26786.     /**
  26787.      * Create request for operation 'getContactGroups'
  26788.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  26789.      * @param  string $where Filter by an any element (optional)
  26790.      * @param  string $order Order by an any element (optional)
  26791.      * @throws \InvalidArgumentException
  26792.      * @return \GuzzleHttp\Psr7\Request  */
  26793.     protected function getContactGroupsRequest($xero_tenant_id$where null$order null)
  26794.     {
  26795.         // verify the required parameter 'xero_tenant_id' is set
  26796.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  26797.             throw new \InvalidArgumentException(
  26798.                 'Missing the required parameter $xero_tenant_id when calling getContactGroups'
  26799.             );
  26800.         }
  26801.         $resourcePath '/ContactGroups';
  26802.         $formParams = [];
  26803.         $queryParams = [];
  26804.         $headerParams = [];
  26805.         $httpBody '';
  26806.         $multipart false;
  26807.         // query params
  26808.         if ($where !== null) {
  26809.             $queryParams['where'] = AccountingObjectSerializer::toQueryValue($where);
  26810.         }
  26811.         // query params
  26812.         if ($order !== null) {
  26813.             $queryParams['order'] = AccountingObjectSerializer::toQueryValue($order);
  26814.         }
  26815.         // header params
  26816.         if ($xero_tenant_id !== null) {
  26817.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  26818.         }
  26819.         // body params
  26820.         $_tempBody null;
  26821.         if ($multipart) {
  26822.             $headers $this->headerSelector->selectHeadersForMultipart(
  26823.                 ['application/json']
  26824.             );
  26825.         } else {
  26826.             $headers $this->headerSelector->selectHeaders(
  26827.                 ['application/json'],
  26828.                 []
  26829.             );
  26830.         }
  26831.         // for model (json/xml)
  26832.         if (isset($_tempBody)) {
  26833.             // $_tempBody is the method argument, if present
  26834.             if ($headers['Content-Type'] === 'application/json') {
  26835.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  26836.             } else {
  26837.                 $httpBody $_tempBody;
  26838.             }
  26839.         } elseif (count($formParams) > 0) {
  26840.             if ($multipart) {
  26841.                 $multipartContents = [
  26842.                     [
  26843.                         'Content-type' => 'multipart/form-data',
  26844.                     ]
  26845.                 ];
  26846.                 
  26847.                 // for HTTP post (form)
  26848.                 $httpBody = new MultipartStream($multipartContents);
  26849.             } elseif ($headers['Content-Type'] === 'application/json') {
  26850.                 $httpBody \GuzzleHttp\json_encode($formParams);
  26851.             } else {
  26852.                 // for HTTP post (form)
  26853.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  26854.             }
  26855.         }
  26856.         // this endpoint requires OAuth (access token)
  26857.         if ($this->config->getAccessToken() !== null) {
  26858.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  26859.         }
  26860.         $defaultHeaders = [];
  26861.         if ($this->config->getUserAgent()) {
  26862.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  26863.         }
  26864.         $headers array_merge(
  26865.             $defaultHeaders,
  26866.             $headerParams,
  26867.             $headers
  26868.         );
  26869.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  26870.         return new Request(
  26871.             'GET',
  26872.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  26873.             $headers,
  26874.             $httpBody
  26875.         );
  26876.     }
  26877.     /**
  26878.      * Operation getContactHistory
  26879.      * Retrieves history records for a specific contact
  26880.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  26881.      * @param  string $contact_id Unique identifier for a Contact (required)
  26882.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  26883.      * @throws \InvalidArgumentException
  26884.      * @return \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords
  26885.      */
  26886.     public function getContactHistory($xero_tenant_id$contact_id)
  26887.     {
  26888.         list($response) = $this->getContactHistoryWithHttpInfo($xero_tenant_id$contact_id);
  26889.         return $response;
  26890.     }
  26891.     /**
  26892.      * Operation getContactHistoryWithHttpInfo
  26893.      * Retrieves history records for a specific contact
  26894.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  26895.      * @param  string $contact_id Unique identifier for a Contact (required)
  26896.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  26897.      * @throws \InvalidArgumentException
  26898.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords, HTTP status code, HTTP response headers (array of strings)
  26899.      */
  26900.     public function getContactHistoryWithHttpInfo($xero_tenant_id$contact_id)
  26901.     {
  26902.         $request $this->getContactHistoryRequest($xero_tenant_id$contact_id);
  26903.         try {
  26904.             $options $this->createHttpClientOption();
  26905.             try {
  26906.                 $response $this->client->send($request$options);
  26907.             } catch (RequestException $e) {
  26908.                 throw new ApiException(
  26909.                     "[{$e->getCode()}{$e->getMessage()}",
  26910.                     $e->getCode(),
  26911.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  26912.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  26913.                 );
  26914.             }
  26915.             $statusCode $response->getStatusCode();
  26916.             if ($statusCode 200 || $statusCode 299) {
  26917.                 throw new ApiException(
  26918.                     sprintf(
  26919.                         '[%d] Error connecting to the API (%s)',
  26920.                         $statusCode,
  26921.                         $request->getUri()
  26922.                     ),
  26923.                     $statusCode,
  26924.                     $response->getHeaders(),
  26925.                     $response->getBody()
  26926.                 );
  26927.             }
  26928.             $responseBody $response->getBody();
  26929.             switch($statusCode) {
  26930.                 case 200:
  26931.                     if ('\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords' === '\SplFileObject') {
  26932.                         $content $responseBody//stream goes to serializer
  26933.                     } else {
  26934.                         $content $responseBody->getContents();
  26935.                     }
  26936.                     return [
  26937.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords', []),
  26938.                         $response->getStatusCode(),
  26939.                         $response->getHeaders()
  26940.                     ];
  26941.             }
  26942.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  26943.             $responseBody $response->getBody();
  26944.             if ($returnType === '\SplFileObject') {
  26945.                 $content $responseBody//stream goes to serializer
  26946.             } else {
  26947.                 $content $responseBody->getContents();
  26948.             }
  26949.             return [
  26950.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  26951.                 $response->getStatusCode(),
  26952.                 $response->getHeaders()
  26953.             ];
  26954.         } catch (ApiException $e) {
  26955.             switch ($e->getCode()) {
  26956.                 case 200:
  26957.                     $data AccountingObjectSerializer::deserialize(
  26958.                         $e->getResponseBody(),
  26959.                         '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords',
  26960.                         $e->getResponseHeaders()
  26961.                     );
  26962.                     $e->setResponseObject($data);
  26963.                     break;
  26964.             }
  26965.             throw $e;
  26966.         }
  26967.     }
  26968.     /**
  26969.      * Operation getContactHistoryAsync
  26970.      * Retrieves history records for a specific contact
  26971.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  26972.      * @param  string $contact_id Unique identifier for a Contact (required)
  26973.      * @throws \InvalidArgumentException
  26974.      * @return \GuzzleHttp\Promise\PromiseInterface
  26975.      */
  26976.     public function getContactHistoryAsync($xero_tenant_id$contact_id)
  26977.     {
  26978.         return $this->getContactHistoryAsyncWithHttpInfo($xero_tenant_id$contact_id)
  26979.             ->then(
  26980.                 function ($response) {
  26981.                     return $response[0];
  26982.                 }
  26983.             );
  26984.     }
  26985.     /**
  26986.      * Operation getContactHistoryAsyncWithHttpInfo
  26987.      * Retrieves history records for a specific contact
  26988.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  26989.      * @param  string $contact_id Unique identifier for a Contact (required)
  26990.      * @throws \InvalidArgumentException
  26991.      * @return \GuzzleHttp\Promise\PromiseInterface */
  26992.     public function getContactHistoryAsyncWithHttpInfo($xero_tenant_id$contact_id)
  26993.     {
  26994.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  26995.         $request $this->getContactHistoryRequest($xero_tenant_id$contact_id);
  26996.         return $this->client
  26997.             ->sendAsync($request$this->createHttpClientOption())
  26998.             ->then(
  26999.                 function ($response) use ($returnType) {
  27000.                     $responseBody $response->getBody();
  27001.                     if ($returnType === '\SplFileObject') {
  27002.                         $content $responseBody//stream goes to serializer
  27003.                     } else {
  27004.                         $content $responseBody->getContents();
  27005.                     }
  27006.                     return [
  27007.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  27008.                         $response->getStatusCode(),
  27009.                         $response->getHeaders()
  27010.                     ];
  27011.                 },
  27012.                 function ($exception) {
  27013.                     $response $exception->getResponse();
  27014.                     $statusCode $response->getStatusCode();
  27015.                     throw new ApiException(
  27016.                         sprintf(
  27017.                             '[%d] Error connecting to the API (%s)',
  27018.                             $statusCode,
  27019.                             $exception->getRequest()->getUri()
  27020.                         ),
  27021.                         $statusCode,
  27022.                         $response->getHeaders(),
  27023.                         $response->getBody()
  27024.                     );
  27025.                 }
  27026.             );
  27027.     }
  27028.     /**
  27029.      * Create request for operation 'getContactHistory'
  27030.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  27031.      * @param  string $contact_id Unique identifier for a Contact (required)
  27032.      * @throws \InvalidArgumentException
  27033.      * @return \GuzzleHttp\Psr7\Request  */
  27034.     protected function getContactHistoryRequest($xero_tenant_id$contact_id)
  27035.     {
  27036.         // verify the required parameter 'xero_tenant_id' is set
  27037.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  27038.             throw new \InvalidArgumentException(
  27039.                 'Missing the required parameter $xero_tenant_id when calling getContactHistory'
  27040.             );
  27041.         }
  27042.         // verify the required parameter 'contact_id' is set
  27043.         if ($contact_id === null || (is_array($contact_id) && count($contact_id) === 0)) {
  27044.             throw new \InvalidArgumentException(
  27045.                 'Missing the required parameter $contact_id when calling getContactHistory'
  27046.             );
  27047.         }
  27048.         $resourcePath '/Contacts/{ContactID}/History';
  27049.         $formParams = [];
  27050.         $queryParams = [];
  27051.         $headerParams = [];
  27052.         $httpBody '';
  27053.         $multipart false;
  27054.         // header params
  27055.         if ($xero_tenant_id !== null) {
  27056.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  27057.         }
  27058.         // path params
  27059.         if ($contact_id !== null) {
  27060.             $resourcePath str_replace(
  27061.                 '{' 'ContactID' '}',
  27062.                 AccountingObjectSerializer::toPathValue($contact_id),
  27063.                 $resourcePath
  27064.             );
  27065.         }
  27066.         // body params
  27067.         $_tempBody null;
  27068.         if ($multipart) {
  27069.             $headers $this->headerSelector->selectHeadersForMultipart(
  27070.                 ['application/json']
  27071.             );
  27072.         } else {
  27073.             $headers $this->headerSelector->selectHeaders(
  27074.                 ['application/json'],
  27075.                 []
  27076.             );
  27077.         }
  27078.         // for model (json/xml)
  27079.         if (isset($_tempBody)) {
  27080.             // $_tempBody is the method argument, if present
  27081.             if ($headers['Content-Type'] === 'application/json') {
  27082.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  27083.             } else {
  27084.                 $httpBody $_tempBody;
  27085.             }
  27086.         } elseif (count($formParams) > 0) {
  27087.             if ($multipart) {
  27088.                 $multipartContents = [
  27089.                     [
  27090.                         'Content-type' => 'multipart/form-data',
  27091.                     ]
  27092.                 ];
  27093.                 
  27094.                 // for HTTP post (form)
  27095.                 $httpBody = new MultipartStream($multipartContents);
  27096.             } elseif ($headers['Content-Type'] === 'application/json') {
  27097.                 $httpBody \GuzzleHttp\json_encode($formParams);
  27098.             } else {
  27099.                 // for HTTP post (form)
  27100.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  27101.             }
  27102.         }
  27103.         // this endpoint requires OAuth (access token)
  27104.         if ($this->config->getAccessToken() !== null) {
  27105.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  27106.         }
  27107.         $defaultHeaders = [];
  27108.         if ($this->config->getUserAgent()) {
  27109.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  27110.         }
  27111.         $headers array_merge(
  27112.             $defaultHeaders,
  27113.             $headerParams,
  27114.             $headers
  27115.         );
  27116.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  27117.         return new Request(
  27118.             'GET',
  27119.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  27120.             $headers,
  27121.             $httpBody
  27122.         );
  27123.     }
  27124.     /**
  27125.      * Operation getContacts
  27126.      * Retrieves all contacts in a Xero organisation
  27127.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  27128.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  27129.      * @param  string $where Filter by an any element (optional)
  27130.      * @param  string $order Order by an any element (optional)
  27131.      * @param  string[] $ids Filter by a comma separated list of ContactIDs. Allows you to retrieve a specific set of contacts in a single call. (optional)
  27132.      * @param  int $page e.g. page&#x3D;1 - Up to 100 contacts will be returned in a single API call. (optional)
  27133.      * @param  bool $include_archived e.g. includeArchived&#x3D;true - Contacts with a status of ARCHIVED will be included in the response (optional)
  27134.      * @param  bool $summary_only Use summaryOnly&#x3D;true in GET Contacts and Invoices endpoint to retrieve a smaller version of the response object. This returns only lightweight fields, excluding computation-heavy fields from the response, making the API calls quick and efficient. (optional, default to false)
  27135.      * @param  string $search_term Search parameter that performs a case-insensitive text search across the Name, FirstName, LastName, ContactNumber and EmailAddress fields. (optional)
  27136.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  27137.      * @throws \InvalidArgumentException
  27138.      * @return \XeroAPI\XeroPHP\Models\Accounting\Contacts
  27139.      */
  27140.     public function getContacts($xero_tenant_id$if_modified_since null$where null$order null$ids null$page null$include_archived null$summary_only false$search_term null)
  27141.     {
  27142.         list($response) = $this->getContactsWithHttpInfo($xero_tenant_id$if_modified_since$where$order$ids$page$include_archived$summary_only$search_term);
  27143.         return $response;
  27144.     }
  27145.     /**
  27146.      * Operation getContactsWithHttpInfo
  27147.      * Retrieves all contacts in a Xero organisation
  27148.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  27149.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  27150.      * @param  string $where Filter by an any element (optional)
  27151.      * @param  string $order Order by an any element (optional)
  27152.      * @param  string[] $ids Filter by a comma separated list of ContactIDs. Allows you to retrieve a specific set of contacts in a single call. (optional)
  27153.      * @param  int $page e.g. page&#x3D;1 - Up to 100 contacts will be returned in a single API call. (optional)
  27154.      * @param  bool $include_archived e.g. includeArchived&#x3D;true - Contacts with a status of ARCHIVED will be included in the response (optional)
  27155.      * @param  bool $summary_only Use summaryOnly&#x3D;true in GET Contacts and Invoices endpoint to retrieve a smaller version of the response object. This returns only lightweight fields, excluding computation-heavy fields from the response, making the API calls quick and efficient. (optional, default to false)
  27156.      * @param  string $search_term Search parameter that performs a case-insensitive text search across the Name, FirstName, LastName, ContactNumber and EmailAddress fields. (optional)
  27157.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  27158.      * @throws \InvalidArgumentException
  27159.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Contacts, HTTP status code, HTTP response headers (array of strings)
  27160.      */
  27161.     public function getContactsWithHttpInfo($xero_tenant_id$if_modified_since null$where null$order null$ids null$page null$include_archived null$summary_only false$search_term null)
  27162.     {
  27163.         $request $this->getContactsRequest($xero_tenant_id$if_modified_since$where$order$ids$page$include_archived$summary_only$search_term);
  27164.         try {
  27165.             $options $this->createHttpClientOption();
  27166.             try {
  27167.                 $response $this->client->send($request$options);
  27168.             } catch (RequestException $e) {
  27169.                 throw new ApiException(
  27170.                     "[{$e->getCode()}{$e->getMessage()}",
  27171.                     $e->getCode(),
  27172.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  27173.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  27174.                 );
  27175.             }
  27176.             $statusCode $response->getStatusCode();
  27177.             if ($statusCode 200 || $statusCode 299) {
  27178.                 throw new ApiException(
  27179.                     sprintf(
  27180.                         '[%d] Error connecting to the API (%s)',
  27181.                         $statusCode,
  27182.                         $request->getUri()
  27183.                     ),
  27184.                     $statusCode,
  27185.                     $response->getHeaders(),
  27186.                     $response->getBody()
  27187.                 );
  27188.             }
  27189.             $responseBody $response->getBody();
  27190.             switch($statusCode) {
  27191.                 case 200:
  27192.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Contacts' === '\SplFileObject') {
  27193.                         $content $responseBody//stream goes to serializer
  27194.                     } else {
  27195.                         $content $responseBody->getContents();
  27196.                     }
  27197.                     return [
  27198.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Contacts', []),
  27199.                         $response->getStatusCode(),
  27200.                         $response->getHeaders()
  27201.                     ];
  27202.             }
  27203.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Contacts';
  27204.             $responseBody $response->getBody();
  27205.             if ($returnType === '\SplFileObject') {
  27206.                 $content $responseBody//stream goes to serializer
  27207.             } else {
  27208.                 $content $responseBody->getContents();
  27209.             }
  27210.             return [
  27211.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  27212.                 $response->getStatusCode(),
  27213.                 $response->getHeaders()
  27214.             ];
  27215.         } catch (ApiException $e) {
  27216.             switch ($e->getCode()) {
  27217.                 case 200:
  27218.                     $data AccountingObjectSerializer::deserialize(
  27219.                         $e->getResponseBody(),
  27220.                         '\XeroAPI\XeroPHP\Models\Accounting\Contacts',
  27221.                         $e->getResponseHeaders()
  27222.                     );
  27223.                     $e->setResponseObject($data);
  27224.                     break;
  27225.             }
  27226.             throw $e;
  27227.         }
  27228.     }
  27229.     /**
  27230.      * Operation getContactsAsync
  27231.      * Retrieves all contacts in a Xero organisation
  27232.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  27233.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  27234.      * @param  string $where Filter by an any element (optional)
  27235.      * @param  string $order Order by an any element (optional)
  27236.      * @param  string[] $ids Filter by a comma separated list of ContactIDs. Allows you to retrieve a specific set of contacts in a single call. (optional)
  27237.      * @param  int $page e.g. page&#x3D;1 - Up to 100 contacts will be returned in a single API call. (optional)
  27238.      * @param  bool $include_archived e.g. includeArchived&#x3D;true - Contacts with a status of ARCHIVED will be included in the response (optional)
  27239.      * @param  bool $summary_only Use summaryOnly&#x3D;true in GET Contacts and Invoices endpoint to retrieve a smaller version of the response object. This returns only lightweight fields, excluding computation-heavy fields from the response, making the API calls quick and efficient. (optional, default to false)
  27240.      * @param  string $search_term Search parameter that performs a case-insensitive text search across the Name, FirstName, LastName, ContactNumber and EmailAddress fields. (optional)
  27241.      * @throws \InvalidArgumentException
  27242.      * @return \GuzzleHttp\Promise\PromiseInterface
  27243.      */
  27244.     public function getContactsAsync($xero_tenant_id$if_modified_since null$where null$order null$ids null$page null$include_archived null$summary_only false$search_term null)
  27245.     {
  27246.         return $this->getContactsAsyncWithHttpInfo($xero_tenant_id$if_modified_since$where$order$ids$page$include_archived$summary_only$search_term)
  27247.             ->then(
  27248.                 function ($response) {
  27249.                     return $response[0];
  27250.                 }
  27251.             );
  27252.     }
  27253.     /**
  27254.      * Operation getContactsAsyncWithHttpInfo
  27255.      * Retrieves all contacts in a Xero organisation
  27256.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  27257.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  27258.      * @param  string $where Filter by an any element (optional)
  27259.      * @param  string $order Order by an any element (optional)
  27260.      * @param  string[] $ids Filter by a comma separated list of ContactIDs. Allows you to retrieve a specific set of contacts in a single call. (optional)
  27261.      * @param  int $page e.g. page&#x3D;1 - Up to 100 contacts will be returned in a single API call. (optional)
  27262.      * @param  bool $include_archived e.g. includeArchived&#x3D;true - Contacts with a status of ARCHIVED will be included in the response (optional)
  27263.      * @param  bool $summary_only Use summaryOnly&#x3D;true in GET Contacts and Invoices endpoint to retrieve a smaller version of the response object. This returns only lightweight fields, excluding computation-heavy fields from the response, making the API calls quick and efficient. (optional, default to false)
  27264.      * @param  string $search_term Search parameter that performs a case-insensitive text search across the Name, FirstName, LastName, ContactNumber and EmailAddress fields. (optional)
  27265.      * @throws \InvalidArgumentException
  27266.      * @return \GuzzleHttp\Promise\PromiseInterface */
  27267.     public function getContactsAsyncWithHttpInfo($xero_tenant_id$if_modified_since null$where null$order null$ids null$page null$include_archived null$summary_only false$search_term null)
  27268.     {
  27269.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Contacts';
  27270.         $request $this->getContactsRequest($xero_tenant_id$if_modified_since$where$order$ids$page$include_archived$summary_only$search_term);
  27271.         return $this->client
  27272.             ->sendAsync($request$this->createHttpClientOption())
  27273.             ->then(
  27274.                 function ($response) use ($returnType) {
  27275.                     $responseBody $response->getBody();
  27276.                     if ($returnType === '\SplFileObject') {
  27277.                         $content $responseBody//stream goes to serializer
  27278.                     } else {
  27279.                         $content $responseBody->getContents();
  27280.                     }
  27281.                     return [
  27282.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  27283.                         $response->getStatusCode(),
  27284.                         $response->getHeaders()
  27285.                     ];
  27286.                 },
  27287.                 function ($exception) {
  27288.                     $response $exception->getResponse();
  27289.                     $statusCode $response->getStatusCode();
  27290.                     throw new ApiException(
  27291.                         sprintf(
  27292.                             '[%d] Error connecting to the API (%s)',
  27293.                             $statusCode,
  27294.                             $exception->getRequest()->getUri()
  27295.                         ),
  27296.                         $statusCode,
  27297.                         $response->getHeaders(),
  27298.                         $response->getBody()
  27299.                     );
  27300.                 }
  27301.             );
  27302.     }
  27303.     /**
  27304.      * Create request for operation 'getContacts'
  27305.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  27306.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  27307.      * @param  string $where Filter by an any element (optional)
  27308.      * @param  string $order Order by an any element (optional)
  27309.      * @param  string[] $ids Filter by a comma separated list of ContactIDs. Allows you to retrieve a specific set of contacts in a single call. (optional)
  27310.      * @param  int $page e.g. page&#x3D;1 - Up to 100 contacts will be returned in a single API call. (optional)
  27311.      * @param  bool $include_archived e.g. includeArchived&#x3D;true - Contacts with a status of ARCHIVED will be included in the response (optional)
  27312.      * @param  bool $summary_only Use summaryOnly&#x3D;true in GET Contacts and Invoices endpoint to retrieve a smaller version of the response object. This returns only lightweight fields, excluding computation-heavy fields from the response, making the API calls quick and efficient. (optional, default to false)
  27313.      * @param  string $search_term Search parameter that performs a case-insensitive text search across the Name, FirstName, LastName, ContactNumber and EmailAddress fields. (optional)
  27314.      * @throws \InvalidArgumentException
  27315.      * @return \GuzzleHttp\Psr7\Request  */
  27316.     protected function getContactsRequest($xero_tenant_id$if_modified_since null$where null$order null$ids null$page null$include_archived null$summary_only false$search_term null)
  27317.     {
  27318.         // verify the required parameter 'xero_tenant_id' is set
  27319.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  27320.             throw new \InvalidArgumentException(
  27321.                 'Missing the required parameter $xero_tenant_id when calling getContacts'
  27322.             );
  27323.         }
  27324.         $resourcePath '/Contacts';
  27325.         $formParams = [];
  27326.         $queryParams = [];
  27327.         $headerParams = [];
  27328.         $httpBody '';
  27329.         $multipart false;
  27330.         // query params
  27331.         if ($where !== null) {
  27332.             $queryParams['where'] = AccountingObjectSerializer::toQueryValue($where);
  27333.         }
  27334.         // query params
  27335.         if ($order !== null) {
  27336.             $queryParams['order'] = AccountingObjectSerializer::toQueryValue($order);
  27337.         }
  27338.         // query params
  27339.         if (is_array($ids)) {
  27340.             $ids AccountingObjectSerializer::serializeCollection($ids'csv'true);
  27341.         }
  27342.         if ($ids !== null) {
  27343.             $queryParams['IDs'] = AccountingObjectSerializer::toQueryValue($ids);
  27344.         }
  27345.         // query params
  27346.         if ($page !== null) {
  27347.             $queryParams['page'] = AccountingObjectSerializer::toQueryValue($page);
  27348.         }
  27349.         // query params
  27350.         if ($include_archived !== null) {
  27351.             $queryParams['includeArchived'] = $include_archived 'true' 'false';
  27352.         }
  27353.         // query params
  27354.         if ($summary_only !== null) {
  27355.             $queryParams['summaryOnly'] = $summary_only 'true' 'false';
  27356.         }
  27357.         // query params
  27358.         if ($search_term !== null) {
  27359.             $queryParams['searchTerm'] = AccountingObjectSerializer::toQueryValue($search_term);
  27360.         }
  27361.         // header params
  27362.         if ($xero_tenant_id !== null) {
  27363.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  27364.         }
  27365.         // header params
  27366.         if ($if_modified_since !== null) {
  27367.             $headerParams['If-Modified-Since'] = AccountingObjectSerializer::toHeaderValue($if_modified_since);
  27368.         }
  27369.         // body params
  27370.         $_tempBody null;
  27371.         if ($multipart) {
  27372.             $headers $this->headerSelector->selectHeadersForMultipart(
  27373.                 ['application/json']
  27374.             );
  27375.         } else {
  27376.             $headers $this->headerSelector->selectHeaders(
  27377.                 ['application/json'],
  27378.                 []
  27379.             );
  27380.         }
  27381.         // for model (json/xml)
  27382.         if (isset($_tempBody)) {
  27383.             // $_tempBody is the method argument, if present
  27384.             if ($headers['Content-Type'] === 'application/json') {
  27385.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  27386.             } else {
  27387.                 $httpBody $_tempBody;
  27388.             }
  27389.         } elseif (count($formParams) > 0) {
  27390.             if ($multipart) {
  27391.                 $multipartContents = [
  27392.                     [
  27393.                         'Content-type' => 'multipart/form-data',
  27394.                     ]
  27395.                 ];
  27396.                 
  27397.                 // for HTTP post (form)
  27398.                 $httpBody = new MultipartStream($multipartContents);
  27399.             } elseif ($headers['Content-Type'] === 'application/json') {
  27400.                 $httpBody \GuzzleHttp\json_encode($formParams);
  27401.             } else {
  27402.                 // for HTTP post (form)
  27403.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  27404.             }
  27405.         }
  27406.         // this endpoint requires OAuth (access token)
  27407.         if ($this->config->getAccessToken() !== null) {
  27408.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  27409.         }
  27410.         $defaultHeaders = [];
  27411.         if ($this->config->getUserAgent()) {
  27412.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  27413.         }
  27414.         $headers array_merge(
  27415.             $defaultHeaders,
  27416.             $headerParams,
  27417.             $headers
  27418.         );
  27419.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  27420.         return new Request(
  27421.             'GET',
  27422.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  27423.             $headers,
  27424.             $httpBody
  27425.         );
  27426.     }
  27427.     /**
  27428.      * Operation getCreditNote
  27429.      * Retrieves a specific credit note using a unique credit note Id
  27430.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  27431.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  27432.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  27433.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  27434.      * @throws \InvalidArgumentException
  27435.      * @return \XeroAPI\XeroPHP\Models\Accounting\CreditNotes
  27436.      */
  27437.     public function getCreditNote($xero_tenant_id$credit_note_id$unitdp null)
  27438.     {
  27439.         list($response) = $this->getCreditNoteWithHttpInfo($xero_tenant_id$credit_note_id$unitdp);
  27440.         return $response;
  27441.     }
  27442.     /**
  27443.      * Operation getCreditNoteWithHttpInfo
  27444.      * Retrieves a specific credit note using a unique credit note Id
  27445.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  27446.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  27447.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  27448.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  27449.      * @throws \InvalidArgumentException
  27450.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\CreditNotes, HTTP status code, HTTP response headers (array of strings)
  27451.      */
  27452.     public function getCreditNoteWithHttpInfo($xero_tenant_id$credit_note_id$unitdp null)
  27453.     {
  27454.         $request $this->getCreditNoteRequest($xero_tenant_id$credit_note_id$unitdp);
  27455.         try {
  27456.             $options $this->createHttpClientOption();
  27457.             try {
  27458.                 $response $this->client->send($request$options);
  27459.             } catch (RequestException $e) {
  27460.                 throw new ApiException(
  27461.                     "[{$e->getCode()}{$e->getMessage()}",
  27462.                     $e->getCode(),
  27463.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  27464.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  27465.                 );
  27466.             }
  27467.             $statusCode $response->getStatusCode();
  27468.             if ($statusCode 200 || $statusCode 299) {
  27469.                 throw new ApiException(
  27470.                     sprintf(
  27471.                         '[%d] Error connecting to the API (%s)',
  27472.                         $statusCode,
  27473.                         $request->getUri()
  27474.                     ),
  27475.                     $statusCode,
  27476.                     $response->getHeaders(),
  27477.                     $response->getBody()
  27478.                 );
  27479.             }
  27480.             $responseBody $response->getBody();
  27481.             switch($statusCode) {
  27482.                 case 200:
  27483.                     if ('\XeroAPI\XeroPHP\Models\Accounting\CreditNotes' === '\SplFileObject') {
  27484.                         $content $responseBody//stream goes to serializer
  27485.                     } else {
  27486.                         $content $responseBody->getContents();
  27487.                     }
  27488.                     return [
  27489.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\CreditNotes', []),
  27490.                         $response->getStatusCode(),
  27491.                         $response->getHeaders()
  27492.                     ];
  27493.             }
  27494.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\CreditNotes';
  27495.             $responseBody $response->getBody();
  27496.             if ($returnType === '\SplFileObject') {
  27497.                 $content $responseBody//stream goes to serializer
  27498.             } else {
  27499.                 $content $responseBody->getContents();
  27500.             }
  27501.             return [
  27502.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  27503.                 $response->getStatusCode(),
  27504.                 $response->getHeaders()
  27505.             ];
  27506.         } catch (ApiException $e) {
  27507.             switch ($e->getCode()) {
  27508.                 case 200:
  27509.                     $data AccountingObjectSerializer::deserialize(
  27510.                         $e->getResponseBody(),
  27511.                         '\XeroAPI\XeroPHP\Models\Accounting\CreditNotes',
  27512.                         $e->getResponseHeaders()
  27513.                     );
  27514.                     $e->setResponseObject($data);
  27515.                     break;
  27516.             }
  27517.             throw $e;
  27518.         }
  27519.     }
  27520.     /**
  27521.      * Operation getCreditNoteAsync
  27522.      * Retrieves a specific credit note using a unique credit note Id
  27523.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  27524.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  27525.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  27526.      * @throws \InvalidArgumentException
  27527.      * @return \GuzzleHttp\Promise\PromiseInterface
  27528.      */
  27529.     public function getCreditNoteAsync($xero_tenant_id$credit_note_id$unitdp null)
  27530.     {
  27531.         return $this->getCreditNoteAsyncWithHttpInfo($xero_tenant_id$credit_note_id$unitdp)
  27532.             ->then(
  27533.                 function ($response) {
  27534.                     return $response[0];
  27535.                 }
  27536.             );
  27537.     }
  27538.     /**
  27539.      * Operation getCreditNoteAsyncWithHttpInfo
  27540.      * Retrieves a specific credit note using a unique credit note Id
  27541.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  27542.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  27543.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  27544.      * @throws \InvalidArgumentException
  27545.      * @return \GuzzleHttp\Promise\PromiseInterface */
  27546.     public function getCreditNoteAsyncWithHttpInfo($xero_tenant_id$credit_note_id$unitdp null)
  27547.     {
  27548.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\CreditNotes';
  27549.         $request $this->getCreditNoteRequest($xero_tenant_id$credit_note_id$unitdp);
  27550.         return $this->client
  27551.             ->sendAsync($request$this->createHttpClientOption())
  27552.             ->then(
  27553.                 function ($response) use ($returnType) {
  27554.                     $responseBody $response->getBody();
  27555.                     if ($returnType === '\SplFileObject') {
  27556.                         $content $responseBody//stream goes to serializer
  27557.                     } else {
  27558.                         $content $responseBody->getContents();
  27559.                     }
  27560.                     return [
  27561.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  27562.                         $response->getStatusCode(),
  27563.                         $response->getHeaders()
  27564.                     ];
  27565.                 },
  27566.                 function ($exception) {
  27567.                     $response $exception->getResponse();
  27568.                     $statusCode $response->getStatusCode();
  27569.                     throw new ApiException(
  27570.                         sprintf(
  27571.                             '[%d] Error connecting to the API (%s)',
  27572.                             $statusCode,
  27573.                             $exception->getRequest()->getUri()
  27574.                         ),
  27575.                         $statusCode,
  27576.                         $response->getHeaders(),
  27577.                         $response->getBody()
  27578.                     );
  27579.                 }
  27580.             );
  27581.     }
  27582.     /**
  27583.      * Create request for operation 'getCreditNote'
  27584.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  27585.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  27586.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  27587.      * @throws \InvalidArgumentException
  27588.      * @return \GuzzleHttp\Psr7\Request  */
  27589.     protected function getCreditNoteRequest($xero_tenant_id$credit_note_id$unitdp null)
  27590.     {
  27591.         // verify the required parameter 'xero_tenant_id' is set
  27592.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  27593.             throw new \InvalidArgumentException(
  27594.                 'Missing the required parameter $xero_tenant_id when calling getCreditNote'
  27595.             );
  27596.         }
  27597.         // verify the required parameter 'credit_note_id' is set
  27598.         if ($credit_note_id === null || (is_array($credit_note_id) && count($credit_note_id) === 0)) {
  27599.             throw new \InvalidArgumentException(
  27600.                 'Missing the required parameter $credit_note_id when calling getCreditNote'
  27601.             );
  27602.         }
  27603.         $resourcePath '/CreditNotes/{CreditNoteID}';
  27604.         $formParams = [];
  27605.         $queryParams = [];
  27606.         $headerParams = [];
  27607.         $httpBody '';
  27608.         $multipart false;
  27609.         // query params
  27610.         if ($unitdp !== null) {
  27611.             $queryParams['unitdp'] = AccountingObjectSerializer::toQueryValue($unitdp);
  27612.         }
  27613.         // header params
  27614.         if ($xero_tenant_id !== null) {
  27615.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  27616.         }
  27617.         // path params
  27618.         if ($credit_note_id !== null) {
  27619.             $resourcePath str_replace(
  27620.                 '{' 'CreditNoteID' '}',
  27621.                 AccountingObjectSerializer::toPathValue($credit_note_id),
  27622.                 $resourcePath
  27623.             );
  27624.         }
  27625.         // body params
  27626.         $_tempBody null;
  27627.         if ($multipart) {
  27628.             $headers $this->headerSelector->selectHeadersForMultipart(
  27629.                 ['application/json']
  27630.             );
  27631.         } else {
  27632.             $headers $this->headerSelector->selectHeaders(
  27633.                 ['application/json'],
  27634.                 []
  27635.             );
  27636.         }
  27637.         // for model (json/xml)
  27638.         if (isset($_tempBody)) {
  27639.             // $_tempBody is the method argument, if present
  27640.             if ($headers['Content-Type'] === 'application/json') {
  27641.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  27642.             } else {
  27643.                 $httpBody $_tempBody;
  27644.             }
  27645.         } elseif (count($formParams) > 0) {
  27646.             if ($multipart) {
  27647.                 $multipartContents = [
  27648.                     [
  27649.                         'Content-type' => 'multipart/form-data',
  27650.                     ]
  27651.                 ];
  27652.                 
  27653.                 // for HTTP post (form)
  27654.                 $httpBody = new MultipartStream($multipartContents);
  27655.             } elseif ($headers['Content-Type'] === 'application/json') {
  27656.                 $httpBody \GuzzleHttp\json_encode($formParams);
  27657.             } else {
  27658.                 // for HTTP post (form)
  27659.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  27660.             }
  27661.         }
  27662.         // this endpoint requires OAuth (access token)
  27663.         if ($this->config->getAccessToken() !== null) {
  27664.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  27665.         }
  27666.         $defaultHeaders = [];
  27667.         if ($this->config->getUserAgent()) {
  27668.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  27669.         }
  27670.         $headers array_merge(
  27671.             $defaultHeaders,
  27672.             $headerParams,
  27673.             $headers
  27674.         );
  27675.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  27676.         return new Request(
  27677.             'GET',
  27678.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  27679.             $headers,
  27680.             $httpBody
  27681.         );
  27682.     }
  27683.     /**
  27684.      * Operation getCreditNoteAsPdf
  27685.      * Retrieves credit notes as PDF files
  27686.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  27687.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  27688.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  27689.      * @throws \InvalidArgumentException
  27690.      * @return \SplFileObject
  27691.      */
  27692.     public function getCreditNoteAsPdf($xero_tenant_id$credit_note_id)
  27693.     {
  27694.         list($response) = $this->getCreditNoteAsPdfWithHttpInfo($xero_tenant_id$credit_note_id);
  27695.         return $response;
  27696.     }
  27697.     /**
  27698.      * Operation getCreditNoteAsPdfWithHttpInfo
  27699.      * Retrieves credit notes as PDF files
  27700.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  27701.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  27702.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  27703.      * @throws \InvalidArgumentException
  27704.      * @return array of \SplFileObject, HTTP status code, HTTP response headers (array of strings)
  27705.      */
  27706.     public function getCreditNoteAsPdfWithHttpInfo($xero_tenant_id$credit_note_id)
  27707.     {
  27708.         $request $this->getCreditNoteAsPdfRequest($xero_tenant_id$credit_note_id);
  27709.         try {
  27710.             $options $this->createHttpClientOption();
  27711.             try {
  27712.                 $response $this->client->send($request$options);
  27713.             } catch (RequestException $e) {
  27714.                 throw new ApiException(
  27715.                     "[{$e->getCode()}{$e->getMessage()}",
  27716.                     $e->getCode(),
  27717.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  27718.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  27719.                 );
  27720.             }
  27721.             $statusCode $response->getStatusCode();
  27722.             if ($statusCode 200 || $statusCode 299) {
  27723.                 throw new ApiException(
  27724.                     sprintf(
  27725.                         '[%d] Error connecting to the API (%s)',
  27726.                         $statusCode,
  27727.                         $request->getUri()
  27728.                     ),
  27729.                     $statusCode,
  27730.                     $response->getHeaders(),
  27731.                     $response->getBody()
  27732.                 );
  27733.             }
  27734.             $responseBody $response->getBody();
  27735.             switch($statusCode) {
  27736.                 case 200:
  27737.                     if ('\SplFileObject' === '\SplFileObject') {
  27738.                         $content $responseBody//stream goes to serializer
  27739.                     } else {
  27740.                         $content $responseBody->getContents();
  27741.                     }
  27742.                     return [
  27743.                         AccountingObjectSerializer::deserialize($content'\SplFileObject', []),
  27744.                         $response->getStatusCode(),
  27745.                         $response->getHeaders()
  27746.                     ];
  27747.             }
  27748.             $returnType '\SplFileObject';
  27749.             $responseBody $response->getBody();
  27750.             if ($returnType === '\SplFileObject') {
  27751.                 $content $responseBody//stream goes to serializer
  27752.             } else {
  27753.                 $content $responseBody->getContents();
  27754.             }
  27755.             return [
  27756.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  27757.                 $response->getStatusCode(),
  27758.                 $response->getHeaders()
  27759.             ];
  27760.         } catch (ApiException $e) {
  27761.             switch ($e->getCode()) {
  27762.                 case 200:
  27763.                     $data AccountingObjectSerializer::deserialize(
  27764.                         $e->getResponseBody(),
  27765.                         '\SplFileObject',
  27766.                         $e->getResponseHeaders()
  27767.                     );
  27768.                     $e->setResponseObject($data);
  27769.                     break;
  27770.             }
  27771.             throw $e;
  27772.         }
  27773.     }
  27774.     /**
  27775.      * Operation getCreditNoteAsPdfAsync
  27776.      * Retrieves credit notes as PDF files
  27777.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  27778.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  27779.      * @throws \InvalidArgumentException
  27780.      * @return \GuzzleHttp\Promise\PromiseInterface
  27781.      */
  27782.     public function getCreditNoteAsPdfAsync($xero_tenant_id$credit_note_id)
  27783.     {
  27784.         return $this->getCreditNoteAsPdfAsyncWithHttpInfo($xero_tenant_id$credit_note_id)
  27785.             ->then(
  27786.                 function ($response) {
  27787.                     return $response[0];
  27788.                 }
  27789.             );
  27790.     }
  27791.     /**
  27792.      * Operation getCreditNoteAsPdfAsyncWithHttpInfo
  27793.      * Retrieves credit notes as PDF files
  27794.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  27795.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  27796.      * @throws \InvalidArgumentException
  27797.      * @return \GuzzleHttp\Promise\PromiseInterface */
  27798.     public function getCreditNoteAsPdfAsyncWithHttpInfo($xero_tenant_id$credit_note_id)
  27799.     {
  27800.         $returnType '\SplFileObject';
  27801.         $request $this->getCreditNoteAsPdfRequest($xero_tenant_id$credit_note_id);
  27802.         return $this->client
  27803.             ->sendAsync($request$this->createHttpClientOption())
  27804.             ->then(
  27805.                 function ($response) use ($returnType) {
  27806.                     $responseBody $response->getBody();
  27807.                     if ($returnType === '\SplFileObject') {
  27808.                         $content $responseBody//stream goes to serializer
  27809.                     } else {
  27810.                         $content $responseBody->getContents();
  27811.                     }
  27812.                     return [
  27813.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  27814.                         $response->getStatusCode(),
  27815.                         $response->getHeaders()
  27816.                     ];
  27817.                 },
  27818.                 function ($exception) {
  27819.                     $response $exception->getResponse();
  27820.                     $statusCode $response->getStatusCode();
  27821.                     throw new ApiException(
  27822.                         sprintf(
  27823.                             '[%d] Error connecting to the API (%s)',
  27824.                             $statusCode,
  27825.                             $exception->getRequest()->getUri()
  27826.                         ),
  27827.                         $statusCode,
  27828.                         $response->getHeaders(),
  27829.                         $response->getBody()
  27830.                     );
  27831.                 }
  27832.             );
  27833.     }
  27834.     /**
  27835.      * Create request for operation 'getCreditNoteAsPdf'
  27836.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  27837.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  27838.      * @throws \InvalidArgumentException
  27839.      * @return \GuzzleHttp\Psr7\Request  */
  27840.     protected function getCreditNoteAsPdfRequest($xero_tenant_id$credit_note_id)
  27841.     {
  27842.         // verify the required parameter 'xero_tenant_id' is set
  27843.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  27844.             throw new \InvalidArgumentException(
  27845.                 'Missing the required parameter $xero_tenant_id when calling getCreditNoteAsPdf'
  27846.             );
  27847.         }
  27848.         // verify the required parameter 'credit_note_id' is set
  27849.         if ($credit_note_id === null || (is_array($credit_note_id) && count($credit_note_id) === 0)) {
  27850.             throw new \InvalidArgumentException(
  27851.                 'Missing the required parameter $credit_note_id when calling getCreditNoteAsPdf'
  27852.             );
  27853.         }
  27854.         $resourcePath '/CreditNotes/{CreditNoteID}';
  27855.         $formParams = [];
  27856.         $queryParams = [];
  27857.         $headerParams = [];
  27858.         $httpBody '';
  27859.         $multipart false;
  27860.         // header params
  27861.         if ($xero_tenant_id !== null) {
  27862.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  27863.         }
  27864.         // path params
  27865.         if ($credit_note_id !== null) {
  27866.             $resourcePath str_replace(
  27867.                 '{' 'CreditNoteID' '}',
  27868.                 AccountingObjectSerializer::toPathValue($credit_note_id),
  27869.                 $resourcePath
  27870.             );
  27871.         }
  27872.         // body params
  27873.         $_tempBody null;
  27874.         if ($multipart) {
  27875.             $headers $this->headerSelector->selectHeadersForMultipart(
  27876.                 ['application/pdf']
  27877.             );
  27878.         } else {
  27879.             $headers $this->headerSelector->selectHeaders(
  27880.                 ['application/pdf'],
  27881.                 []
  27882.             );
  27883.         }
  27884.         // for model (json/xml)
  27885.         if (isset($_tempBody)) {
  27886.             // $_tempBody is the method argument, if present
  27887.             if ($headers['Content-Type'] === 'application/json') {
  27888.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  27889.             } else {
  27890.                 $httpBody $_tempBody;
  27891.             }
  27892.         } elseif (count($formParams) > 0) {
  27893.             if ($multipart) {
  27894.                 $multipartContents = [
  27895.                     [
  27896.                         'Content-type' => 'multipart/form-data',
  27897.                     ]
  27898.                 ];
  27899.                 
  27900.                 // for HTTP post (form)
  27901.                 $httpBody = new MultipartStream($multipartContents);
  27902.             } elseif ($headers['Content-Type'] === 'application/json') {
  27903.                 $httpBody \GuzzleHttp\json_encode($formParams);
  27904.             } else {
  27905.                 // for HTTP post (form)
  27906.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  27907.             }
  27908.         }
  27909.         // this endpoint requires OAuth (access token)
  27910.         if ($this->config->getAccessToken() !== null) {
  27911.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  27912.         }
  27913.         $defaultHeaders = [];
  27914.         if ($this->config->getUserAgent()) {
  27915.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  27916.         }
  27917.         $headers array_merge(
  27918.             $defaultHeaders,
  27919.             $headerParams,
  27920.             $headers
  27921.         );
  27922.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  27923.         return new Request(
  27924.             'GET',
  27925.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  27926.             $headers,
  27927.             $httpBody
  27928.         );
  27929.     }
  27930.     /**
  27931.      * Operation getCreditNoteAttachmentByFileName
  27932.      * Retrieves a specific attachment on a specific credit note by file name
  27933.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  27934.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  27935.      * @param  string $file_name Name of the attachment (required)
  27936.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  27937.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  27938.      * @throws \InvalidArgumentException
  27939.      * @return \SplFileObject
  27940.      */
  27941.     public function getCreditNoteAttachmentByFileName($xero_tenant_id$credit_note_id$file_name$content_type)
  27942.     {
  27943.         list($response) = $this->getCreditNoteAttachmentByFileNameWithHttpInfo($xero_tenant_id$credit_note_id$file_name$content_type);
  27944.         return $response;
  27945.     }
  27946.     /**
  27947.      * Operation getCreditNoteAttachmentByFileNameWithHttpInfo
  27948.      * Retrieves a specific attachment on a specific credit note by file name
  27949.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  27950.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  27951.      * @param  string $file_name Name of the attachment (required)
  27952.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  27953.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  27954.      * @throws \InvalidArgumentException
  27955.      * @return array of \SplFileObject, HTTP status code, HTTP response headers (array of strings)
  27956.      */
  27957.     public function getCreditNoteAttachmentByFileNameWithHttpInfo($xero_tenant_id$credit_note_id$file_name$content_type)
  27958.     {
  27959.         $request $this->getCreditNoteAttachmentByFileNameRequest($xero_tenant_id$credit_note_id$file_name$content_type);
  27960.         try {
  27961.             $options $this->createHttpClientOption();
  27962.             try {
  27963.                 $response $this->client->send($request$options);
  27964.             } catch (RequestException $e) {
  27965.                 throw new ApiException(
  27966.                     "[{$e->getCode()}{$e->getMessage()}",
  27967.                     $e->getCode(),
  27968.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  27969.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  27970.                 );
  27971.             }
  27972.             $statusCode $response->getStatusCode();
  27973.             if ($statusCode 200 || $statusCode 299) {
  27974.                 throw new ApiException(
  27975.                     sprintf(
  27976.                         '[%d] Error connecting to the API (%s)',
  27977.                         $statusCode,
  27978.                         $request->getUri()
  27979.                     ),
  27980.                     $statusCode,
  27981.                     $response->getHeaders(),
  27982.                     $response->getBody()
  27983.                 );
  27984.             }
  27985.             $responseBody $response->getBody();
  27986.             switch($statusCode) {
  27987.                 case 200:
  27988.                     if ('\SplFileObject' === '\SplFileObject') {
  27989.                         $content $responseBody//stream goes to serializer
  27990.                     } else {
  27991.                         $content $responseBody->getContents();
  27992.                     }
  27993.                     return [
  27994.                         AccountingObjectSerializer::deserialize($content'\SplFileObject', []),
  27995.                         $response->getStatusCode(),
  27996.                         $response->getHeaders()
  27997.                     ];
  27998.             }
  27999.             $returnType '\SplFileObject';
  28000.             $responseBody $response->getBody();
  28001.             if ($returnType === '\SplFileObject') {
  28002.                 $content $responseBody//stream goes to serializer
  28003.             } else {
  28004.                 $content $responseBody->getContents();
  28005.             }
  28006.             return [
  28007.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  28008.                 $response->getStatusCode(),
  28009.                 $response->getHeaders()
  28010.             ];
  28011.         } catch (ApiException $e) {
  28012.             switch ($e->getCode()) {
  28013.                 case 200:
  28014.                     $data AccountingObjectSerializer::deserialize(
  28015.                         $e->getResponseBody(),
  28016.                         '\SplFileObject',
  28017.                         $e->getResponseHeaders()
  28018.                     );
  28019.                     $e->setResponseObject($data);
  28020.                     break;
  28021.             }
  28022.             throw $e;
  28023.         }
  28024.     }
  28025.     /**
  28026.      * Operation getCreditNoteAttachmentByFileNameAsync
  28027.      * Retrieves a specific attachment on a specific credit note by file name
  28028.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  28029.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  28030.      * @param  string $file_name Name of the attachment (required)
  28031.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  28032.      * @throws \InvalidArgumentException
  28033.      * @return \GuzzleHttp\Promise\PromiseInterface
  28034.      */
  28035.     public function getCreditNoteAttachmentByFileNameAsync($xero_tenant_id$credit_note_id$file_name$content_type)
  28036.     {
  28037.         return $this->getCreditNoteAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$credit_note_id$file_name$content_type)
  28038.             ->then(
  28039.                 function ($response) {
  28040.                     return $response[0];
  28041.                 }
  28042.             );
  28043.     }
  28044.     /**
  28045.      * Operation getCreditNoteAttachmentByFileNameAsyncWithHttpInfo
  28046.      * Retrieves a specific attachment on a specific credit note by file name
  28047.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  28048.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  28049.      * @param  string $file_name Name of the attachment (required)
  28050.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  28051.      * @throws \InvalidArgumentException
  28052.      * @return \GuzzleHttp\Promise\PromiseInterface */
  28053.     public function getCreditNoteAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$credit_note_id$file_name$content_type)
  28054.     {
  28055.         $returnType '\SplFileObject';
  28056.         $request $this->getCreditNoteAttachmentByFileNameRequest($xero_tenant_id$credit_note_id$file_name$content_type);
  28057.         return $this->client
  28058.             ->sendAsync($request$this->createHttpClientOption())
  28059.             ->then(
  28060.                 function ($response) use ($returnType) {
  28061.                     $responseBody $response->getBody();
  28062.                     if ($returnType === '\SplFileObject') {
  28063.                         $content $responseBody//stream goes to serializer
  28064.                     } else {
  28065.                         $content $responseBody->getContents();
  28066.                     }
  28067.                     return [
  28068.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  28069.                         $response->getStatusCode(),
  28070.                         $response->getHeaders()
  28071.                     ];
  28072.                 },
  28073.                 function ($exception) {
  28074.                     $response $exception->getResponse();
  28075.                     $statusCode $response->getStatusCode();
  28076.                     throw new ApiException(
  28077.                         sprintf(
  28078.                             '[%d] Error connecting to the API (%s)',
  28079.                             $statusCode,
  28080.                             $exception->getRequest()->getUri()
  28081.                         ),
  28082.                         $statusCode,
  28083.                         $response->getHeaders(),
  28084.                         $response->getBody()
  28085.                     );
  28086.                 }
  28087.             );
  28088.     }
  28089.     /**
  28090.      * Create request for operation 'getCreditNoteAttachmentByFileName'
  28091.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  28092.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  28093.      * @param  string $file_name Name of the attachment (required)
  28094.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  28095.      * @throws \InvalidArgumentException
  28096.      * @return \GuzzleHttp\Psr7\Request  */
  28097.     protected function getCreditNoteAttachmentByFileNameRequest($xero_tenant_id$credit_note_id$file_name$content_type)
  28098.     {
  28099.         // verify the required parameter 'xero_tenant_id' is set
  28100.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  28101.             throw new \InvalidArgumentException(
  28102.                 'Missing the required parameter $xero_tenant_id when calling getCreditNoteAttachmentByFileName'
  28103.             );
  28104.         }
  28105.         // verify the required parameter 'credit_note_id' is set
  28106.         if ($credit_note_id === null || (is_array($credit_note_id) && count($credit_note_id) === 0)) {
  28107.             throw new \InvalidArgumentException(
  28108.                 'Missing the required parameter $credit_note_id when calling getCreditNoteAttachmentByFileName'
  28109.             );
  28110.         }
  28111.         // verify the required parameter 'file_name' is set
  28112.         if ($file_name === null || (is_array($file_name) && count($file_name) === 0)) {
  28113.             throw new \InvalidArgumentException(
  28114.                 'Missing the required parameter $file_name when calling getCreditNoteAttachmentByFileName'
  28115.             );
  28116.         }
  28117.         // verify the required parameter 'content_type' is set
  28118.         if ($content_type === null || (is_array($content_type) && count($content_type) === 0)) {
  28119.             throw new \InvalidArgumentException(
  28120.                 'Missing the required parameter $content_type when calling getCreditNoteAttachmentByFileName'
  28121.             );
  28122.         }
  28123.         $resourcePath '/CreditNotes/{CreditNoteID}/Attachments/{FileName}';
  28124.         $formParams = [];
  28125.         $queryParams = [];
  28126.         $headerParams = [];
  28127.         $httpBody '';
  28128.         $multipart false;
  28129.         // header params
  28130.         if ($xero_tenant_id !== null) {
  28131.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  28132.         }
  28133.         // header params
  28134.         if ($content_type !== null) {
  28135.             $headerParams['contentType'] = AccountingObjectSerializer::toHeaderValue($content_type);
  28136.         }
  28137.         // path params
  28138.         if ($credit_note_id !== null) {
  28139.             $resourcePath str_replace(
  28140.                 '{' 'CreditNoteID' '}',
  28141.                 AccountingObjectSerializer::toPathValue($credit_note_id),
  28142.                 $resourcePath
  28143.             );
  28144.         }
  28145.         // path params
  28146.         if ($file_name !== null) {
  28147.             $resourcePath str_replace(
  28148.                 '{' 'FileName' '}',
  28149.                 AccountingObjectSerializer::toPathValue($file_name),
  28150.                 $resourcePath
  28151.             );
  28152.         }
  28153.         // body params
  28154.         $_tempBody null;
  28155.         if ($multipart) {
  28156.             $headers $this->headerSelector->selectHeadersForMultipart(
  28157.                 ['application/octet-stream']
  28158.             );
  28159.         } else {
  28160.             $headers $this->headerSelector->selectHeaders(
  28161.                 ['application/octet-stream'],
  28162.                 []
  28163.             );
  28164.         }
  28165.         // for model (json/xml)
  28166.         if (isset($_tempBody)) {
  28167.             // $_tempBody is the method argument, if present
  28168.             if ($headers['Content-Type'] === 'application/json') {
  28169.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  28170.             } else {
  28171.                 $httpBody $_tempBody;
  28172.             }
  28173.         } elseif (count($formParams) > 0) {
  28174.             if ($multipart) {
  28175.                 $multipartContents = [
  28176.                     [
  28177.                         'Content-type' => 'multipart/form-data',
  28178.                     ]
  28179.                 ];
  28180.                 
  28181.                 // for HTTP post (form)
  28182.                 $httpBody = new MultipartStream($multipartContents);
  28183.             } elseif ($headers['Content-Type'] === 'application/json') {
  28184.                 $httpBody \GuzzleHttp\json_encode($formParams);
  28185.             } else {
  28186.                 // for HTTP post (form)
  28187.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  28188.             }
  28189.         }
  28190.         // this endpoint requires OAuth (access token)
  28191.         if ($this->config->getAccessToken() !== null) {
  28192.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  28193.         }
  28194.         $defaultHeaders = [];
  28195.         if ($this->config->getUserAgent()) {
  28196.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  28197.         }
  28198.         $headers array_merge(
  28199.             $defaultHeaders,
  28200.             $headerParams,
  28201.             $headers
  28202.         );
  28203.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  28204.         return new Request(
  28205.             'GET',
  28206.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  28207.             $headers,
  28208.             $httpBody
  28209.         );
  28210.     }
  28211.     /**
  28212.      * Operation getCreditNoteAttachmentById
  28213.      * Retrieves a specific attachment from a specific credit note using a unique attachment Id
  28214.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  28215.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  28216.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  28217.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  28218.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  28219.      * @throws \InvalidArgumentException
  28220.      * @return \SplFileObject
  28221.      */
  28222.     public function getCreditNoteAttachmentById($xero_tenant_id$credit_note_id$attachment_id$content_type)
  28223.     {
  28224.         list($response) = $this->getCreditNoteAttachmentByIdWithHttpInfo($xero_tenant_id$credit_note_id$attachment_id$content_type);
  28225.         return $response;
  28226.     }
  28227.     /**
  28228.      * Operation getCreditNoteAttachmentByIdWithHttpInfo
  28229.      * Retrieves a specific attachment from a specific credit note using a unique attachment Id
  28230.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  28231.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  28232.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  28233.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  28234.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  28235.      * @throws \InvalidArgumentException
  28236.      * @return array of \SplFileObject, HTTP status code, HTTP response headers (array of strings)
  28237.      */
  28238.     public function getCreditNoteAttachmentByIdWithHttpInfo($xero_tenant_id$credit_note_id$attachment_id$content_type)
  28239.     {
  28240.         $request $this->getCreditNoteAttachmentByIdRequest($xero_tenant_id$credit_note_id$attachment_id$content_type);
  28241.         try {
  28242.             $options $this->createHttpClientOption();
  28243.             try {
  28244.                 $response $this->client->send($request$options);
  28245.             } catch (RequestException $e) {
  28246.                 throw new ApiException(
  28247.                     "[{$e->getCode()}{$e->getMessage()}",
  28248.                     $e->getCode(),
  28249.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  28250.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  28251.                 );
  28252.             }
  28253.             $statusCode $response->getStatusCode();
  28254.             if ($statusCode 200 || $statusCode 299) {
  28255.                 throw new ApiException(
  28256.                     sprintf(
  28257.                         '[%d] Error connecting to the API (%s)',
  28258.                         $statusCode,
  28259.                         $request->getUri()
  28260.                     ),
  28261.                     $statusCode,
  28262.                     $response->getHeaders(),
  28263.                     $response->getBody()
  28264.                 );
  28265.             }
  28266.             $responseBody $response->getBody();
  28267.             switch($statusCode) {
  28268.                 case 200:
  28269.                     if ('\SplFileObject' === '\SplFileObject') {
  28270.                         $content $responseBody//stream goes to serializer
  28271.                     } else {
  28272.                         $content $responseBody->getContents();
  28273.                     }
  28274.                     return [
  28275.                         AccountingObjectSerializer::deserialize($content'\SplFileObject', []),
  28276.                         $response->getStatusCode(),
  28277.                         $response->getHeaders()
  28278.                     ];
  28279.             }
  28280.             $returnType '\SplFileObject';
  28281.             $responseBody $response->getBody();
  28282.             if ($returnType === '\SplFileObject') {
  28283.                 $content $responseBody//stream goes to serializer
  28284.             } else {
  28285.                 $content $responseBody->getContents();
  28286.             }
  28287.             return [
  28288.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  28289.                 $response->getStatusCode(),
  28290.                 $response->getHeaders()
  28291.             ];
  28292.         } catch (ApiException $e) {
  28293.             switch ($e->getCode()) {
  28294.                 case 200:
  28295.                     $data AccountingObjectSerializer::deserialize(
  28296.                         $e->getResponseBody(),
  28297.                         '\SplFileObject',
  28298.                         $e->getResponseHeaders()
  28299.                     );
  28300.                     $e->setResponseObject($data);
  28301.                     break;
  28302.             }
  28303.             throw $e;
  28304.         }
  28305.     }
  28306.     /**
  28307.      * Operation getCreditNoteAttachmentByIdAsync
  28308.      * Retrieves a specific attachment from a specific credit note using a unique attachment Id
  28309.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  28310.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  28311.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  28312.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  28313.      * @throws \InvalidArgumentException
  28314.      * @return \GuzzleHttp\Promise\PromiseInterface
  28315.      */
  28316.     public function getCreditNoteAttachmentByIdAsync($xero_tenant_id$credit_note_id$attachment_id$content_type)
  28317.     {
  28318.         return $this->getCreditNoteAttachmentByIdAsyncWithHttpInfo($xero_tenant_id$credit_note_id$attachment_id$content_type)
  28319.             ->then(
  28320.                 function ($response) {
  28321.                     return $response[0];
  28322.                 }
  28323.             );
  28324.     }
  28325.     /**
  28326.      * Operation getCreditNoteAttachmentByIdAsyncWithHttpInfo
  28327.      * Retrieves a specific attachment from a specific credit note using a unique attachment Id
  28328.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  28329.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  28330.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  28331.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  28332.      * @throws \InvalidArgumentException
  28333.      * @return \GuzzleHttp\Promise\PromiseInterface */
  28334.     public function getCreditNoteAttachmentByIdAsyncWithHttpInfo($xero_tenant_id$credit_note_id$attachment_id$content_type)
  28335.     {
  28336.         $returnType '\SplFileObject';
  28337.         $request $this->getCreditNoteAttachmentByIdRequest($xero_tenant_id$credit_note_id$attachment_id$content_type);
  28338.         return $this->client
  28339.             ->sendAsync($request$this->createHttpClientOption())
  28340.             ->then(
  28341.                 function ($response) use ($returnType) {
  28342.                     $responseBody $response->getBody();
  28343.                     if ($returnType === '\SplFileObject') {
  28344.                         $content $responseBody//stream goes to serializer
  28345.                     } else {
  28346.                         $content $responseBody->getContents();
  28347.                     }
  28348.                     return [
  28349.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  28350.                         $response->getStatusCode(),
  28351.                         $response->getHeaders()
  28352.                     ];
  28353.                 },
  28354.                 function ($exception) {
  28355.                     $response $exception->getResponse();
  28356.                     $statusCode $response->getStatusCode();
  28357.                     throw new ApiException(
  28358.                         sprintf(
  28359.                             '[%d] Error connecting to the API (%s)',
  28360.                             $statusCode,
  28361.                             $exception->getRequest()->getUri()
  28362.                         ),
  28363.                         $statusCode,
  28364.                         $response->getHeaders(),
  28365.                         $response->getBody()
  28366.                     );
  28367.                 }
  28368.             );
  28369.     }
  28370.     /**
  28371.      * Create request for operation 'getCreditNoteAttachmentById'
  28372.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  28373.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  28374.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  28375.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  28376.      * @throws \InvalidArgumentException
  28377.      * @return \GuzzleHttp\Psr7\Request  */
  28378.     protected function getCreditNoteAttachmentByIdRequest($xero_tenant_id$credit_note_id$attachment_id$content_type)
  28379.     {
  28380.         // verify the required parameter 'xero_tenant_id' is set
  28381.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  28382.             throw new \InvalidArgumentException(
  28383.                 'Missing the required parameter $xero_tenant_id when calling getCreditNoteAttachmentById'
  28384.             );
  28385.         }
  28386.         // verify the required parameter 'credit_note_id' is set
  28387.         if ($credit_note_id === null || (is_array($credit_note_id) && count($credit_note_id) === 0)) {
  28388.             throw new \InvalidArgumentException(
  28389.                 'Missing the required parameter $credit_note_id when calling getCreditNoteAttachmentById'
  28390.             );
  28391.         }
  28392.         // verify the required parameter 'attachment_id' is set
  28393.         if ($attachment_id === null || (is_array($attachment_id) && count($attachment_id) === 0)) {
  28394.             throw new \InvalidArgumentException(
  28395.                 'Missing the required parameter $attachment_id when calling getCreditNoteAttachmentById'
  28396.             );
  28397.         }
  28398.         // verify the required parameter 'content_type' is set
  28399.         if ($content_type === null || (is_array($content_type) && count($content_type) === 0)) {
  28400.             throw new \InvalidArgumentException(
  28401.                 'Missing the required parameter $content_type when calling getCreditNoteAttachmentById'
  28402.             );
  28403.         }
  28404.         $resourcePath '/CreditNotes/{CreditNoteID}/Attachments/{AttachmentID}';
  28405.         $formParams = [];
  28406.         $queryParams = [];
  28407.         $headerParams = [];
  28408.         $httpBody '';
  28409.         $multipart false;
  28410.         // header params
  28411.         if ($xero_tenant_id !== null) {
  28412.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  28413.         }
  28414.         // header params
  28415.         if ($content_type !== null) {
  28416.             $headerParams['contentType'] = AccountingObjectSerializer::toHeaderValue($content_type);
  28417.         }
  28418.         // path params
  28419.         if ($credit_note_id !== null) {
  28420.             $resourcePath str_replace(
  28421.                 '{' 'CreditNoteID' '}',
  28422.                 AccountingObjectSerializer::toPathValue($credit_note_id),
  28423.                 $resourcePath
  28424.             );
  28425.         }
  28426.         // path params
  28427.         if ($attachment_id !== null) {
  28428.             $resourcePath str_replace(
  28429.                 '{' 'AttachmentID' '}',
  28430.                 AccountingObjectSerializer::toPathValue($attachment_id),
  28431.                 $resourcePath
  28432.             );
  28433.         }
  28434.         // body params
  28435.         $_tempBody null;
  28436.         if ($multipart) {
  28437.             $headers $this->headerSelector->selectHeadersForMultipart(
  28438.                 ['application/octet-stream']
  28439.             );
  28440.         } else {
  28441.             $headers $this->headerSelector->selectHeaders(
  28442.                 ['application/octet-stream'],
  28443.                 []
  28444.             );
  28445.         }
  28446.         // for model (json/xml)
  28447.         if (isset($_tempBody)) {
  28448.             // $_tempBody is the method argument, if present
  28449.             if ($headers['Content-Type'] === 'application/json') {
  28450.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  28451.             } else {
  28452.                 $httpBody $_tempBody;
  28453.             }
  28454.         } elseif (count($formParams) > 0) {
  28455.             if ($multipart) {
  28456.                 $multipartContents = [
  28457.                     [
  28458.                         'Content-type' => 'multipart/form-data',
  28459.                     ]
  28460.                 ];
  28461.                 
  28462.                 // for HTTP post (form)
  28463.                 $httpBody = new MultipartStream($multipartContents);
  28464.             } elseif ($headers['Content-Type'] === 'application/json') {
  28465.                 $httpBody \GuzzleHttp\json_encode($formParams);
  28466.             } else {
  28467.                 // for HTTP post (form)
  28468.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  28469.             }
  28470.         }
  28471.         // this endpoint requires OAuth (access token)
  28472.         if ($this->config->getAccessToken() !== null) {
  28473.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  28474.         }
  28475.         $defaultHeaders = [];
  28476.         if ($this->config->getUserAgent()) {
  28477.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  28478.         }
  28479.         $headers array_merge(
  28480.             $defaultHeaders,
  28481.             $headerParams,
  28482.             $headers
  28483.         );
  28484.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  28485.         return new Request(
  28486.             'GET',
  28487.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  28488.             $headers,
  28489.             $httpBody
  28490.         );
  28491.     }
  28492.     /**
  28493.      * Operation getCreditNoteAttachments
  28494.      * Retrieves attachments for a specific credit notes
  28495.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  28496.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  28497.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  28498.      * @throws \InvalidArgumentException
  28499.      * @return \XeroAPI\XeroPHP\Models\Accounting\Attachments
  28500.      */
  28501.     public function getCreditNoteAttachments($xero_tenant_id$credit_note_id)
  28502.     {
  28503.         list($response) = $this->getCreditNoteAttachmentsWithHttpInfo($xero_tenant_id$credit_note_id);
  28504.         return $response;
  28505.     }
  28506.     /**
  28507.      * Operation getCreditNoteAttachmentsWithHttpInfo
  28508.      * Retrieves attachments for a specific credit notes
  28509.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  28510.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  28511.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  28512.      * @throws \InvalidArgumentException
  28513.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Attachments, HTTP status code, HTTP response headers (array of strings)
  28514.      */
  28515.     public function getCreditNoteAttachmentsWithHttpInfo($xero_tenant_id$credit_note_id)
  28516.     {
  28517.         $request $this->getCreditNoteAttachmentsRequest($xero_tenant_id$credit_note_id);
  28518.         try {
  28519.             $options $this->createHttpClientOption();
  28520.             try {
  28521.                 $response $this->client->send($request$options);
  28522.             } catch (RequestException $e) {
  28523.                 throw new ApiException(
  28524.                     "[{$e->getCode()}{$e->getMessage()}",
  28525.                     $e->getCode(),
  28526.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  28527.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  28528.                 );
  28529.             }
  28530.             $statusCode $response->getStatusCode();
  28531.             if ($statusCode 200 || $statusCode 299) {
  28532.                 throw new ApiException(
  28533.                     sprintf(
  28534.                         '[%d] Error connecting to the API (%s)',
  28535.                         $statusCode,
  28536.                         $request->getUri()
  28537.                     ),
  28538.                     $statusCode,
  28539.                     $response->getHeaders(),
  28540.                     $response->getBody()
  28541.                 );
  28542.             }
  28543.             $responseBody $response->getBody();
  28544.             switch($statusCode) {
  28545.                 case 200:
  28546.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Attachments' === '\SplFileObject') {
  28547.                         $content $responseBody//stream goes to serializer
  28548.                     } else {
  28549.                         $content $responseBody->getContents();
  28550.                     }
  28551.                     return [
  28552.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Attachments', []),
  28553.                         $response->getStatusCode(),
  28554.                         $response->getHeaders()
  28555.                     ];
  28556.             }
  28557.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  28558.             $responseBody $response->getBody();
  28559.             if ($returnType === '\SplFileObject') {
  28560.                 $content $responseBody//stream goes to serializer
  28561.             } else {
  28562.                 $content $responseBody->getContents();
  28563.             }
  28564.             return [
  28565.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  28566.                 $response->getStatusCode(),
  28567.                 $response->getHeaders()
  28568.             ];
  28569.         } catch (ApiException $e) {
  28570.             switch ($e->getCode()) {
  28571.                 case 200:
  28572.                     $data AccountingObjectSerializer::deserialize(
  28573.                         $e->getResponseBody(),
  28574.                         '\XeroAPI\XeroPHP\Models\Accounting\Attachments',
  28575.                         $e->getResponseHeaders()
  28576.                     );
  28577.                     $e->setResponseObject($data);
  28578.                     break;
  28579.             }
  28580.             throw $e;
  28581.         }
  28582.     }
  28583.     /**
  28584.      * Operation getCreditNoteAttachmentsAsync
  28585.      * Retrieves attachments for a specific credit notes
  28586.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  28587.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  28588.      * @throws \InvalidArgumentException
  28589.      * @return \GuzzleHttp\Promise\PromiseInterface
  28590.      */
  28591.     public function getCreditNoteAttachmentsAsync($xero_tenant_id$credit_note_id)
  28592.     {
  28593.         return $this->getCreditNoteAttachmentsAsyncWithHttpInfo($xero_tenant_id$credit_note_id)
  28594.             ->then(
  28595.                 function ($response) {
  28596.                     return $response[0];
  28597.                 }
  28598.             );
  28599.     }
  28600.     /**
  28601.      * Operation getCreditNoteAttachmentsAsyncWithHttpInfo
  28602.      * Retrieves attachments for a specific credit notes
  28603.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  28604.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  28605.      * @throws \InvalidArgumentException
  28606.      * @return \GuzzleHttp\Promise\PromiseInterface */
  28607.     public function getCreditNoteAttachmentsAsyncWithHttpInfo($xero_tenant_id$credit_note_id)
  28608.     {
  28609.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  28610.         $request $this->getCreditNoteAttachmentsRequest($xero_tenant_id$credit_note_id);
  28611.         return $this->client
  28612.             ->sendAsync($request$this->createHttpClientOption())
  28613.             ->then(
  28614.                 function ($response) use ($returnType) {
  28615.                     $responseBody $response->getBody();
  28616.                     if ($returnType === '\SplFileObject') {
  28617.                         $content $responseBody//stream goes to serializer
  28618.                     } else {
  28619.                         $content $responseBody->getContents();
  28620.                     }
  28621.                     return [
  28622.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  28623.                         $response->getStatusCode(),
  28624.                         $response->getHeaders()
  28625.                     ];
  28626.                 },
  28627.                 function ($exception) {
  28628.                     $response $exception->getResponse();
  28629.                     $statusCode $response->getStatusCode();
  28630.                     throw new ApiException(
  28631.                         sprintf(
  28632.                             '[%d] Error connecting to the API (%s)',
  28633.                             $statusCode,
  28634.                             $exception->getRequest()->getUri()
  28635.                         ),
  28636.                         $statusCode,
  28637.                         $response->getHeaders(),
  28638.                         $response->getBody()
  28639.                     );
  28640.                 }
  28641.             );
  28642.     }
  28643.     /**
  28644.      * Create request for operation 'getCreditNoteAttachments'
  28645.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  28646.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  28647.      * @throws \InvalidArgumentException
  28648.      * @return \GuzzleHttp\Psr7\Request  */
  28649.     protected function getCreditNoteAttachmentsRequest($xero_tenant_id$credit_note_id)
  28650.     {
  28651.         // verify the required parameter 'xero_tenant_id' is set
  28652.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  28653.             throw new \InvalidArgumentException(
  28654.                 'Missing the required parameter $xero_tenant_id when calling getCreditNoteAttachments'
  28655.             );
  28656.         }
  28657.         // verify the required parameter 'credit_note_id' is set
  28658.         if ($credit_note_id === null || (is_array($credit_note_id) && count($credit_note_id) === 0)) {
  28659.             throw new \InvalidArgumentException(
  28660.                 'Missing the required parameter $credit_note_id when calling getCreditNoteAttachments'
  28661.             );
  28662.         }
  28663.         $resourcePath '/CreditNotes/{CreditNoteID}/Attachments';
  28664.         $formParams = [];
  28665.         $queryParams = [];
  28666.         $headerParams = [];
  28667.         $httpBody '';
  28668.         $multipart false;
  28669.         // header params
  28670.         if ($xero_tenant_id !== null) {
  28671.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  28672.         }
  28673.         // path params
  28674.         if ($credit_note_id !== null) {
  28675.             $resourcePath str_replace(
  28676.                 '{' 'CreditNoteID' '}',
  28677.                 AccountingObjectSerializer::toPathValue($credit_note_id),
  28678.                 $resourcePath
  28679.             );
  28680.         }
  28681.         // body params
  28682.         $_tempBody null;
  28683.         if ($multipart) {
  28684.             $headers $this->headerSelector->selectHeadersForMultipart(
  28685.                 ['application/json']
  28686.             );
  28687.         } else {
  28688.             $headers $this->headerSelector->selectHeaders(
  28689.                 ['application/json'],
  28690.                 []
  28691.             );
  28692.         }
  28693.         // for model (json/xml)
  28694.         if (isset($_tempBody)) {
  28695.             // $_tempBody is the method argument, if present
  28696.             if ($headers['Content-Type'] === 'application/json') {
  28697.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  28698.             } else {
  28699.                 $httpBody $_tempBody;
  28700.             }
  28701.         } elseif (count($formParams) > 0) {
  28702.             if ($multipart) {
  28703.                 $multipartContents = [
  28704.                     [
  28705.                         'Content-type' => 'multipart/form-data',
  28706.                     ]
  28707.                 ];
  28708.                 
  28709.                 // for HTTP post (form)
  28710.                 $httpBody = new MultipartStream($multipartContents);
  28711.             } elseif ($headers['Content-Type'] === 'application/json') {
  28712.                 $httpBody \GuzzleHttp\json_encode($formParams);
  28713.             } else {
  28714.                 // for HTTP post (form)
  28715.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  28716.             }
  28717.         }
  28718.         // this endpoint requires OAuth (access token)
  28719.         if ($this->config->getAccessToken() !== null) {
  28720.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  28721.         }
  28722.         $defaultHeaders = [];
  28723.         if ($this->config->getUserAgent()) {
  28724.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  28725.         }
  28726.         $headers array_merge(
  28727.             $defaultHeaders,
  28728.             $headerParams,
  28729.             $headers
  28730.         );
  28731.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  28732.         return new Request(
  28733.             'GET',
  28734.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  28735.             $headers,
  28736.             $httpBody
  28737.         );
  28738.     }
  28739.     /**
  28740.      * Operation getCreditNoteHistory
  28741.      * Retrieves history records of a specific credit note
  28742.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  28743.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  28744.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  28745.      * @throws \InvalidArgumentException
  28746.      * @return \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords
  28747.      */
  28748.     public function getCreditNoteHistory($xero_tenant_id$credit_note_id)
  28749.     {
  28750.         list($response) = $this->getCreditNoteHistoryWithHttpInfo($xero_tenant_id$credit_note_id);
  28751.         return $response;
  28752.     }
  28753.     /**
  28754.      * Operation getCreditNoteHistoryWithHttpInfo
  28755.      * Retrieves history records of a specific credit note
  28756.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  28757.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  28758.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  28759.      * @throws \InvalidArgumentException
  28760.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords, HTTP status code, HTTP response headers (array of strings)
  28761.      */
  28762.     public function getCreditNoteHistoryWithHttpInfo($xero_tenant_id$credit_note_id)
  28763.     {
  28764.         $request $this->getCreditNoteHistoryRequest($xero_tenant_id$credit_note_id);
  28765.         try {
  28766.             $options $this->createHttpClientOption();
  28767.             try {
  28768.                 $response $this->client->send($request$options);
  28769.             } catch (RequestException $e) {
  28770.                 throw new ApiException(
  28771.                     "[{$e->getCode()}{$e->getMessage()}",
  28772.                     $e->getCode(),
  28773.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  28774.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  28775.                 );
  28776.             }
  28777.             $statusCode $response->getStatusCode();
  28778.             if ($statusCode 200 || $statusCode 299) {
  28779.                 throw new ApiException(
  28780.                     sprintf(
  28781.                         '[%d] Error connecting to the API (%s)',
  28782.                         $statusCode,
  28783.                         $request->getUri()
  28784.                     ),
  28785.                     $statusCode,
  28786.                     $response->getHeaders(),
  28787.                     $response->getBody()
  28788.                 );
  28789.             }
  28790.             $responseBody $response->getBody();
  28791.             switch($statusCode) {
  28792.                 case 200:
  28793.                     if ('\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords' === '\SplFileObject') {
  28794.                         $content $responseBody//stream goes to serializer
  28795.                     } else {
  28796.                         $content $responseBody->getContents();
  28797.                     }
  28798.                     return [
  28799.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords', []),
  28800.                         $response->getStatusCode(),
  28801.                         $response->getHeaders()
  28802.                     ];
  28803.             }
  28804.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  28805.             $responseBody $response->getBody();
  28806.             if ($returnType === '\SplFileObject') {
  28807.                 $content $responseBody//stream goes to serializer
  28808.             } else {
  28809.                 $content $responseBody->getContents();
  28810.             }
  28811.             return [
  28812.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  28813.                 $response->getStatusCode(),
  28814.                 $response->getHeaders()
  28815.             ];
  28816.         } catch (ApiException $e) {
  28817.             switch ($e->getCode()) {
  28818.                 case 200:
  28819.                     $data AccountingObjectSerializer::deserialize(
  28820.                         $e->getResponseBody(),
  28821.                         '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords',
  28822.                         $e->getResponseHeaders()
  28823.                     );
  28824.                     $e->setResponseObject($data);
  28825.                     break;
  28826.             }
  28827.             throw $e;
  28828.         }
  28829.     }
  28830.     /**
  28831.      * Operation getCreditNoteHistoryAsync
  28832.      * Retrieves history records of a specific credit note
  28833.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  28834.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  28835.      * @throws \InvalidArgumentException
  28836.      * @return \GuzzleHttp\Promise\PromiseInterface
  28837.      */
  28838.     public function getCreditNoteHistoryAsync($xero_tenant_id$credit_note_id)
  28839.     {
  28840.         return $this->getCreditNoteHistoryAsyncWithHttpInfo($xero_tenant_id$credit_note_id)
  28841.             ->then(
  28842.                 function ($response) {
  28843.                     return $response[0];
  28844.                 }
  28845.             );
  28846.     }
  28847.     /**
  28848.      * Operation getCreditNoteHistoryAsyncWithHttpInfo
  28849.      * Retrieves history records of a specific credit note
  28850.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  28851.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  28852.      * @throws \InvalidArgumentException
  28853.      * @return \GuzzleHttp\Promise\PromiseInterface */
  28854.     public function getCreditNoteHistoryAsyncWithHttpInfo($xero_tenant_id$credit_note_id)
  28855.     {
  28856.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  28857.         $request $this->getCreditNoteHistoryRequest($xero_tenant_id$credit_note_id);
  28858.         return $this->client
  28859.             ->sendAsync($request$this->createHttpClientOption())
  28860.             ->then(
  28861.                 function ($response) use ($returnType) {
  28862.                     $responseBody $response->getBody();
  28863.                     if ($returnType === '\SplFileObject') {
  28864.                         $content $responseBody//stream goes to serializer
  28865.                     } else {
  28866.                         $content $responseBody->getContents();
  28867.                     }
  28868.                     return [
  28869.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  28870.                         $response->getStatusCode(),
  28871.                         $response->getHeaders()
  28872.                     ];
  28873.                 },
  28874.                 function ($exception) {
  28875.                     $response $exception->getResponse();
  28876.                     $statusCode $response->getStatusCode();
  28877.                     throw new ApiException(
  28878.                         sprintf(
  28879.                             '[%d] Error connecting to the API (%s)',
  28880.                             $statusCode,
  28881.                             $exception->getRequest()->getUri()
  28882.                         ),
  28883.                         $statusCode,
  28884.                         $response->getHeaders(),
  28885.                         $response->getBody()
  28886.                     );
  28887.                 }
  28888.             );
  28889.     }
  28890.     /**
  28891.      * Create request for operation 'getCreditNoteHistory'
  28892.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  28893.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  28894.      * @throws \InvalidArgumentException
  28895.      * @return \GuzzleHttp\Psr7\Request  */
  28896.     protected function getCreditNoteHistoryRequest($xero_tenant_id$credit_note_id)
  28897.     {
  28898.         // verify the required parameter 'xero_tenant_id' is set
  28899.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  28900.             throw new \InvalidArgumentException(
  28901.                 'Missing the required parameter $xero_tenant_id when calling getCreditNoteHistory'
  28902.             );
  28903.         }
  28904.         // verify the required parameter 'credit_note_id' is set
  28905.         if ($credit_note_id === null || (is_array($credit_note_id) && count($credit_note_id) === 0)) {
  28906.             throw new \InvalidArgumentException(
  28907.                 'Missing the required parameter $credit_note_id when calling getCreditNoteHistory'
  28908.             );
  28909.         }
  28910.         $resourcePath '/CreditNotes/{CreditNoteID}/History';
  28911.         $formParams = [];
  28912.         $queryParams = [];
  28913.         $headerParams = [];
  28914.         $httpBody '';
  28915.         $multipart false;
  28916.         // header params
  28917.         if ($xero_tenant_id !== null) {
  28918.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  28919.         }
  28920.         // path params
  28921.         if ($credit_note_id !== null) {
  28922.             $resourcePath str_replace(
  28923.                 '{' 'CreditNoteID' '}',
  28924.                 AccountingObjectSerializer::toPathValue($credit_note_id),
  28925.                 $resourcePath
  28926.             );
  28927.         }
  28928.         // body params
  28929.         $_tempBody null;
  28930.         if ($multipart) {
  28931.             $headers $this->headerSelector->selectHeadersForMultipart(
  28932.                 ['application/json']
  28933.             );
  28934.         } else {
  28935.             $headers $this->headerSelector->selectHeaders(
  28936.                 ['application/json'],
  28937.                 []
  28938.             );
  28939.         }
  28940.         // for model (json/xml)
  28941.         if (isset($_tempBody)) {
  28942.             // $_tempBody is the method argument, if present
  28943.             if ($headers['Content-Type'] === 'application/json') {
  28944.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  28945.             } else {
  28946.                 $httpBody $_tempBody;
  28947.             }
  28948.         } elseif (count($formParams) > 0) {
  28949.             if ($multipart) {
  28950.                 $multipartContents = [
  28951.                     [
  28952.                         'Content-type' => 'multipart/form-data',
  28953.                     ]
  28954.                 ];
  28955.                 
  28956.                 // for HTTP post (form)
  28957.                 $httpBody = new MultipartStream($multipartContents);
  28958.             } elseif ($headers['Content-Type'] === 'application/json') {
  28959.                 $httpBody \GuzzleHttp\json_encode($formParams);
  28960.             } else {
  28961.                 // for HTTP post (form)
  28962.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  28963.             }
  28964.         }
  28965.         // this endpoint requires OAuth (access token)
  28966.         if ($this->config->getAccessToken() !== null) {
  28967.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  28968.         }
  28969.         $defaultHeaders = [];
  28970.         if ($this->config->getUserAgent()) {
  28971.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  28972.         }
  28973.         $headers array_merge(
  28974.             $defaultHeaders,
  28975.             $headerParams,
  28976.             $headers
  28977.         );
  28978.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  28979.         return new Request(
  28980.             'GET',
  28981.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  28982.             $headers,
  28983.             $httpBody
  28984.         );
  28985.     }
  28986.     /**
  28987.      * Operation getCreditNotes
  28988.      * Retrieves any credit notes
  28989.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  28990.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  28991.      * @param  string $where Filter by an any element (optional)
  28992.      * @param  string $order Order by an any element (optional)
  28993.      * @param  int $page e.g. page&#x3D;1 â€“ Up to 100 credit notes will be returned in a single API call with line items shown for each credit note (optional)
  28994.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  28995.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  28996.      * @throws \InvalidArgumentException
  28997.      * @return \XeroAPI\XeroPHP\Models\Accounting\CreditNotes
  28998.      */
  28999.     public function getCreditNotes($xero_tenant_id$if_modified_since null$where null$order null$page null$unitdp null)
  29000.     {
  29001.         list($response) = $this->getCreditNotesWithHttpInfo($xero_tenant_id$if_modified_since$where$order$page$unitdp);
  29002.         return $response;
  29003.     }
  29004.     /**
  29005.      * Operation getCreditNotesWithHttpInfo
  29006.      * Retrieves any credit notes
  29007.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  29008.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  29009.      * @param  string $where Filter by an any element (optional)
  29010.      * @param  string $order Order by an any element (optional)
  29011.      * @param  int $page e.g. page&#x3D;1 â€“ Up to 100 credit notes will be returned in a single API call with line items shown for each credit note (optional)
  29012.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  29013.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  29014.      * @throws \InvalidArgumentException
  29015.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\CreditNotes, HTTP status code, HTTP response headers (array of strings)
  29016.      */
  29017.     public function getCreditNotesWithHttpInfo($xero_tenant_id$if_modified_since null$where null$order null$page null$unitdp null)
  29018.     {
  29019.         $request $this->getCreditNotesRequest($xero_tenant_id$if_modified_since$where$order$page$unitdp);
  29020.         try {
  29021.             $options $this->createHttpClientOption();
  29022.             try {
  29023.                 $response $this->client->send($request$options);
  29024.             } catch (RequestException $e) {
  29025.                 throw new ApiException(
  29026.                     "[{$e->getCode()}{$e->getMessage()}",
  29027.                     $e->getCode(),
  29028.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  29029.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  29030.                 );
  29031.             }
  29032.             $statusCode $response->getStatusCode();
  29033.             if ($statusCode 200 || $statusCode 299) {
  29034.                 throw new ApiException(
  29035.                     sprintf(
  29036.                         '[%d] Error connecting to the API (%s)',
  29037.                         $statusCode,
  29038.                         $request->getUri()
  29039.                     ),
  29040.                     $statusCode,
  29041.                     $response->getHeaders(),
  29042.                     $response->getBody()
  29043.                 );
  29044.             }
  29045.             $responseBody $response->getBody();
  29046.             switch($statusCode) {
  29047.                 case 200:
  29048.                     if ('\XeroAPI\XeroPHP\Models\Accounting\CreditNotes' === '\SplFileObject') {
  29049.                         $content $responseBody//stream goes to serializer
  29050.                     } else {
  29051.                         $content $responseBody->getContents();
  29052.                     }
  29053.                     return [
  29054.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\CreditNotes', []),
  29055.                         $response->getStatusCode(),
  29056.                         $response->getHeaders()
  29057.                     ];
  29058.             }
  29059.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\CreditNotes';
  29060.             $responseBody $response->getBody();
  29061.             if ($returnType === '\SplFileObject') {
  29062.                 $content $responseBody//stream goes to serializer
  29063.             } else {
  29064.                 $content $responseBody->getContents();
  29065.             }
  29066.             return [
  29067.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  29068.                 $response->getStatusCode(),
  29069.                 $response->getHeaders()
  29070.             ];
  29071.         } catch (ApiException $e) {
  29072.             switch ($e->getCode()) {
  29073.                 case 200:
  29074.                     $data AccountingObjectSerializer::deserialize(
  29075.                         $e->getResponseBody(),
  29076.                         '\XeroAPI\XeroPHP\Models\Accounting\CreditNotes',
  29077.                         $e->getResponseHeaders()
  29078.                     );
  29079.                     $e->setResponseObject($data);
  29080.                     break;
  29081.             }
  29082.             throw $e;
  29083.         }
  29084.     }
  29085.     /**
  29086.      * Operation getCreditNotesAsync
  29087.      * Retrieves any credit notes
  29088.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  29089.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  29090.      * @param  string $where Filter by an any element (optional)
  29091.      * @param  string $order Order by an any element (optional)
  29092.      * @param  int $page e.g. page&#x3D;1 â€“ Up to 100 credit notes will be returned in a single API call with line items shown for each credit note (optional)
  29093.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  29094.      * @throws \InvalidArgumentException
  29095.      * @return \GuzzleHttp\Promise\PromiseInterface
  29096.      */
  29097.     public function getCreditNotesAsync($xero_tenant_id$if_modified_since null$where null$order null$page null$unitdp null)
  29098.     {
  29099.         return $this->getCreditNotesAsyncWithHttpInfo($xero_tenant_id$if_modified_since$where$order$page$unitdp)
  29100.             ->then(
  29101.                 function ($response) {
  29102.                     return $response[0];
  29103.                 }
  29104.             );
  29105.     }
  29106.     /**
  29107.      * Operation getCreditNotesAsyncWithHttpInfo
  29108.      * Retrieves any credit notes
  29109.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  29110.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  29111.      * @param  string $where Filter by an any element (optional)
  29112.      * @param  string $order Order by an any element (optional)
  29113.      * @param  int $page e.g. page&#x3D;1 â€“ Up to 100 credit notes will be returned in a single API call with line items shown for each credit note (optional)
  29114.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  29115.      * @throws \InvalidArgumentException
  29116.      * @return \GuzzleHttp\Promise\PromiseInterface */
  29117.     public function getCreditNotesAsyncWithHttpInfo($xero_tenant_id$if_modified_since null$where null$order null$page null$unitdp null)
  29118.     {
  29119.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\CreditNotes';
  29120.         $request $this->getCreditNotesRequest($xero_tenant_id$if_modified_since$where$order$page$unitdp);
  29121.         return $this->client
  29122.             ->sendAsync($request$this->createHttpClientOption())
  29123.             ->then(
  29124.                 function ($response) use ($returnType) {
  29125.                     $responseBody $response->getBody();
  29126.                     if ($returnType === '\SplFileObject') {
  29127.                         $content $responseBody//stream goes to serializer
  29128.                     } else {
  29129.                         $content $responseBody->getContents();
  29130.                     }
  29131.                     return [
  29132.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  29133.                         $response->getStatusCode(),
  29134.                         $response->getHeaders()
  29135.                     ];
  29136.                 },
  29137.                 function ($exception) {
  29138.                     $response $exception->getResponse();
  29139.                     $statusCode $response->getStatusCode();
  29140.                     throw new ApiException(
  29141.                         sprintf(
  29142.                             '[%d] Error connecting to the API (%s)',
  29143.                             $statusCode,
  29144.                             $exception->getRequest()->getUri()
  29145.                         ),
  29146.                         $statusCode,
  29147.                         $response->getHeaders(),
  29148.                         $response->getBody()
  29149.                     );
  29150.                 }
  29151.             );
  29152.     }
  29153.     /**
  29154.      * Create request for operation 'getCreditNotes'
  29155.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  29156.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  29157.      * @param  string $where Filter by an any element (optional)
  29158.      * @param  string $order Order by an any element (optional)
  29159.      * @param  int $page e.g. page&#x3D;1 â€“ Up to 100 credit notes will be returned in a single API call with line items shown for each credit note (optional)
  29160.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  29161.      * @throws \InvalidArgumentException
  29162.      * @return \GuzzleHttp\Psr7\Request  */
  29163.     protected function getCreditNotesRequest($xero_tenant_id$if_modified_since null$where null$order null$page null$unitdp null)
  29164.     {
  29165.         // verify the required parameter 'xero_tenant_id' is set
  29166.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  29167.             throw new \InvalidArgumentException(
  29168.                 'Missing the required parameter $xero_tenant_id when calling getCreditNotes'
  29169.             );
  29170.         }
  29171.         $resourcePath '/CreditNotes';
  29172.         $formParams = [];
  29173.         $queryParams = [];
  29174.         $headerParams = [];
  29175.         $httpBody '';
  29176.         $multipart false;
  29177.         // query params
  29178.         if ($where !== null) {
  29179.             $queryParams['where'] = AccountingObjectSerializer::toQueryValue($where);
  29180.         }
  29181.         // query params
  29182.         if ($order !== null) {
  29183.             $queryParams['order'] = AccountingObjectSerializer::toQueryValue($order);
  29184.         }
  29185.         // query params
  29186.         if ($page !== null) {
  29187.             $queryParams['page'] = AccountingObjectSerializer::toQueryValue($page);
  29188.         }
  29189.         // query params
  29190.         if ($unitdp !== null) {
  29191.             $queryParams['unitdp'] = AccountingObjectSerializer::toQueryValue($unitdp);
  29192.         }
  29193.         // header params
  29194.         if ($xero_tenant_id !== null) {
  29195.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  29196.         }
  29197.         // header params
  29198.         if ($if_modified_since !== null) {
  29199.             $headerParams['If-Modified-Since'] = AccountingObjectSerializer::toHeaderValue($if_modified_since);
  29200.         }
  29201.         // body params
  29202.         $_tempBody null;
  29203.         if ($multipart) {
  29204.             $headers $this->headerSelector->selectHeadersForMultipart(
  29205.                 ['application/json']
  29206.             );
  29207.         } else {
  29208.             $headers $this->headerSelector->selectHeaders(
  29209.                 ['application/json'],
  29210.                 []
  29211.             );
  29212.         }
  29213.         // for model (json/xml)
  29214.         if (isset($_tempBody)) {
  29215.             // $_tempBody is the method argument, if present
  29216.             if ($headers['Content-Type'] === 'application/json') {
  29217.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  29218.             } else {
  29219.                 $httpBody $_tempBody;
  29220.             }
  29221.         } elseif (count($formParams) > 0) {
  29222.             if ($multipart) {
  29223.                 $multipartContents = [
  29224.                     [
  29225.                         'Content-type' => 'multipart/form-data',
  29226.                     ]
  29227.                 ];
  29228.                 
  29229.                 // for HTTP post (form)
  29230.                 $httpBody = new MultipartStream($multipartContents);
  29231.             } elseif ($headers['Content-Type'] === 'application/json') {
  29232.                 $httpBody \GuzzleHttp\json_encode($formParams);
  29233.             } else {
  29234.                 // for HTTP post (form)
  29235.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  29236.             }
  29237.         }
  29238.         // this endpoint requires OAuth (access token)
  29239.         if ($this->config->getAccessToken() !== null) {
  29240.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  29241.         }
  29242.         $defaultHeaders = [];
  29243.         if ($this->config->getUserAgent()) {
  29244.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  29245.         }
  29246.         $headers array_merge(
  29247.             $defaultHeaders,
  29248.             $headerParams,
  29249.             $headers
  29250.         );
  29251.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  29252.         return new Request(
  29253.             'GET',
  29254.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  29255.             $headers,
  29256.             $httpBody
  29257.         );
  29258.     }
  29259.     /**
  29260.      * Operation getCurrencies
  29261.      * Retrieves currencies for your Xero organisation
  29262.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  29263.      * @param  string $where Filter by an any element (optional)
  29264.      * @param  string $order Order by an any element (optional)
  29265.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  29266.      * @throws \InvalidArgumentException
  29267.      * @return \XeroAPI\XeroPHP\Models\Accounting\Currencies
  29268.      */
  29269.     public function getCurrencies($xero_tenant_id$where null$order null)
  29270.     {
  29271.         list($response) = $this->getCurrenciesWithHttpInfo($xero_tenant_id$where$order);
  29272.         return $response;
  29273.     }
  29274.     /**
  29275.      * Operation getCurrenciesWithHttpInfo
  29276.      * Retrieves currencies for your Xero organisation
  29277.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  29278.      * @param  string $where Filter by an any element (optional)
  29279.      * @param  string $order Order by an any element (optional)
  29280.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  29281.      * @throws \InvalidArgumentException
  29282.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Currencies, HTTP status code, HTTP response headers (array of strings)
  29283.      */
  29284.     public function getCurrenciesWithHttpInfo($xero_tenant_id$where null$order null)
  29285.     {
  29286.         $request $this->getCurrenciesRequest($xero_tenant_id$where$order);
  29287.         try {
  29288.             $options $this->createHttpClientOption();
  29289.             try {
  29290.                 $response $this->client->send($request$options);
  29291.             } catch (RequestException $e) {
  29292.                 throw new ApiException(
  29293.                     "[{$e->getCode()}{$e->getMessage()}",
  29294.                     $e->getCode(),
  29295.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  29296.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  29297.                 );
  29298.             }
  29299.             $statusCode $response->getStatusCode();
  29300.             if ($statusCode 200 || $statusCode 299) {
  29301.                 throw new ApiException(
  29302.                     sprintf(
  29303.                         '[%d] Error connecting to the API (%s)',
  29304.                         $statusCode,
  29305.                         $request->getUri()
  29306.                     ),
  29307.                     $statusCode,
  29308.                     $response->getHeaders(),
  29309.                     $response->getBody()
  29310.                 );
  29311.             }
  29312.             $responseBody $response->getBody();
  29313.             switch($statusCode) {
  29314.                 case 200:
  29315.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Currencies' === '\SplFileObject') {
  29316.                         $content $responseBody//stream goes to serializer
  29317.                     } else {
  29318.                         $content $responseBody->getContents();
  29319.                     }
  29320.                     return [
  29321.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Currencies', []),
  29322.                         $response->getStatusCode(),
  29323.                         $response->getHeaders()
  29324.                     ];
  29325.             }
  29326.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Currencies';
  29327.             $responseBody $response->getBody();
  29328.             if ($returnType === '\SplFileObject') {
  29329.                 $content $responseBody//stream goes to serializer
  29330.             } else {
  29331.                 $content $responseBody->getContents();
  29332.             }
  29333.             return [
  29334.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  29335.                 $response->getStatusCode(),
  29336.                 $response->getHeaders()
  29337.             ];
  29338.         } catch (ApiException $e) {
  29339.             switch ($e->getCode()) {
  29340.                 case 200:
  29341.                     $data AccountingObjectSerializer::deserialize(
  29342.                         $e->getResponseBody(),
  29343.                         '\XeroAPI\XeroPHP\Models\Accounting\Currencies',
  29344.                         $e->getResponseHeaders()
  29345.                     );
  29346.                     $e->setResponseObject($data);
  29347.                     break;
  29348.             }
  29349.             throw $e;
  29350.         }
  29351.     }
  29352.     /**
  29353.      * Operation getCurrenciesAsync
  29354.      * Retrieves currencies for your Xero organisation
  29355.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  29356.      * @param  string $where Filter by an any element (optional)
  29357.      * @param  string $order Order by an any element (optional)
  29358.      * @throws \InvalidArgumentException
  29359.      * @return \GuzzleHttp\Promise\PromiseInterface
  29360.      */
  29361.     public function getCurrenciesAsync($xero_tenant_id$where null$order null)
  29362.     {
  29363.         return $this->getCurrenciesAsyncWithHttpInfo($xero_tenant_id$where$order)
  29364.             ->then(
  29365.                 function ($response) {
  29366.                     return $response[0];
  29367.                 }
  29368.             );
  29369.     }
  29370.     /**
  29371.      * Operation getCurrenciesAsyncWithHttpInfo
  29372.      * Retrieves currencies for your Xero organisation
  29373.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  29374.      * @param  string $where Filter by an any element (optional)
  29375.      * @param  string $order Order by an any element (optional)
  29376.      * @throws \InvalidArgumentException
  29377.      * @return \GuzzleHttp\Promise\PromiseInterface */
  29378.     public function getCurrenciesAsyncWithHttpInfo($xero_tenant_id$where null$order null)
  29379.     {
  29380.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Currencies';
  29381.         $request $this->getCurrenciesRequest($xero_tenant_id$where$order);
  29382.         return $this->client
  29383.             ->sendAsync($request$this->createHttpClientOption())
  29384.             ->then(
  29385.                 function ($response) use ($returnType) {
  29386.                     $responseBody $response->getBody();
  29387.                     if ($returnType === '\SplFileObject') {
  29388.                         $content $responseBody//stream goes to serializer
  29389.                     } else {
  29390.                         $content $responseBody->getContents();
  29391.                     }
  29392.                     return [
  29393.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  29394.                         $response->getStatusCode(),
  29395.                         $response->getHeaders()
  29396.                     ];
  29397.                 },
  29398.                 function ($exception) {
  29399.                     $response $exception->getResponse();
  29400.                     $statusCode $response->getStatusCode();
  29401.                     throw new ApiException(
  29402.                         sprintf(
  29403.                             '[%d] Error connecting to the API (%s)',
  29404.                             $statusCode,
  29405.                             $exception->getRequest()->getUri()
  29406.                         ),
  29407.                         $statusCode,
  29408.                         $response->getHeaders(),
  29409.                         $response->getBody()
  29410.                     );
  29411.                 }
  29412.             );
  29413.     }
  29414.     /**
  29415.      * Create request for operation 'getCurrencies'
  29416.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  29417.      * @param  string $where Filter by an any element (optional)
  29418.      * @param  string $order Order by an any element (optional)
  29419.      * @throws \InvalidArgumentException
  29420.      * @return \GuzzleHttp\Psr7\Request  */
  29421.     protected function getCurrenciesRequest($xero_tenant_id$where null$order null)
  29422.     {
  29423.         // verify the required parameter 'xero_tenant_id' is set
  29424.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  29425.             throw new \InvalidArgumentException(
  29426.                 'Missing the required parameter $xero_tenant_id when calling getCurrencies'
  29427.             );
  29428.         }
  29429.         $resourcePath '/Currencies';
  29430.         $formParams = [];
  29431.         $queryParams = [];
  29432.         $headerParams = [];
  29433.         $httpBody '';
  29434.         $multipart false;
  29435.         // query params
  29436.         if ($where !== null) {
  29437.             $queryParams['where'] = AccountingObjectSerializer::toQueryValue($where);
  29438.         }
  29439.         // query params
  29440.         if ($order !== null) {
  29441.             $queryParams['order'] = AccountingObjectSerializer::toQueryValue($order);
  29442.         }
  29443.         // header params
  29444.         if ($xero_tenant_id !== null) {
  29445.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  29446.         }
  29447.         // body params
  29448.         $_tempBody null;
  29449.         if ($multipart) {
  29450.             $headers $this->headerSelector->selectHeadersForMultipart(
  29451.                 ['application/json']
  29452.             );
  29453.         } else {
  29454.             $headers $this->headerSelector->selectHeaders(
  29455.                 ['application/json'],
  29456.                 []
  29457.             );
  29458.         }
  29459.         // for model (json/xml)
  29460.         if (isset($_tempBody)) {
  29461.             // $_tempBody is the method argument, if present
  29462.             if ($headers['Content-Type'] === 'application/json') {
  29463.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  29464.             } else {
  29465.                 $httpBody $_tempBody;
  29466.             }
  29467.         } elseif (count($formParams) > 0) {
  29468.             if ($multipart) {
  29469.                 $multipartContents = [
  29470.                     [
  29471.                         'Content-type' => 'multipart/form-data',
  29472.                     ]
  29473.                 ];
  29474.                 
  29475.                 // for HTTP post (form)
  29476.                 $httpBody = new MultipartStream($multipartContents);
  29477.             } elseif ($headers['Content-Type'] === 'application/json') {
  29478.                 $httpBody \GuzzleHttp\json_encode($formParams);
  29479.             } else {
  29480.                 // for HTTP post (form)
  29481.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  29482.             }
  29483.         }
  29484.         // this endpoint requires OAuth (access token)
  29485.         if ($this->config->getAccessToken() !== null) {
  29486.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  29487.         }
  29488.         $defaultHeaders = [];
  29489.         if ($this->config->getUserAgent()) {
  29490.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  29491.         }
  29492.         $headers array_merge(
  29493.             $defaultHeaders,
  29494.             $headerParams,
  29495.             $headers
  29496.         );
  29497.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  29498.         return new Request(
  29499.             'GET',
  29500.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  29501.             $headers,
  29502.             $httpBody
  29503.         );
  29504.     }
  29505.     /**
  29506.      * Operation getEmployee
  29507.      * Retrieves a specific employee used in Xero payrun using a unique employee Id
  29508.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  29509.      * @param  string $employee_id Unique identifier for a Employee (required)
  29510.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  29511.      * @throws \InvalidArgumentException
  29512.      * @return \XeroAPI\XeroPHP\Models\Accounting\Employees
  29513.      */
  29514.     public function getEmployee($xero_tenant_id$employee_id)
  29515.     {
  29516.         list($response) = $this->getEmployeeWithHttpInfo($xero_tenant_id$employee_id);
  29517.         return $response;
  29518.     }
  29519.     /**
  29520.      * Operation getEmployeeWithHttpInfo
  29521.      * Retrieves a specific employee used in Xero payrun using a unique employee Id
  29522.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  29523.      * @param  string $employee_id Unique identifier for a Employee (required)
  29524.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  29525.      * @throws \InvalidArgumentException
  29526.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Employees, HTTP status code, HTTP response headers (array of strings)
  29527.      */
  29528.     public function getEmployeeWithHttpInfo($xero_tenant_id$employee_id)
  29529.     {
  29530.         $request $this->getEmployeeRequest($xero_tenant_id$employee_id);
  29531.         try {
  29532.             $options $this->createHttpClientOption();
  29533.             try {
  29534.                 $response $this->client->send($request$options);
  29535.             } catch (RequestException $e) {
  29536.                 throw new ApiException(
  29537.                     "[{$e->getCode()}{$e->getMessage()}",
  29538.                     $e->getCode(),
  29539.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  29540.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  29541.                 );
  29542.             }
  29543.             $statusCode $response->getStatusCode();
  29544.             if ($statusCode 200 || $statusCode 299) {
  29545.                 throw new ApiException(
  29546.                     sprintf(
  29547.                         '[%d] Error connecting to the API (%s)',
  29548.                         $statusCode,
  29549.                         $request->getUri()
  29550.                     ),
  29551.                     $statusCode,
  29552.                     $response->getHeaders(),
  29553.                     $response->getBody()
  29554.                 );
  29555.             }
  29556.             $responseBody $response->getBody();
  29557.             switch($statusCode) {
  29558.                 case 200:
  29559.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Employees' === '\SplFileObject') {
  29560.                         $content $responseBody//stream goes to serializer
  29561.                     } else {
  29562.                         $content $responseBody->getContents();
  29563.                     }
  29564.                     return [
  29565.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Employees', []),
  29566.                         $response->getStatusCode(),
  29567.                         $response->getHeaders()
  29568.                     ];
  29569.             }
  29570.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Employees';
  29571.             $responseBody $response->getBody();
  29572.             if ($returnType === '\SplFileObject') {
  29573.                 $content $responseBody//stream goes to serializer
  29574.             } else {
  29575.                 $content $responseBody->getContents();
  29576.             }
  29577.             return [
  29578.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  29579.                 $response->getStatusCode(),
  29580.                 $response->getHeaders()
  29581.             ];
  29582.         } catch (ApiException $e) {
  29583.             switch ($e->getCode()) {
  29584.                 case 200:
  29585.                     $data AccountingObjectSerializer::deserialize(
  29586.                         $e->getResponseBody(),
  29587.                         '\XeroAPI\XeroPHP\Models\Accounting\Employees',
  29588.                         $e->getResponseHeaders()
  29589.                     );
  29590.                     $e->setResponseObject($data);
  29591.                     break;
  29592.             }
  29593.             throw $e;
  29594.         }
  29595.     }
  29596.     /**
  29597.      * Operation getEmployeeAsync
  29598.      * Retrieves a specific employee used in Xero payrun using a unique employee Id
  29599.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  29600.      * @param  string $employee_id Unique identifier for a Employee (required)
  29601.      * @throws \InvalidArgumentException
  29602.      * @return \GuzzleHttp\Promise\PromiseInterface
  29603.      */
  29604.     public function getEmployeeAsync($xero_tenant_id$employee_id)
  29605.     {
  29606.         return $this->getEmployeeAsyncWithHttpInfo($xero_tenant_id$employee_id)
  29607.             ->then(
  29608.                 function ($response) {
  29609.                     return $response[0];
  29610.                 }
  29611.             );
  29612.     }
  29613.     /**
  29614.      * Operation getEmployeeAsyncWithHttpInfo
  29615.      * Retrieves a specific employee used in Xero payrun using a unique employee Id
  29616.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  29617.      * @param  string $employee_id Unique identifier for a Employee (required)
  29618.      * @throws \InvalidArgumentException
  29619.      * @return \GuzzleHttp\Promise\PromiseInterface */
  29620.     public function getEmployeeAsyncWithHttpInfo($xero_tenant_id$employee_id)
  29621.     {
  29622.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Employees';
  29623.         $request $this->getEmployeeRequest($xero_tenant_id$employee_id);
  29624.         return $this->client
  29625.             ->sendAsync($request$this->createHttpClientOption())
  29626.             ->then(
  29627.                 function ($response) use ($returnType) {
  29628.                     $responseBody $response->getBody();
  29629.                     if ($returnType === '\SplFileObject') {
  29630.                         $content $responseBody//stream goes to serializer
  29631.                     } else {
  29632.                         $content $responseBody->getContents();
  29633.                     }
  29634.                     return [
  29635.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  29636.                         $response->getStatusCode(),
  29637.                         $response->getHeaders()
  29638.                     ];
  29639.                 },
  29640.                 function ($exception) {
  29641.                     $response $exception->getResponse();
  29642.                     $statusCode $response->getStatusCode();
  29643.                     throw new ApiException(
  29644.                         sprintf(
  29645.                             '[%d] Error connecting to the API (%s)',
  29646.                             $statusCode,
  29647.                             $exception->getRequest()->getUri()
  29648.                         ),
  29649.                         $statusCode,
  29650.                         $response->getHeaders(),
  29651.                         $response->getBody()
  29652.                     );
  29653.                 }
  29654.             );
  29655.     }
  29656.     /**
  29657.      * Create request for operation 'getEmployee'
  29658.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  29659.      * @param  string $employee_id Unique identifier for a Employee (required)
  29660.      * @throws \InvalidArgumentException
  29661.      * @return \GuzzleHttp\Psr7\Request  */
  29662.     protected function getEmployeeRequest($xero_tenant_id$employee_id)
  29663.     {
  29664.         // verify the required parameter 'xero_tenant_id' is set
  29665.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  29666.             throw new \InvalidArgumentException(
  29667.                 'Missing the required parameter $xero_tenant_id when calling getEmployee'
  29668.             );
  29669.         }
  29670.         // verify the required parameter 'employee_id' is set
  29671.         if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) {
  29672.             throw new \InvalidArgumentException(
  29673.                 'Missing the required parameter $employee_id when calling getEmployee'
  29674.             );
  29675.         }
  29676.         $resourcePath '/Employees/{EmployeeID}';
  29677.         $formParams = [];
  29678.         $queryParams = [];
  29679.         $headerParams = [];
  29680.         $httpBody '';
  29681.         $multipart false;
  29682.         // header params
  29683.         if ($xero_tenant_id !== null) {
  29684.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  29685.         }
  29686.         // path params
  29687.         if ($employee_id !== null) {
  29688.             $resourcePath str_replace(
  29689.                 '{' 'EmployeeID' '}',
  29690.                 AccountingObjectSerializer::toPathValue($employee_id),
  29691.                 $resourcePath
  29692.             );
  29693.         }
  29694.         // body params
  29695.         $_tempBody null;
  29696.         if ($multipart) {
  29697.             $headers $this->headerSelector->selectHeadersForMultipart(
  29698.                 ['application/json']
  29699.             );
  29700.         } else {
  29701.             $headers $this->headerSelector->selectHeaders(
  29702.                 ['application/json'],
  29703.                 []
  29704.             );
  29705.         }
  29706.         // for model (json/xml)
  29707.         if (isset($_tempBody)) {
  29708.             // $_tempBody is the method argument, if present
  29709.             if ($headers['Content-Type'] === 'application/json') {
  29710.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  29711.             } else {
  29712.                 $httpBody $_tempBody;
  29713.             }
  29714.         } elseif (count($formParams) > 0) {
  29715.             if ($multipart) {
  29716.                 $multipartContents = [
  29717.                     [
  29718.                         'Content-type' => 'multipart/form-data',
  29719.                     ]
  29720.                 ];
  29721.                 
  29722.                 // for HTTP post (form)
  29723.                 $httpBody = new MultipartStream($multipartContents);
  29724.             } elseif ($headers['Content-Type'] === 'application/json') {
  29725.                 $httpBody \GuzzleHttp\json_encode($formParams);
  29726.             } else {
  29727.                 // for HTTP post (form)
  29728.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  29729.             }
  29730.         }
  29731.         // this endpoint requires OAuth (access token)
  29732.         if ($this->config->getAccessToken() !== null) {
  29733.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  29734.         }
  29735.         $defaultHeaders = [];
  29736.         if ($this->config->getUserAgent()) {
  29737.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  29738.         }
  29739.         $headers array_merge(
  29740.             $defaultHeaders,
  29741.             $headerParams,
  29742.             $headers
  29743.         );
  29744.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  29745.         return new Request(
  29746.             'GET',
  29747.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  29748.             $headers,
  29749.             $httpBody
  29750.         );
  29751.     }
  29752.     /**
  29753.      * Operation getEmployees
  29754.      * Retrieves employees used in Xero payrun
  29755.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  29756.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  29757.      * @param  string $where Filter by an any element (optional)
  29758.      * @param  string $order Order by an any element (optional)
  29759.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  29760.      * @throws \InvalidArgumentException
  29761.      * @return \XeroAPI\XeroPHP\Models\Accounting\Employees
  29762.      */
  29763.     public function getEmployees($xero_tenant_id$if_modified_since null$where null$order null)
  29764.     {
  29765.         list($response) = $this->getEmployeesWithHttpInfo($xero_tenant_id$if_modified_since$where$order);
  29766.         return $response;
  29767.     }
  29768.     /**
  29769.      * Operation getEmployeesWithHttpInfo
  29770.      * Retrieves employees used in Xero payrun
  29771.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  29772.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  29773.      * @param  string $where Filter by an any element (optional)
  29774.      * @param  string $order Order by an any element (optional)
  29775.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  29776.      * @throws \InvalidArgumentException
  29777.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Employees, HTTP status code, HTTP response headers (array of strings)
  29778.      */
  29779.     public function getEmployeesWithHttpInfo($xero_tenant_id$if_modified_since null$where null$order null)
  29780.     {
  29781.         $request $this->getEmployeesRequest($xero_tenant_id$if_modified_since$where$order);
  29782.         try {
  29783.             $options $this->createHttpClientOption();
  29784.             try {
  29785.                 $response $this->client->send($request$options);
  29786.             } catch (RequestException $e) {
  29787.                 throw new ApiException(
  29788.                     "[{$e->getCode()}{$e->getMessage()}",
  29789.                     $e->getCode(),
  29790.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  29791.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  29792.                 );
  29793.             }
  29794.             $statusCode $response->getStatusCode();
  29795.             if ($statusCode 200 || $statusCode 299) {
  29796.                 throw new ApiException(
  29797.                     sprintf(
  29798.                         '[%d] Error connecting to the API (%s)',
  29799.                         $statusCode,
  29800.                         $request->getUri()
  29801.                     ),
  29802.                     $statusCode,
  29803.                     $response->getHeaders(),
  29804.                     $response->getBody()
  29805.                 );
  29806.             }
  29807.             $responseBody $response->getBody();
  29808.             switch($statusCode) {
  29809.                 case 200:
  29810.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Employees' === '\SplFileObject') {
  29811.                         $content $responseBody//stream goes to serializer
  29812.                     } else {
  29813.                         $content $responseBody->getContents();
  29814.                     }
  29815.                     return [
  29816.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Employees', []),
  29817.                         $response->getStatusCode(),
  29818.                         $response->getHeaders()
  29819.                     ];
  29820.             }
  29821.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Employees';
  29822.             $responseBody $response->getBody();
  29823.             if ($returnType === '\SplFileObject') {
  29824.                 $content $responseBody//stream goes to serializer
  29825.             } else {
  29826.                 $content $responseBody->getContents();
  29827.             }
  29828.             return [
  29829.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  29830.                 $response->getStatusCode(),
  29831.                 $response->getHeaders()
  29832.             ];
  29833.         } catch (ApiException $e) {
  29834.             switch ($e->getCode()) {
  29835.                 case 200:
  29836.                     $data AccountingObjectSerializer::deserialize(
  29837.                         $e->getResponseBody(),
  29838.                         '\XeroAPI\XeroPHP\Models\Accounting\Employees',
  29839.                         $e->getResponseHeaders()
  29840.                     );
  29841.                     $e->setResponseObject($data);
  29842.                     break;
  29843.             }
  29844.             throw $e;
  29845.         }
  29846.     }
  29847.     /**
  29848.      * Operation getEmployeesAsync
  29849.      * Retrieves employees used in Xero payrun
  29850.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  29851.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  29852.      * @param  string $where Filter by an any element (optional)
  29853.      * @param  string $order Order by an any element (optional)
  29854.      * @throws \InvalidArgumentException
  29855.      * @return \GuzzleHttp\Promise\PromiseInterface
  29856.      */
  29857.     public function getEmployeesAsync($xero_tenant_id$if_modified_since null$where null$order null)
  29858.     {
  29859.         return $this->getEmployeesAsyncWithHttpInfo($xero_tenant_id$if_modified_since$where$order)
  29860.             ->then(
  29861.                 function ($response) {
  29862.                     return $response[0];
  29863.                 }
  29864.             );
  29865.     }
  29866.     /**
  29867.      * Operation getEmployeesAsyncWithHttpInfo
  29868.      * Retrieves employees used in Xero payrun
  29869.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  29870.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  29871.      * @param  string $where Filter by an any element (optional)
  29872.      * @param  string $order Order by an any element (optional)
  29873.      * @throws \InvalidArgumentException
  29874.      * @return \GuzzleHttp\Promise\PromiseInterface */
  29875.     public function getEmployeesAsyncWithHttpInfo($xero_tenant_id$if_modified_since null$where null$order null)
  29876.     {
  29877.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Employees';
  29878.         $request $this->getEmployeesRequest($xero_tenant_id$if_modified_since$where$order);
  29879.         return $this->client
  29880.             ->sendAsync($request$this->createHttpClientOption())
  29881.             ->then(
  29882.                 function ($response) use ($returnType) {
  29883.                     $responseBody $response->getBody();
  29884.                     if ($returnType === '\SplFileObject') {
  29885.                         $content $responseBody//stream goes to serializer
  29886.                     } else {
  29887.                         $content $responseBody->getContents();
  29888.                     }
  29889.                     return [
  29890.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  29891.                         $response->getStatusCode(),
  29892.                         $response->getHeaders()
  29893.                     ];
  29894.                 },
  29895.                 function ($exception) {
  29896.                     $response $exception->getResponse();
  29897.                     $statusCode $response->getStatusCode();
  29898.                     throw new ApiException(
  29899.                         sprintf(
  29900.                             '[%d] Error connecting to the API (%s)',
  29901.                             $statusCode,
  29902.                             $exception->getRequest()->getUri()
  29903.                         ),
  29904.                         $statusCode,
  29905.                         $response->getHeaders(),
  29906.                         $response->getBody()
  29907.                     );
  29908.                 }
  29909.             );
  29910.     }
  29911.     /**
  29912.      * Create request for operation 'getEmployees'
  29913.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  29914.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  29915.      * @param  string $where Filter by an any element (optional)
  29916.      * @param  string $order Order by an any element (optional)
  29917.      * @throws \InvalidArgumentException
  29918.      * @return \GuzzleHttp\Psr7\Request  */
  29919.     protected function getEmployeesRequest($xero_tenant_id$if_modified_since null$where null$order null)
  29920.     {
  29921.         // verify the required parameter 'xero_tenant_id' is set
  29922.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  29923.             throw new \InvalidArgumentException(
  29924.                 'Missing the required parameter $xero_tenant_id when calling getEmployees'
  29925.             );
  29926.         }
  29927.         $resourcePath '/Employees';
  29928.         $formParams = [];
  29929.         $queryParams = [];
  29930.         $headerParams = [];
  29931.         $httpBody '';
  29932.         $multipart false;
  29933.         // query params
  29934.         if ($where !== null) {
  29935.             $queryParams['where'] = AccountingObjectSerializer::toQueryValue($where);
  29936.         }
  29937.         // query params
  29938.         if ($order !== null) {
  29939.             $queryParams['order'] = AccountingObjectSerializer::toQueryValue($order);
  29940.         }
  29941.         // header params
  29942.         if ($xero_tenant_id !== null) {
  29943.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  29944.         }
  29945.         // header params
  29946.         if ($if_modified_since !== null) {
  29947.             $headerParams['If-Modified-Since'] = AccountingObjectSerializer::toHeaderValue($if_modified_since);
  29948.         }
  29949.         // body params
  29950.         $_tempBody null;
  29951.         if ($multipart) {
  29952.             $headers $this->headerSelector->selectHeadersForMultipart(
  29953.                 ['application/json']
  29954.             );
  29955.         } else {
  29956.             $headers $this->headerSelector->selectHeaders(
  29957.                 ['application/json'],
  29958.                 []
  29959.             );
  29960.         }
  29961.         // for model (json/xml)
  29962.         if (isset($_tempBody)) {
  29963.             // $_tempBody is the method argument, if present
  29964.             if ($headers['Content-Type'] === 'application/json') {
  29965.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  29966.             } else {
  29967.                 $httpBody $_tempBody;
  29968.             }
  29969.         } elseif (count($formParams) > 0) {
  29970.             if ($multipart) {
  29971.                 $multipartContents = [
  29972.                     [
  29973.                         'Content-type' => 'multipart/form-data',
  29974.                     ]
  29975.                 ];
  29976.                 
  29977.                 // for HTTP post (form)
  29978.                 $httpBody = new MultipartStream($multipartContents);
  29979.             } elseif ($headers['Content-Type'] === 'application/json') {
  29980.                 $httpBody \GuzzleHttp\json_encode($formParams);
  29981.             } else {
  29982.                 // for HTTP post (form)
  29983.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  29984.             }
  29985.         }
  29986.         // this endpoint requires OAuth (access token)
  29987.         if ($this->config->getAccessToken() !== null) {
  29988.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  29989.         }
  29990.         $defaultHeaders = [];
  29991.         if ($this->config->getUserAgent()) {
  29992.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  29993.         }
  29994.         $headers array_merge(
  29995.             $defaultHeaders,
  29996.             $headerParams,
  29997.             $headers
  29998.         );
  29999.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  30000.         return new Request(
  30001.             'GET',
  30002.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  30003.             $headers,
  30004.             $httpBody
  30005.         );
  30006.     }
  30007.     /**
  30008.      * Operation getExpenseClaim
  30009.      * Retrieves a specific expense claim using a unique expense claim Id
  30010.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  30011.      * @param  string $expense_claim_id Unique identifier for a ExpenseClaim (required)
  30012.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  30013.      * @throws \InvalidArgumentException
  30014.      * @return \XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims
  30015.      */
  30016.     public function getExpenseClaim($xero_tenant_id$expense_claim_id)
  30017.     {
  30018.         list($response) = $this->getExpenseClaimWithHttpInfo($xero_tenant_id$expense_claim_id);
  30019.         return $response;
  30020.     }
  30021.     /**
  30022.      * Operation getExpenseClaimWithHttpInfo
  30023.      * Retrieves a specific expense claim using a unique expense claim Id
  30024.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  30025.      * @param  string $expense_claim_id Unique identifier for a ExpenseClaim (required)
  30026.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  30027.      * @throws \InvalidArgumentException
  30028.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims, HTTP status code, HTTP response headers (array of strings)
  30029.      */
  30030.     public function getExpenseClaimWithHttpInfo($xero_tenant_id$expense_claim_id)
  30031.     {
  30032.         $request $this->getExpenseClaimRequest($xero_tenant_id$expense_claim_id);
  30033.         try {
  30034.             $options $this->createHttpClientOption();
  30035.             try {
  30036.                 $response $this->client->send($request$options);
  30037.             } catch (RequestException $e) {
  30038.                 throw new ApiException(
  30039.                     "[{$e->getCode()}{$e->getMessage()}",
  30040.                     $e->getCode(),
  30041.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  30042.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  30043.                 );
  30044.             }
  30045.             $statusCode $response->getStatusCode();
  30046.             if ($statusCode 200 || $statusCode 299) {
  30047.                 throw new ApiException(
  30048.                     sprintf(
  30049.                         '[%d] Error connecting to the API (%s)',
  30050.                         $statusCode,
  30051.                         $request->getUri()
  30052.                     ),
  30053.                     $statusCode,
  30054.                     $response->getHeaders(),
  30055.                     $response->getBody()
  30056.                 );
  30057.             }
  30058.             $responseBody $response->getBody();
  30059.             switch($statusCode) {
  30060.                 case 200:
  30061.                     if ('\XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims' === '\SplFileObject') {
  30062.                         $content $responseBody//stream goes to serializer
  30063.                     } else {
  30064.                         $content $responseBody->getContents();
  30065.                     }
  30066.                     return [
  30067.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims', []),
  30068.                         $response->getStatusCode(),
  30069.                         $response->getHeaders()
  30070.                     ];
  30071.             }
  30072.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims';
  30073.             $responseBody $response->getBody();
  30074.             if ($returnType === '\SplFileObject') {
  30075.                 $content $responseBody//stream goes to serializer
  30076.             } else {
  30077.                 $content $responseBody->getContents();
  30078.             }
  30079.             return [
  30080.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  30081.                 $response->getStatusCode(),
  30082.                 $response->getHeaders()
  30083.             ];
  30084.         } catch (ApiException $e) {
  30085.             switch ($e->getCode()) {
  30086.                 case 200:
  30087.                     $data AccountingObjectSerializer::deserialize(
  30088.                         $e->getResponseBody(),
  30089.                         '\XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims',
  30090.                         $e->getResponseHeaders()
  30091.                     );
  30092.                     $e->setResponseObject($data);
  30093.                     break;
  30094.             }
  30095.             throw $e;
  30096.         }
  30097.     }
  30098.     /**
  30099.      * Operation getExpenseClaimAsync
  30100.      * Retrieves a specific expense claim using a unique expense claim Id
  30101.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  30102.      * @param  string $expense_claim_id Unique identifier for a ExpenseClaim (required)
  30103.      * @throws \InvalidArgumentException
  30104.      * @return \GuzzleHttp\Promise\PromiseInterface
  30105.      */
  30106.     public function getExpenseClaimAsync($xero_tenant_id$expense_claim_id)
  30107.     {
  30108.         return $this->getExpenseClaimAsyncWithHttpInfo($xero_tenant_id$expense_claim_id)
  30109.             ->then(
  30110.                 function ($response) {
  30111.                     return $response[0];
  30112.                 }
  30113.             );
  30114.     }
  30115.     /**
  30116.      * Operation getExpenseClaimAsyncWithHttpInfo
  30117.      * Retrieves a specific expense claim using a unique expense claim Id
  30118.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  30119.      * @param  string $expense_claim_id Unique identifier for a ExpenseClaim (required)
  30120.      * @throws \InvalidArgumentException
  30121.      * @return \GuzzleHttp\Promise\PromiseInterface */
  30122.     public function getExpenseClaimAsyncWithHttpInfo($xero_tenant_id$expense_claim_id)
  30123.     {
  30124.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims';
  30125.         $request $this->getExpenseClaimRequest($xero_tenant_id$expense_claim_id);
  30126.         return $this->client
  30127.             ->sendAsync($request$this->createHttpClientOption())
  30128.             ->then(
  30129.                 function ($response) use ($returnType) {
  30130.                     $responseBody $response->getBody();
  30131.                     if ($returnType === '\SplFileObject') {
  30132.                         $content $responseBody//stream goes to serializer
  30133.                     } else {
  30134.                         $content $responseBody->getContents();
  30135.                     }
  30136.                     return [
  30137.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  30138.                         $response->getStatusCode(),
  30139.                         $response->getHeaders()
  30140.                     ];
  30141.                 },
  30142.                 function ($exception) {
  30143.                     $response $exception->getResponse();
  30144.                     $statusCode $response->getStatusCode();
  30145.                     throw new ApiException(
  30146.                         sprintf(
  30147.                             '[%d] Error connecting to the API (%s)',
  30148.                             $statusCode,
  30149.                             $exception->getRequest()->getUri()
  30150.                         ),
  30151.                         $statusCode,
  30152.                         $response->getHeaders(),
  30153.                         $response->getBody()
  30154.                     );
  30155.                 }
  30156.             );
  30157.     }
  30158.     /**
  30159.      * Create request for operation 'getExpenseClaim'
  30160.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  30161.      * @param  string $expense_claim_id Unique identifier for a ExpenseClaim (required)
  30162.      * @throws \InvalidArgumentException
  30163.      * @return \GuzzleHttp\Psr7\Request  */
  30164.     protected function getExpenseClaimRequest($xero_tenant_id$expense_claim_id)
  30165.     {
  30166.         // verify the required parameter 'xero_tenant_id' is set
  30167.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  30168.             throw new \InvalidArgumentException(
  30169.                 'Missing the required parameter $xero_tenant_id when calling getExpenseClaim'
  30170.             );
  30171.         }
  30172.         // verify the required parameter 'expense_claim_id' is set
  30173.         if ($expense_claim_id === null || (is_array($expense_claim_id) && count($expense_claim_id) === 0)) {
  30174.             throw new \InvalidArgumentException(
  30175.                 'Missing the required parameter $expense_claim_id when calling getExpenseClaim'
  30176.             );
  30177.         }
  30178.         $resourcePath '/ExpenseClaims/{ExpenseClaimID}';
  30179.         $formParams = [];
  30180.         $queryParams = [];
  30181.         $headerParams = [];
  30182.         $httpBody '';
  30183.         $multipart false;
  30184.         // header params
  30185.         if ($xero_tenant_id !== null) {
  30186.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  30187.         }
  30188.         // path params
  30189.         if ($expense_claim_id !== null) {
  30190.             $resourcePath str_replace(
  30191.                 '{' 'ExpenseClaimID' '}',
  30192.                 AccountingObjectSerializer::toPathValue($expense_claim_id),
  30193.                 $resourcePath
  30194.             );
  30195.         }
  30196.         // body params
  30197.         $_tempBody null;
  30198.         if ($multipart) {
  30199.             $headers $this->headerSelector->selectHeadersForMultipart(
  30200.                 ['application/json']
  30201.             );
  30202.         } else {
  30203.             $headers $this->headerSelector->selectHeaders(
  30204.                 ['application/json'],
  30205.                 []
  30206.             );
  30207.         }
  30208.         // for model (json/xml)
  30209.         if (isset($_tempBody)) {
  30210.             // $_tempBody is the method argument, if present
  30211.             if ($headers['Content-Type'] === 'application/json') {
  30212.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  30213.             } else {
  30214.                 $httpBody $_tempBody;
  30215.             }
  30216.         } elseif (count($formParams) > 0) {
  30217.             if ($multipart) {
  30218.                 $multipartContents = [
  30219.                     [
  30220.                         'Content-type' => 'multipart/form-data',
  30221.                     ]
  30222.                 ];
  30223.                 
  30224.                 // for HTTP post (form)
  30225.                 $httpBody = new MultipartStream($multipartContents);
  30226.             } elseif ($headers['Content-Type'] === 'application/json') {
  30227.                 $httpBody \GuzzleHttp\json_encode($formParams);
  30228.             } else {
  30229.                 // for HTTP post (form)
  30230.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  30231.             }
  30232.         }
  30233.         // this endpoint requires OAuth (access token)
  30234.         if ($this->config->getAccessToken() !== null) {
  30235.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  30236.         }
  30237.         $defaultHeaders = [];
  30238.         if ($this->config->getUserAgent()) {
  30239.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  30240.         }
  30241.         $headers array_merge(
  30242.             $defaultHeaders,
  30243.             $headerParams,
  30244.             $headers
  30245.         );
  30246.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  30247.         return new Request(
  30248.             'GET',
  30249.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  30250.             $headers,
  30251.             $httpBody
  30252.         );
  30253.     }
  30254.     /**
  30255.      * Operation getExpenseClaimHistory
  30256.      * Retrieves history records of a specific expense claim
  30257.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  30258.      * @param  string $expense_claim_id Unique identifier for a ExpenseClaim (required)
  30259.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  30260.      * @throws \InvalidArgumentException
  30261.      * @return \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords
  30262.      */
  30263.     public function getExpenseClaimHistory($xero_tenant_id$expense_claim_id)
  30264.     {
  30265.         list($response) = $this->getExpenseClaimHistoryWithHttpInfo($xero_tenant_id$expense_claim_id);
  30266.         return $response;
  30267.     }
  30268.     /**
  30269.      * Operation getExpenseClaimHistoryWithHttpInfo
  30270.      * Retrieves history records of a specific expense claim
  30271.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  30272.      * @param  string $expense_claim_id Unique identifier for a ExpenseClaim (required)
  30273.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  30274.      * @throws \InvalidArgumentException
  30275.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords, HTTP status code, HTTP response headers (array of strings)
  30276.      */
  30277.     public function getExpenseClaimHistoryWithHttpInfo($xero_tenant_id$expense_claim_id)
  30278.     {
  30279.         $request $this->getExpenseClaimHistoryRequest($xero_tenant_id$expense_claim_id);
  30280.         try {
  30281.             $options $this->createHttpClientOption();
  30282.             try {
  30283.                 $response $this->client->send($request$options);
  30284.             } catch (RequestException $e) {
  30285.                 throw new ApiException(
  30286.                     "[{$e->getCode()}{$e->getMessage()}",
  30287.                     $e->getCode(),
  30288.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  30289.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  30290.                 );
  30291.             }
  30292.             $statusCode $response->getStatusCode();
  30293.             if ($statusCode 200 || $statusCode 299) {
  30294.                 throw new ApiException(
  30295.                     sprintf(
  30296.                         '[%d] Error connecting to the API (%s)',
  30297.                         $statusCode,
  30298.                         $request->getUri()
  30299.                     ),
  30300.                     $statusCode,
  30301.                     $response->getHeaders(),
  30302.                     $response->getBody()
  30303.                 );
  30304.             }
  30305.             $responseBody $response->getBody();
  30306.             switch($statusCode) {
  30307.                 case 200:
  30308.                     if ('\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords' === '\SplFileObject') {
  30309.                         $content $responseBody//stream goes to serializer
  30310.                     } else {
  30311.                         $content $responseBody->getContents();
  30312.                     }
  30313.                     return [
  30314.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords', []),
  30315.                         $response->getStatusCode(),
  30316.                         $response->getHeaders()
  30317.                     ];
  30318.             }
  30319.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  30320.             $responseBody $response->getBody();
  30321.             if ($returnType === '\SplFileObject') {
  30322.                 $content $responseBody//stream goes to serializer
  30323.             } else {
  30324.                 $content $responseBody->getContents();
  30325.             }
  30326.             return [
  30327.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  30328.                 $response->getStatusCode(),
  30329.                 $response->getHeaders()
  30330.             ];
  30331.         } catch (ApiException $e) {
  30332.             switch ($e->getCode()) {
  30333.                 case 200:
  30334.                     $data AccountingObjectSerializer::deserialize(
  30335.                         $e->getResponseBody(),
  30336.                         '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords',
  30337.                         $e->getResponseHeaders()
  30338.                     );
  30339.                     $e->setResponseObject($data);
  30340.                     break;
  30341.             }
  30342.             throw $e;
  30343.         }
  30344.     }
  30345.     /**
  30346.      * Operation getExpenseClaimHistoryAsync
  30347.      * Retrieves history records of a specific expense claim
  30348.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  30349.      * @param  string $expense_claim_id Unique identifier for a ExpenseClaim (required)
  30350.      * @throws \InvalidArgumentException
  30351.      * @return \GuzzleHttp\Promise\PromiseInterface
  30352.      */
  30353.     public function getExpenseClaimHistoryAsync($xero_tenant_id$expense_claim_id)
  30354.     {
  30355.         return $this->getExpenseClaimHistoryAsyncWithHttpInfo($xero_tenant_id$expense_claim_id)
  30356.             ->then(
  30357.                 function ($response) {
  30358.                     return $response[0];
  30359.                 }
  30360.             );
  30361.     }
  30362.     /**
  30363.      * Operation getExpenseClaimHistoryAsyncWithHttpInfo
  30364.      * Retrieves history records of a specific expense claim
  30365.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  30366.      * @param  string $expense_claim_id Unique identifier for a ExpenseClaim (required)
  30367.      * @throws \InvalidArgumentException
  30368.      * @return \GuzzleHttp\Promise\PromiseInterface */
  30369.     public function getExpenseClaimHistoryAsyncWithHttpInfo($xero_tenant_id$expense_claim_id)
  30370.     {
  30371.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  30372.         $request $this->getExpenseClaimHistoryRequest($xero_tenant_id$expense_claim_id);
  30373.         return $this->client
  30374.             ->sendAsync($request$this->createHttpClientOption())
  30375.             ->then(
  30376.                 function ($response) use ($returnType) {
  30377.                     $responseBody $response->getBody();
  30378.                     if ($returnType === '\SplFileObject') {
  30379.                         $content $responseBody//stream goes to serializer
  30380.                     } else {
  30381.                         $content $responseBody->getContents();
  30382.                     }
  30383.                     return [
  30384.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  30385.                         $response->getStatusCode(),
  30386.                         $response->getHeaders()
  30387.                     ];
  30388.                 },
  30389.                 function ($exception) {
  30390.                     $response $exception->getResponse();
  30391.                     $statusCode $response->getStatusCode();
  30392.                     throw new ApiException(
  30393.                         sprintf(
  30394.                             '[%d] Error connecting to the API (%s)',
  30395.                             $statusCode,
  30396.                             $exception->getRequest()->getUri()
  30397.                         ),
  30398.                         $statusCode,
  30399.                         $response->getHeaders(),
  30400.                         $response->getBody()
  30401.                     );
  30402.                 }
  30403.             );
  30404.     }
  30405.     /**
  30406.      * Create request for operation 'getExpenseClaimHistory'
  30407.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  30408.      * @param  string $expense_claim_id Unique identifier for a ExpenseClaim (required)
  30409.      * @throws \InvalidArgumentException
  30410.      * @return \GuzzleHttp\Psr7\Request  */
  30411.     protected function getExpenseClaimHistoryRequest($xero_tenant_id$expense_claim_id)
  30412.     {
  30413.         // verify the required parameter 'xero_tenant_id' is set
  30414.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  30415.             throw new \InvalidArgumentException(
  30416.                 'Missing the required parameter $xero_tenant_id when calling getExpenseClaimHistory'
  30417.             );
  30418.         }
  30419.         // verify the required parameter 'expense_claim_id' is set
  30420.         if ($expense_claim_id === null || (is_array($expense_claim_id) && count($expense_claim_id) === 0)) {
  30421.             throw new \InvalidArgumentException(
  30422.                 'Missing the required parameter $expense_claim_id when calling getExpenseClaimHistory'
  30423.             );
  30424.         }
  30425.         $resourcePath '/ExpenseClaims/{ExpenseClaimID}/History';
  30426.         $formParams = [];
  30427.         $queryParams = [];
  30428.         $headerParams = [];
  30429.         $httpBody '';
  30430.         $multipart false;
  30431.         // header params
  30432.         if ($xero_tenant_id !== null) {
  30433.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  30434.         }
  30435.         // path params
  30436.         if ($expense_claim_id !== null) {
  30437.             $resourcePath str_replace(
  30438.                 '{' 'ExpenseClaimID' '}',
  30439.                 AccountingObjectSerializer::toPathValue($expense_claim_id),
  30440.                 $resourcePath
  30441.             );
  30442.         }
  30443.         // body params
  30444.         $_tempBody null;
  30445.         if ($multipart) {
  30446.             $headers $this->headerSelector->selectHeadersForMultipart(
  30447.                 ['application/json']
  30448.             );
  30449.         } else {
  30450.             $headers $this->headerSelector->selectHeaders(
  30451.                 ['application/json'],
  30452.                 []
  30453.             );
  30454.         }
  30455.         // for model (json/xml)
  30456.         if (isset($_tempBody)) {
  30457.             // $_tempBody is the method argument, if present
  30458.             if ($headers['Content-Type'] === 'application/json') {
  30459.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  30460.             } else {
  30461.                 $httpBody $_tempBody;
  30462.             }
  30463.         } elseif (count($formParams) > 0) {
  30464.             if ($multipart) {
  30465.                 $multipartContents = [
  30466.                     [
  30467.                         'Content-type' => 'multipart/form-data',
  30468.                     ]
  30469.                 ];
  30470.                 
  30471.                 // for HTTP post (form)
  30472.                 $httpBody = new MultipartStream($multipartContents);
  30473.             } elseif ($headers['Content-Type'] === 'application/json') {
  30474.                 $httpBody \GuzzleHttp\json_encode($formParams);
  30475.             } else {
  30476.                 // for HTTP post (form)
  30477.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  30478.             }
  30479.         }
  30480.         // this endpoint requires OAuth (access token)
  30481.         if ($this->config->getAccessToken() !== null) {
  30482.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  30483.         }
  30484.         $defaultHeaders = [];
  30485.         if ($this->config->getUserAgent()) {
  30486.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  30487.         }
  30488.         $headers array_merge(
  30489.             $defaultHeaders,
  30490.             $headerParams,
  30491.             $headers
  30492.         );
  30493.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  30494.         return new Request(
  30495.             'GET',
  30496.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  30497.             $headers,
  30498.             $httpBody
  30499.         );
  30500.     }
  30501.     /**
  30502.      * Operation getExpenseClaims
  30503.      * Retrieves expense claims
  30504.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  30505.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  30506.      * @param  string $where Filter by an any element (optional)
  30507.      * @param  string $order Order by an any element (optional)
  30508.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  30509.      * @throws \InvalidArgumentException
  30510.      * @return \XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims
  30511.      */
  30512.     public function getExpenseClaims($xero_tenant_id$if_modified_since null$where null$order null)
  30513.     {
  30514.         list($response) = $this->getExpenseClaimsWithHttpInfo($xero_tenant_id$if_modified_since$where$order);
  30515.         return $response;
  30516.     }
  30517.     /**
  30518.      * Operation getExpenseClaimsWithHttpInfo
  30519.      * Retrieves expense claims
  30520.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  30521.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  30522.      * @param  string $where Filter by an any element (optional)
  30523.      * @param  string $order Order by an any element (optional)
  30524.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  30525.      * @throws \InvalidArgumentException
  30526.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims, HTTP status code, HTTP response headers (array of strings)
  30527.      */
  30528.     public function getExpenseClaimsWithHttpInfo($xero_tenant_id$if_modified_since null$where null$order null)
  30529.     {
  30530.         $request $this->getExpenseClaimsRequest($xero_tenant_id$if_modified_since$where$order);
  30531.         try {
  30532.             $options $this->createHttpClientOption();
  30533.             try {
  30534.                 $response $this->client->send($request$options);
  30535.             } catch (RequestException $e) {
  30536.                 throw new ApiException(
  30537.                     "[{$e->getCode()}{$e->getMessage()}",
  30538.                     $e->getCode(),
  30539.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  30540.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  30541.                 );
  30542.             }
  30543.             $statusCode $response->getStatusCode();
  30544.             if ($statusCode 200 || $statusCode 299) {
  30545.                 throw new ApiException(
  30546.                     sprintf(
  30547.                         '[%d] Error connecting to the API (%s)',
  30548.                         $statusCode,
  30549.                         $request->getUri()
  30550.                     ),
  30551.                     $statusCode,
  30552.                     $response->getHeaders(),
  30553.                     $response->getBody()
  30554.                 );
  30555.             }
  30556.             $responseBody $response->getBody();
  30557.             switch($statusCode) {
  30558.                 case 200:
  30559.                     if ('\XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims' === '\SplFileObject') {
  30560.                         $content $responseBody//stream goes to serializer
  30561.                     } else {
  30562.                         $content $responseBody->getContents();
  30563.                     }
  30564.                     return [
  30565.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims', []),
  30566.                         $response->getStatusCode(),
  30567.                         $response->getHeaders()
  30568.                     ];
  30569.             }
  30570.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims';
  30571.             $responseBody $response->getBody();
  30572.             if ($returnType === '\SplFileObject') {
  30573.                 $content $responseBody//stream goes to serializer
  30574.             } else {
  30575.                 $content $responseBody->getContents();
  30576.             }
  30577.             return [
  30578.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  30579.                 $response->getStatusCode(),
  30580.                 $response->getHeaders()
  30581.             ];
  30582.         } catch (ApiException $e) {
  30583.             switch ($e->getCode()) {
  30584.                 case 200:
  30585.                     $data AccountingObjectSerializer::deserialize(
  30586.                         $e->getResponseBody(),
  30587.                         '\XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims',
  30588.                         $e->getResponseHeaders()
  30589.                     );
  30590.                     $e->setResponseObject($data);
  30591.                     break;
  30592.             }
  30593.             throw $e;
  30594.         }
  30595.     }
  30596.     /**
  30597.      * Operation getExpenseClaimsAsync
  30598.      * Retrieves expense claims
  30599.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  30600.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  30601.      * @param  string $where Filter by an any element (optional)
  30602.      * @param  string $order Order by an any element (optional)
  30603.      * @throws \InvalidArgumentException
  30604.      * @return \GuzzleHttp\Promise\PromiseInterface
  30605.      */
  30606.     public function getExpenseClaimsAsync($xero_tenant_id$if_modified_since null$where null$order null)
  30607.     {
  30608.         return $this->getExpenseClaimsAsyncWithHttpInfo($xero_tenant_id$if_modified_since$where$order)
  30609.             ->then(
  30610.                 function ($response) {
  30611.                     return $response[0];
  30612.                 }
  30613.             );
  30614.     }
  30615.     /**
  30616.      * Operation getExpenseClaimsAsyncWithHttpInfo
  30617.      * Retrieves expense claims
  30618.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  30619.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  30620.      * @param  string $where Filter by an any element (optional)
  30621.      * @param  string $order Order by an any element (optional)
  30622.      * @throws \InvalidArgumentException
  30623.      * @return \GuzzleHttp\Promise\PromiseInterface */
  30624.     public function getExpenseClaimsAsyncWithHttpInfo($xero_tenant_id$if_modified_since null$where null$order null)
  30625.     {
  30626.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims';
  30627.         $request $this->getExpenseClaimsRequest($xero_tenant_id$if_modified_since$where$order);
  30628.         return $this->client
  30629.             ->sendAsync($request$this->createHttpClientOption())
  30630.             ->then(
  30631.                 function ($response) use ($returnType) {
  30632.                     $responseBody $response->getBody();
  30633.                     if ($returnType === '\SplFileObject') {
  30634.                         $content $responseBody//stream goes to serializer
  30635.                     } else {
  30636.                         $content $responseBody->getContents();
  30637.                     }
  30638.                     return [
  30639.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  30640.                         $response->getStatusCode(),
  30641.                         $response->getHeaders()
  30642.                     ];
  30643.                 },
  30644.                 function ($exception) {
  30645.                     $response $exception->getResponse();
  30646.                     $statusCode $response->getStatusCode();
  30647.                     throw new ApiException(
  30648.                         sprintf(
  30649.                             '[%d] Error connecting to the API (%s)',
  30650.                             $statusCode,
  30651.                             $exception->getRequest()->getUri()
  30652.                         ),
  30653.                         $statusCode,
  30654.                         $response->getHeaders(),
  30655.                         $response->getBody()
  30656.                     );
  30657.                 }
  30658.             );
  30659.     }
  30660.     /**
  30661.      * Create request for operation 'getExpenseClaims'
  30662.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  30663.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  30664.      * @param  string $where Filter by an any element (optional)
  30665.      * @param  string $order Order by an any element (optional)
  30666.      * @throws \InvalidArgumentException
  30667.      * @return \GuzzleHttp\Psr7\Request  */
  30668.     protected function getExpenseClaimsRequest($xero_tenant_id$if_modified_since null$where null$order null)
  30669.     {
  30670.         // verify the required parameter 'xero_tenant_id' is set
  30671.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  30672.             throw new \InvalidArgumentException(
  30673.                 'Missing the required parameter $xero_tenant_id when calling getExpenseClaims'
  30674.             );
  30675.         }
  30676.         $resourcePath '/ExpenseClaims';
  30677.         $formParams = [];
  30678.         $queryParams = [];
  30679.         $headerParams = [];
  30680.         $httpBody '';
  30681.         $multipart false;
  30682.         // query params
  30683.         if ($where !== null) {
  30684.             $queryParams['where'] = AccountingObjectSerializer::toQueryValue($where);
  30685.         }
  30686.         // query params
  30687.         if ($order !== null) {
  30688.             $queryParams['order'] = AccountingObjectSerializer::toQueryValue($order);
  30689.         }
  30690.         // header params
  30691.         if ($xero_tenant_id !== null) {
  30692.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  30693.         }
  30694.         // header params
  30695.         if ($if_modified_since !== null) {
  30696.             $headerParams['If-Modified-Since'] = AccountingObjectSerializer::toHeaderValue($if_modified_since);
  30697.         }
  30698.         // body params
  30699.         $_tempBody null;
  30700.         if ($multipart) {
  30701.             $headers $this->headerSelector->selectHeadersForMultipart(
  30702.                 ['application/json']
  30703.             );
  30704.         } else {
  30705.             $headers $this->headerSelector->selectHeaders(
  30706.                 ['application/json'],
  30707.                 []
  30708.             );
  30709.         }
  30710.         // for model (json/xml)
  30711.         if (isset($_tempBody)) {
  30712.             // $_tempBody is the method argument, if present
  30713.             if ($headers['Content-Type'] === 'application/json') {
  30714.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  30715.             } else {
  30716.                 $httpBody $_tempBody;
  30717.             }
  30718.         } elseif (count($formParams) > 0) {
  30719.             if ($multipart) {
  30720.                 $multipartContents = [
  30721.                     [
  30722.                         'Content-type' => 'multipart/form-data',
  30723.                     ]
  30724.                 ];
  30725.                 
  30726.                 // for HTTP post (form)
  30727.                 $httpBody = new MultipartStream($multipartContents);
  30728.             } elseif ($headers['Content-Type'] === 'application/json') {
  30729.                 $httpBody \GuzzleHttp\json_encode($formParams);
  30730.             } else {
  30731.                 // for HTTP post (form)
  30732.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  30733.             }
  30734.         }
  30735.         // this endpoint requires OAuth (access token)
  30736.         if ($this->config->getAccessToken() !== null) {
  30737.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  30738.         }
  30739.         $defaultHeaders = [];
  30740.         if ($this->config->getUserAgent()) {
  30741.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  30742.         }
  30743.         $headers array_merge(
  30744.             $defaultHeaders,
  30745.             $headerParams,
  30746.             $headers
  30747.         );
  30748.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  30749.         return new Request(
  30750.             'GET',
  30751.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  30752.             $headers,
  30753.             $httpBody
  30754.         );
  30755.     }
  30756.     /**
  30757.      * Operation getInvoice
  30758.      * Retrieves a specific sales invoice or purchase bill using a unique invoice Id
  30759.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  30760.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  30761.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  30762.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  30763.      * @throws \InvalidArgumentException
  30764.      * @return \XeroAPI\XeroPHP\Models\Accounting\Invoices
  30765.      */
  30766.     public function getInvoice($xero_tenant_id$invoice_id$unitdp null)
  30767.     {
  30768.         list($response) = $this->getInvoiceWithHttpInfo($xero_tenant_id$invoice_id$unitdp);
  30769.         return $response;
  30770.     }
  30771.     /**
  30772.      * Operation getInvoiceWithHttpInfo
  30773.      * Retrieves a specific sales invoice or purchase bill using a unique invoice Id
  30774.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  30775.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  30776.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  30777.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  30778.      * @throws \InvalidArgumentException
  30779.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Invoices, HTTP status code, HTTP response headers (array of strings)
  30780.      */
  30781.     public function getInvoiceWithHttpInfo($xero_tenant_id$invoice_id$unitdp null)
  30782.     {
  30783.         $request $this->getInvoiceRequest($xero_tenant_id$invoice_id$unitdp);
  30784.         try {
  30785.             $options $this->createHttpClientOption();
  30786.             try {
  30787.                 $response $this->client->send($request$options);
  30788.             } catch (RequestException $e) {
  30789.                 throw new ApiException(
  30790.                     "[{$e->getCode()}{$e->getMessage()}",
  30791.                     $e->getCode(),
  30792.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  30793.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  30794.                 );
  30795.             }
  30796.             $statusCode $response->getStatusCode();
  30797.             if ($statusCode 200 || $statusCode 299) {
  30798.                 throw new ApiException(
  30799.                     sprintf(
  30800.                         '[%d] Error connecting to the API (%s)',
  30801.                         $statusCode,
  30802.                         $request->getUri()
  30803.                     ),
  30804.                     $statusCode,
  30805.                     $response->getHeaders(),
  30806.                     $response->getBody()
  30807.                 );
  30808.             }
  30809.             $responseBody $response->getBody();
  30810.             switch($statusCode) {
  30811.                 case 200:
  30812.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Invoices' === '\SplFileObject') {
  30813.                         $content $responseBody//stream goes to serializer
  30814.                     } else {
  30815.                         $content $responseBody->getContents();
  30816.                     }
  30817.                     return [
  30818.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Invoices', []),
  30819.                         $response->getStatusCode(),
  30820.                         $response->getHeaders()
  30821.                     ];
  30822.             }
  30823.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Invoices';
  30824.             $responseBody $response->getBody();
  30825.             if ($returnType === '\SplFileObject') {
  30826.                 $content $responseBody//stream goes to serializer
  30827.             } else {
  30828.                 $content $responseBody->getContents();
  30829.             }
  30830.             return [
  30831.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  30832.                 $response->getStatusCode(),
  30833.                 $response->getHeaders()
  30834.             ];
  30835.         } catch (ApiException $e) {
  30836.             switch ($e->getCode()) {
  30837.                 case 200:
  30838.                     $data AccountingObjectSerializer::deserialize(
  30839.                         $e->getResponseBody(),
  30840.                         '\XeroAPI\XeroPHP\Models\Accounting\Invoices',
  30841.                         $e->getResponseHeaders()
  30842.                     );
  30843.                     $e->setResponseObject($data);
  30844.                     break;
  30845.             }
  30846.             throw $e;
  30847.         }
  30848.     }
  30849.     /**
  30850.      * Operation getInvoiceAsync
  30851.      * Retrieves a specific sales invoice or purchase bill using a unique invoice Id
  30852.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  30853.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  30854.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  30855.      * @throws \InvalidArgumentException
  30856.      * @return \GuzzleHttp\Promise\PromiseInterface
  30857.      */
  30858.     public function getInvoiceAsync($xero_tenant_id$invoice_id$unitdp null)
  30859.     {
  30860.         return $this->getInvoiceAsyncWithHttpInfo($xero_tenant_id$invoice_id$unitdp)
  30861.             ->then(
  30862.                 function ($response) {
  30863.                     return $response[0];
  30864.                 }
  30865.             );
  30866.     }
  30867.     /**
  30868.      * Operation getInvoiceAsyncWithHttpInfo
  30869.      * Retrieves a specific sales invoice or purchase bill using a unique invoice Id
  30870.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  30871.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  30872.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  30873.      * @throws \InvalidArgumentException
  30874.      * @return \GuzzleHttp\Promise\PromiseInterface */
  30875.     public function getInvoiceAsyncWithHttpInfo($xero_tenant_id$invoice_id$unitdp null)
  30876.     {
  30877.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Invoices';
  30878.         $request $this->getInvoiceRequest($xero_tenant_id$invoice_id$unitdp);
  30879.         return $this->client
  30880.             ->sendAsync($request$this->createHttpClientOption())
  30881.             ->then(
  30882.                 function ($response) use ($returnType) {
  30883.                     $responseBody $response->getBody();
  30884.                     if ($returnType === '\SplFileObject') {
  30885.                         $content $responseBody//stream goes to serializer
  30886.                     } else {
  30887.                         $content $responseBody->getContents();
  30888.                     }
  30889.                     return [
  30890.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  30891.                         $response->getStatusCode(),
  30892.                         $response->getHeaders()
  30893.                     ];
  30894.                 },
  30895.                 function ($exception) {
  30896.                     $response $exception->getResponse();
  30897.                     $statusCode $response->getStatusCode();
  30898.                     throw new ApiException(
  30899.                         sprintf(
  30900.                             '[%d] Error connecting to the API (%s)',
  30901.                             $statusCode,
  30902.                             $exception->getRequest()->getUri()
  30903.                         ),
  30904.                         $statusCode,
  30905.                         $response->getHeaders(),
  30906.                         $response->getBody()
  30907.                     );
  30908.                 }
  30909.             );
  30910.     }
  30911.     /**
  30912.      * Create request for operation 'getInvoice'
  30913.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  30914.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  30915.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  30916.      * @throws \InvalidArgumentException
  30917.      * @return \GuzzleHttp\Psr7\Request  */
  30918.     protected function getInvoiceRequest($xero_tenant_id$invoice_id$unitdp null)
  30919.     {
  30920.         // verify the required parameter 'xero_tenant_id' is set
  30921.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  30922.             throw new \InvalidArgumentException(
  30923.                 'Missing the required parameter $xero_tenant_id when calling getInvoice'
  30924.             );
  30925.         }
  30926.         // verify the required parameter 'invoice_id' is set
  30927.         if ($invoice_id === null || (is_array($invoice_id) && count($invoice_id) === 0)) {
  30928.             throw new \InvalidArgumentException(
  30929.                 'Missing the required parameter $invoice_id when calling getInvoice'
  30930.             );
  30931.         }
  30932.         $resourcePath '/Invoices/{InvoiceID}';
  30933.         $formParams = [];
  30934.         $queryParams = [];
  30935.         $headerParams = [];
  30936.         $httpBody '';
  30937.         $multipart false;
  30938.         // query params
  30939.         if ($unitdp !== null) {
  30940.             $queryParams['unitdp'] = AccountingObjectSerializer::toQueryValue($unitdp);
  30941.         }
  30942.         // header params
  30943.         if ($xero_tenant_id !== null) {
  30944.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  30945.         }
  30946.         // path params
  30947.         if ($invoice_id !== null) {
  30948.             $resourcePath str_replace(
  30949.                 '{' 'InvoiceID' '}',
  30950.                 AccountingObjectSerializer::toPathValue($invoice_id),
  30951.                 $resourcePath
  30952.             );
  30953.         }
  30954.         // body params
  30955.         $_tempBody null;
  30956.         if ($multipart) {
  30957.             $headers $this->headerSelector->selectHeadersForMultipart(
  30958.                 ['application/json']
  30959.             );
  30960.         } else {
  30961.             $headers $this->headerSelector->selectHeaders(
  30962.                 ['application/json'],
  30963.                 []
  30964.             );
  30965.         }
  30966.         // for model (json/xml)
  30967.         if (isset($_tempBody)) {
  30968.             // $_tempBody is the method argument, if present
  30969.             if ($headers['Content-Type'] === 'application/json') {
  30970.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  30971.             } else {
  30972.                 $httpBody $_tempBody;
  30973.             }
  30974.         } elseif (count($formParams) > 0) {
  30975.             if ($multipart) {
  30976.                 $multipartContents = [
  30977.                     [
  30978.                         'Content-type' => 'multipart/form-data',
  30979.                     ]
  30980.                 ];
  30981.                 
  30982.                 // for HTTP post (form)
  30983.                 $httpBody = new MultipartStream($multipartContents);
  30984.             } elseif ($headers['Content-Type'] === 'application/json') {
  30985.                 $httpBody \GuzzleHttp\json_encode($formParams);
  30986.             } else {
  30987.                 // for HTTP post (form)
  30988.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  30989.             }
  30990.         }
  30991.         // this endpoint requires OAuth (access token)
  30992.         if ($this->config->getAccessToken() !== null) {
  30993.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  30994.         }
  30995.         $defaultHeaders = [];
  30996.         if ($this->config->getUserAgent()) {
  30997.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  30998.         }
  30999.         $headers array_merge(
  31000.             $defaultHeaders,
  31001.             $headerParams,
  31002.             $headers
  31003.         );
  31004.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  31005.         return new Request(
  31006.             'GET',
  31007.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  31008.             $headers,
  31009.             $httpBody
  31010.         );
  31011.     }
  31012.     /**
  31013.      * Operation getInvoiceAsPdf
  31014.      * Retrieves invoices or purchase bills as PDF files
  31015.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  31016.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  31017.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  31018.      * @throws \InvalidArgumentException
  31019.      * @return \SplFileObject
  31020.      */
  31021.     public function getInvoiceAsPdf($xero_tenant_id$invoice_id)
  31022.     {
  31023.         list($response) = $this->getInvoiceAsPdfWithHttpInfo($xero_tenant_id$invoice_id);
  31024.         return $response;
  31025.     }
  31026.     /**
  31027.      * Operation getInvoiceAsPdfWithHttpInfo
  31028.      * Retrieves invoices or purchase bills as PDF files
  31029.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  31030.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  31031.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  31032.      * @throws \InvalidArgumentException
  31033.      * @return array of \SplFileObject, HTTP status code, HTTP response headers (array of strings)
  31034.      */
  31035.     public function getInvoiceAsPdfWithHttpInfo($xero_tenant_id$invoice_id)
  31036.     {
  31037.         $request $this->getInvoiceAsPdfRequest($xero_tenant_id$invoice_id);
  31038.         try {
  31039.             $options $this->createHttpClientOption();
  31040.             try {
  31041.                 $response $this->client->send($request$options);
  31042.             } catch (RequestException $e) {
  31043.                 throw new ApiException(
  31044.                     "[{$e->getCode()}{$e->getMessage()}",
  31045.                     $e->getCode(),
  31046.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  31047.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  31048.                 );
  31049.             }
  31050.             $statusCode $response->getStatusCode();
  31051.             if ($statusCode 200 || $statusCode 299) {
  31052.                 throw new ApiException(
  31053.                     sprintf(
  31054.                         '[%d] Error connecting to the API (%s)',
  31055.                         $statusCode,
  31056.                         $request->getUri()
  31057.                     ),
  31058.                     $statusCode,
  31059.                     $response->getHeaders(),
  31060.                     $response->getBody()
  31061.                 );
  31062.             }
  31063.             $responseBody $response->getBody();
  31064.             switch($statusCode) {
  31065.                 case 200:
  31066.                     if ('\SplFileObject' === '\SplFileObject') {
  31067.                         $content $responseBody//stream goes to serializer
  31068.                     } else {
  31069.                         $content $responseBody->getContents();
  31070.                     }
  31071.                     return [
  31072.                         AccountingObjectSerializer::deserialize($content'\SplFileObject', []),
  31073.                         $response->getStatusCode(),
  31074.                         $response->getHeaders()
  31075.                     ];
  31076.             }
  31077.             $returnType '\SplFileObject';
  31078.             $responseBody $response->getBody();
  31079.             if ($returnType === '\SplFileObject') {
  31080.                 $content $responseBody//stream goes to serializer
  31081.             } else {
  31082.                 $content $responseBody->getContents();
  31083.             }
  31084.             return [
  31085.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  31086.                 $response->getStatusCode(),
  31087.                 $response->getHeaders()
  31088.             ];
  31089.         } catch (ApiException $e) {
  31090.             switch ($e->getCode()) {
  31091.                 case 200:
  31092.                     $data AccountingObjectSerializer::deserialize(
  31093.                         $e->getResponseBody(),
  31094.                         '\SplFileObject',
  31095.                         $e->getResponseHeaders()
  31096.                     );
  31097.                     $e->setResponseObject($data);
  31098.                     break;
  31099.             }
  31100.             throw $e;
  31101.         }
  31102.     }
  31103.     /**
  31104.      * Operation getInvoiceAsPdfAsync
  31105.      * Retrieves invoices or purchase bills as PDF files
  31106.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  31107.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  31108.      * @throws \InvalidArgumentException
  31109.      * @return \GuzzleHttp\Promise\PromiseInterface
  31110.      */
  31111.     public function getInvoiceAsPdfAsync($xero_tenant_id$invoice_id)
  31112.     {
  31113.         return $this->getInvoiceAsPdfAsyncWithHttpInfo($xero_tenant_id$invoice_id)
  31114.             ->then(
  31115.                 function ($response) {
  31116.                     return $response[0];
  31117.                 }
  31118.             );
  31119.     }
  31120.     /**
  31121.      * Operation getInvoiceAsPdfAsyncWithHttpInfo
  31122.      * Retrieves invoices or purchase bills as PDF files
  31123.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  31124.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  31125.      * @throws \InvalidArgumentException
  31126.      * @return \GuzzleHttp\Promise\PromiseInterface */
  31127.     public function getInvoiceAsPdfAsyncWithHttpInfo($xero_tenant_id$invoice_id)
  31128.     {
  31129.         $returnType '\SplFileObject';
  31130.         $request $this->getInvoiceAsPdfRequest($xero_tenant_id$invoice_id);
  31131.         return $this->client
  31132.             ->sendAsync($request$this->createHttpClientOption())
  31133.             ->then(
  31134.                 function ($response) use ($returnType) {
  31135.                     $responseBody $response->getBody();
  31136.                     if ($returnType === '\SplFileObject') {
  31137.                         $content $responseBody//stream goes to serializer
  31138.                     } else {
  31139.                         $content $responseBody->getContents();
  31140.                     }
  31141.                     return [
  31142.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  31143.                         $response->getStatusCode(),
  31144.                         $response->getHeaders()
  31145.                     ];
  31146.                 },
  31147.                 function ($exception) {
  31148.                     $response $exception->getResponse();
  31149.                     $statusCode $response->getStatusCode();
  31150.                     throw new ApiException(
  31151.                         sprintf(
  31152.                             '[%d] Error connecting to the API (%s)',
  31153.                             $statusCode,
  31154.                             $exception->getRequest()->getUri()
  31155.                         ),
  31156.                         $statusCode,
  31157.                         $response->getHeaders(),
  31158.                         $response->getBody()
  31159.                     );
  31160.                 }
  31161.             );
  31162.     }
  31163.     /**
  31164.      * Create request for operation 'getInvoiceAsPdf'
  31165.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  31166.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  31167.      * @throws \InvalidArgumentException
  31168.      * @return \GuzzleHttp\Psr7\Request  */
  31169.     protected function getInvoiceAsPdfRequest($xero_tenant_id$invoice_id)
  31170.     {
  31171.         // verify the required parameter 'xero_tenant_id' is set
  31172.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  31173.             throw new \InvalidArgumentException(
  31174.                 'Missing the required parameter $xero_tenant_id when calling getInvoiceAsPdf'
  31175.             );
  31176.         }
  31177.         // verify the required parameter 'invoice_id' is set
  31178.         if ($invoice_id === null || (is_array($invoice_id) && count($invoice_id) === 0)) {
  31179.             throw new \InvalidArgumentException(
  31180.                 'Missing the required parameter $invoice_id when calling getInvoiceAsPdf'
  31181.             );
  31182.         }
  31183.         $resourcePath '/Invoices/{InvoiceID}';
  31184.         $formParams = [];
  31185.         $queryParams = [];
  31186.         $headerParams = [];
  31187.         $httpBody '';
  31188.         $multipart false;
  31189.         // header params
  31190.         if ($xero_tenant_id !== null) {
  31191.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  31192.         }
  31193.         // path params
  31194.         if ($invoice_id !== null) {
  31195.             $resourcePath str_replace(
  31196.                 '{' 'InvoiceID' '}',
  31197.                 AccountingObjectSerializer::toPathValue($invoice_id),
  31198.                 $resourcePath
  31199.             );
  31200.         }
  31201.         // body params
  31202.         $_tempBody null;
  31203.         if ($multipart) {
  31204.             $headers $this->headerSelector->selectHeadersForMultipart(
  31205.                 ['application/pdf']
  31206.             );
  31207.         } else {
  31208.             $headers $this->headerSelector->selectHeaders(
  31209.                 ['application/pdf'],
  31210.                 []
  31211.             );
  31212.         }
  31213.         // for model (json/xml)
  31214.         if (isset($_tempBody)) {
  31215.             // $_tempBody is the method argument, if present
  31216.             if ($headers['Content-Type'] === 'application/json') {
  31217.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  31218.             } else {
  31219.                 $httpBody $_tempBody;
  31220.             }
  31221.         } elseif (count($formParams) > 0) {
  31222.             if ($multipart) {
  31223.                 $multipartContents = [
  31224.                     [
  31225.                         'Content-type' => 'multipart/form-data',
  31226.                     ]
  31227.                 ];
  31228.                 
  31229.                 // for HTTP post (form)
  31230.                 $httpBody = new MultipartStream($multipartContents);
  31231.             } elseif ($headers['Content-Type'] === 'application/json') {
  31232.                 $httpBody \GuzzleHttp\json_encode($formParams);
  31233.             } else {
  31234.                 // for HTTP post (form)
  31235.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  31236.             }
  31237.         }
  31238.         // this endpoint requires OAuth (access token)
  31239.         if ($this->config->getAccessToken() !== null) {
  31240.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  31241.         }
  31242.         $defaultHeaders = [];
  31243.         if ($this->config->getUserAgent()) {
  31244.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  31245.         }
  31246.         $headers array_merge(
  31247.             $defaultHeaders,
  31248.             $headerParams,
  31249.             $headers
  31250.         );
  31251.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  31252.         return new Request(
  31253.             'GET',
  31254.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  31255.             $headers,
  31256.             $httpBody
  31257.         );
  31258.     }
  31259.     /**
  31260.      * Operation getInvoiceAttachmentByFileName
  31261.      * Retrieves an attachment from a specific invoice or purchase bill by filename
  31262.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  31263.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  31264.      * @param  string $file_name Name of the attachment (required)
  31265.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  31266.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  31267.      * @throws \InvalidArgumentException
  31268.      * @return \SplFileObject
  31269.      */
  31270.     public function getInvoiceAttachmentByFileName($xero_tenant_id$invoice_id$file_name$content_type)
  31271.     {
  31272.         list($response) = $this->getInvoiceAttachmentByFileNameWithHttpInfo($xero_tenant_id$invoice_id$file_name$content_type);
  31273.         return $response;
  31274.     }
  31275.     /**
  31276.      * Operation getInvoiceAttachmentByFileNameWithHttpInfo
  31277.      * Retrieves an attachment from a specific invoice or purchase bill by filename
  31278.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  31279.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  31280.      * @param  string $file_name Name of the attachment (required)
  31281.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  31282.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  31283.      * @throws \InvalidArgumentException
  31284.      * @return array of \SplFileObject, HTTP status code, HTTP response headers (array of strings)
  31285.      */
  31286.     public function getInvoiceAttachmentByFileNameWithHttpInfo($xero_tenant_id$invoice_id$file_name$content_type)
  31287.     {
  31288.         $request $this->getInvoiceAttachmentByFileNameRequest($xero_tenant_id$invoice_id$file_name$content_type);
  31289.         try {
  31290.             $options $this->createHttpClientOption();
  31291.             try {
  31292.                 $response $this->client->send($request$options);
  31293.             } catch (RequestException $e) {
  31294.                 throw new ApiException(
  31295.                     "[{$e->getCode()}{$e->getMessage()}",
  31296.                     $e->getCode(),
  31297.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  31298.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  31299.                 );
  31300.             }
  31301.             $statusCode $response->getStatusCode();
  31302.             if ($statusCode 200 || $statusCode 299) {
  31303.                 throw new ApiException(
  31304.                     sprintf(
  31305.                         '[%d] Error connecting to the API (%s)',
  31306.                         $statusCode,
  31307.                         $request->getUri()
  31308.                     ),
  31309.                     $statusCode,
  31310.                     $response->getHeaders(),
  31311.                     $response->getBody()
  31312.                 );
  31313.             }
  31314.             $responseBody $response->getBody();
  31315.             switch($statusCode) {
  31316.                 case 200:
  31317.                     if ('\SplFileObject' === '\SplFileObject') {
  31318.                         $content $responseBody//stream goes to serializer
  31319.                     } else {
  31320.                         $content $responseBody->getContents();
  31321.                     }
  31322.                     return [
  31323.                         AccountingObjectSerializer::deserialize($content'\SplFileObject', []),
  31324.                         $response->getStatusCode(),
  31325.                         $response->getHeaders()
  31326.                     ];
  31327.             }
  31328.             $returnType '\SplFileObject';
  31329.             $responseBody $response->getBody();
  31330.             if ($returnType === '\SplFileObject') {
  31331.                 $content $responseBody//stream goes to serializer
  31332.             } else {
  31333.                 $content $responseBody->getContents();
  31334.             }
  31335.             return [
  31336.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  31337.                 $response->getStatusCode(),
  31338.                 $response->getHeaders()
  31339.             ];
  31340.         } catch (ApiException $e) {
  31341.             switch ($e->getCode()) {
  31342.                 case 200:
  31343.                     $data AccountingObjectSerializer::deserialize(
  31344.                         $e->getResponseBody(),
  31345.                         '\SplFileObject',
  31346.                         $e->getResponseHeaders()
  31347.                     );
  31348.                     $e->setResponseObject($data);
  31349.                     break;
  31350.             }
  31351.             throw $e;
  31352.         }
  31353.     }
  31354.     /**
  31355.      * Operation getInvoiceAttachmentByFileNameAsync
  31356.      * Retrieves an attachment from a specific invoice or purchase bill by filename
  31357.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  31358.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  31359.      * @param  string $file_name Name of the attachment (required)
  31360.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  31361.      * @throws \InvalidArgumentException
  31362.      * @return \GuzzleHttp\Promise\PromiseInterface
  31363.      */
  31364.     public function getInvoiceAttachmentByFileNameAsync($xero_tenant_id$invoice_id$file_name$content_type)
  31365.     {
  31366.         return $this->getInvoiceAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$invoice_id$file_name$content_type)
  31367.             ->then(
  31368.                 function ($response) {
  31369.                     return $response[0];
  31370.                 }
  31371.             );
  31372.     }
  31373.     /**
  31374.      * Operation getInvoiceAttachmentByFileNameAsyncWithHttpInfo
  31375.      * Retrieves an attachment from a specific invoice or purchase bill by filename
  31376.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  31377.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  31378.      * @param  string $file_name Name of the attachment (required)
  31379.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  31380.      * @throws \InvalidArgumentException
  31381.      * @return \GuzzleHttp\Promise\PromiseInterface */
  31382.     public function getInvoiceAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$invoice_id$file_name$content_type)
  31383.     {
  31384.         $returnType '\SplFileObject';
  31385.         $request $this->getInvoiceAttachmentByFileNameRequest($xero_tenant_id$invoice_id$file_name$content_type);
  31386.         return $this->client
  31387.             ->sendAsync($request$this->createHttpClientOption())
  31388.             ->then(
  31389.                 function ($response) use ($returnType) {
  31390.                     $responseBody $response->getBody();
  31391.                     if ($returnType === '\SplFileObject') {
  31392.                         $content $responseBody//stream goes to serializer
  31393.                     } else {
  31394.                         $content $responseBody->getContents();
  31395.                     }
  31396.                     return [
  31397.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  31398.                         $response->getStatusCode(),
  31399.                         $response->getHeaders()
  31400.                     ];
  31401.                 },
  31402.                 function ($exception) {
  31403.                     $response $exception->getResponse();
  31404.                     $statusCode $response->getStatusCode();
  31405.                     throw new ApiException(
  31406.                         sprintf(
  31407.                             '[%d] Error connecting to the API (%s)',
  31408.                             $statusCode,
  31409.                             $exception->getRequest()->getUri()
  31410.                         ),
  31411.                         $statusCode,
  31412.                         $response->getHeaders(),
  31413.                         $response->getBody()
  31414.                     );
  31415.                 }
  31416.             );
  31417.     }
  31418.     /**
  31419.      * Create request for operation 'getInvoiceAttachmentByFileName'
  31420.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  31421.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  31422.      * @param  string $file_name Name of the attachment (required)
  31423.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  31424.      * @throws \InvalidArgumentException
  31425.      * @return \GuzzleHttp\Psr7\Request  */
  31426.     protected function getInvoiceAttachmentByFileNameRequest($xero_tenant_id$invoice_id$file_name$content_type)
  31427.     {
  31428.         // verify the required parameter 'xero_tenant_id' is set
  31429.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  31430.             throw new \InvalidArgumentException(
  31431.                 'Missing the required parameter $xero_tenant_id when calling getInvoiceAttachmentByFileName'
  31432.             );
  31433.         }
  31434.         // verify the required parameter 'invoice_id' is set
  31435.         if ($invoice_id === null || (is_array($invoice_id) && count($invoice_id) === 0)) {
  31436.             throw new \InvalidArgumentException(
  31437.                 'Missing the required parameter $invoice_id when calling getInvoiceAttachmentByFileName'
  31438.             );
  31439.         }
  31440.         // verify the required parameter 'file_name' is set
  31441.         if ($file_name === null || (is_array($file_name) && count($file_name) === 0)) {
  31442.             throw new \InvalidArgumentException(
  31443.                 'Missing the required parameter $file_name when calling getInvoiceAttachmentByFileName'
  31444.             );
  31445.         }
  31446.         // verify the required parameter 'content_type' is set
  31447.         if ($content_type === null || (is_array($content_type) && count($content_type) === 0)) {
  31448.             throw new \InvalidArgumentException(
  31449.                 'Missing the required parameter $content_type when calling getInvoiceAttachmentByFileName'
  31450.             );
  31451.         }
  31452.         $resourcePath '/Invoices/{InvoiceID}/Attachments/{FileName}';
  31453.         $formParams = [];
  31454.         $queryParams = [];
  31455.         $headerParams = [];
  31456.         $httpBody '';
  31457.         $multipart false;
  31458.         // header params
  31459.         if ($xero_tenant_id !== null) {
  31460.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  31461.         }
  31462.         // header params
  31463.         if ($content_type !== null) {
  31464.             $headerParams['contentType'] = AccountingObjectSerializer::toHeaderValue($content_type);
  31465.         }
  31466.         // path params
  31467.         if ($invoice_id !== null) {
  31468.             $resourcePath str_replace(
  31469.                 '{' 'InvoiceID' '}',
  31470.                 AccountingObjectSerializer::toPathValue($invoice_id),
  31471.                 $resourcePath
  31472.             );
  31473.         }
  31474.         // path params
  31475.         if ($file_name !== null) {
  31476.             $resourcePath str_replace(
  31477.                 '{' 'FileName' '}',
  31478.                 AccountingObjectSerializer::toPathValue($file_name),
  31479.                 $resourcePath
  31480.             );
  31481.         }
  31482.         // body params
  31483.         $_tempBody null;
  31484.         if ($multipart) {
  31485.             $headers $this->headerSelector->selectHeadersForMultipart(
  31486.                 ['application/octet-stream']
  31487.             );
  31488.         } else {
  31489.             $headers $this->headerSelector->selectHeaders(
  31490.                 ['application/octet-stream'],
  31491.                 []
  31492.             );
  31493.         }
  31494.         // for model (json/xml)
  31495.         if (isset($_tempBody)) {
  31496.             // $_tempBody is the method argument, if present
  31497.             if ($headers['Content-Type'] === 'application/json') {
  31498.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  31499.             } else {
  31500.                 $httpBody $_tempBody;
  31501.             }
  31502.         } elseif (count($formParams) > 0) {
  31503.             if ($multipart) {
  31504.                 $multipartContents = [
  31505.                     [
  31506.                         'Content-type' => 'multipart/form-data',
  31507.                     ]
  31508.                 ];
  31509.                 
  31510.                 // for HTTP post (form)
  31511.                 $httpBody = new MultipartStream($multipartContents);
  31512.             } elseif ($headers['Content-Type'] === 'application/json') {
  31513.                 $httpBody \GuzzleHttp\json_encode($formParams);
  31514.             } else {
  31515.                 // for HTTP post (form)
  31516.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  31517.             }
  31518.         }
  31519.         // this endpoint requires OAuth (access token)
  31520.         if ($this->config->getAccessToken() !== null) {
  31521.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  31522.         }
  31523.         $defaultHeaders = [];
  31524.         if ($this->config->getUserAgent()) {
  31525.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  31526.         }
  31527.         $headers array_merge(
  31528.             $defaultHeaders,
  31529.             $headerParams,
  31530.             $headers
  31531.         );
  31532.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  31533.         return new Request(
  31534.             'GET',
  31535.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  31536.             $headers,
  31537.             $httpBody
  31538.         );
  31539.     }
  31540.     /**
  31541.      * Operation getInvoiceAttachmentById
  31542.      * Retrieves a specific attachment from a specific invoices or purchase bills by using a unique attachment Id
  31543.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  31544.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  31545.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  31546.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  31547.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  31548.      * @throws \InvalidArgumentException
  31549.      * @return \SplFileObject
  31550.      */
  31551.     public function getInvoiceAttachmentById($xero_tenant_id$invoice_id$attachment_id$content_type)
  31552.     {
  31553.         list($response) = $this->getInvoiceAttachmentByIdWithHttpInfo($xero_tenant_id$invoice_id$attachment_id$content_type);
  31554.         return $response;
  31555.     }
  31556.     /**
  31557.      * Operation getInvoiceAttachmentByIdWithHttpInfo
  31558.      * Retrieves a specific attachment from a specific invoices or purchase bills by using a unique attachment Id
  31559.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  31560.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  31561.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  31562.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  31563.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  31564.      * @throws \InvalidArgumentException
  31565.      * @return array of \SplFileObject, HTTP status code, HTTP response headers (array of strings)
  31566.      */
  31567.     public function getInvoiceAttachmentByIdWithHttpInfo($xero_tenant_id$invoice_id$attachment_id$content_type)
  31568.     {
  31569.         $request $this->getInvoiceAttachmentByIdRequest($xero_tenant_id$invoice_id$attachment_id$content_type);
  31570.         try {
  31571.             $options $this->createHttpClientOption();
  31572.             try {
  31573.                 $response $this->client->send($request$options);
  31574.             } catch (RequestException $e) {
  31575.                 throw new ApiException(
  31576.                     "[{$e->getCode()}{$e->getMessage()}",
  31577.                     $e->getCode(),
  31578.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  31579.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  31580.                 );
  31581.             }
  31582.             $statusCode $response->getStatusCode();
  31583.             if ($statusCode 200 || $statusCode 299) {
  31584.                 throw new ApiException(
  31585.                     sprintf(
  31586.                         '[%d] Error connecting to the API (%s)',
  31587.                         $statusCode,
  31588.                         $request->getUri()
  31589.                     ),
  31590.                     $statusCode,
  31591.                     $response->getHeaders(),
  31592.                     $response->getBody()
  31593.                 );
  31594.             }
  31595.             $responseBody $response->getBody();
  31596.             switch($statusCode) {
  31597.                 case 200:
  31598.                     if ('\SplFileObject' === '\SplFileObject') {
  31599.                         $content $responseBody//stream goes to serializer
  31600.                     } else {
  31601.                         $content $responseBody->getContents();
  31602.                     }
  31603.                     return [
  31604.                         AccountingObjectSerializer::deserialize($content'\SplFileObject', []),
  31605.                         $response->getStatusCode(),
  31606.                         $response->getHeaders()
  31607.                     ];
  31608.             }
  31609.             $returnType '\SplFileObject';
  31610.             $responseBody $response->getBody();
  31611.             if ($returnType === '\SplFileObject') {
  31612.                 $content $responseBody//stream goes to serializer
  31613.             } else {
  31614.                 $content $responseBody->getContents();
  31615.             }
  31616.             return [
  31617.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  31618.                 $response->getStatusCode(),
  31619.                 $response->getHeaders()
  31620.             ];
  31621.         } catch (ApiException $e) {
  31622.             switch ($e->getCode()) {
  31623.                 case 200:
  31624.                     $data AccountingObjectSerializer::deserialize(
  31625.                         $e->getResponseBody(),
  31626.                         '\SplFileObject',
  31627.                         $e->getResponseHeaders()
  31628.                     );
  31629.                     $e->setResponseObject($data);
  31630.                     break;
  31631.             }
  31632.             throw $e;
  31633.         }
  31634.     }
  31635.     /**
  31636.      * Operation getInvoiceAttachmentByIdAsync
  31637.      * Retrieves a specific attachment from a specific invoices or purchase bills by using a unique attachment Id
  31638.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  31639.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  31640.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  31641.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  31642.      * @throws \InvalidArgumentException
  31643.      * @return \GuzzleHttp\Promise\PromiseInterface
  31644.      */
  31645.     public function getInvoiceAttachmentByIdAsync($xero_tenant_id$invoice_id$attachment_id$content_type)
  31646.     {
  31647.         return $this->getInvoiceAttachmentByIdAsyncWithHttpInfo($xero_tenant_id$invoice_id$attachment_id$content_type)
  31648.             ->then(
  31649.                 function ($response) {
  31650.                     return $response[0];
  31651.                 }
  31652.             );
  31653.     }
  31654.     /**
  31655.      * Operation getInvoiceAttachmentByIdAsyncWithHttpInfo
  31656.      * Retrieves a specific attachment from a specific invoices or purchase bills by using a unique attachment Id
  31657.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  31658.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  31659.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  31660.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  31661.      * @throws \InvalidArgumentException
  31662.      * @return \GuzzleHttp\Promise\PromiseInterface */
  31663.     public function getInvoiceAttachmentByIdAsyncWithHttpInfo($xero_tenant_id$invoice_id$attachment_id$content_type)
  31664.     {
  31665.         $returnType '\SplFileObject';
  31666.         $request $this->getInvoiceAttachmentByIdRequest($xero_tenant_id$invoice_id$attachment_id$content_type);
  31667.         return $this->client
  31668.             ->sendAsync($request$this->createHttpClientOption())
  31669.             ->then(
  31670.                 function ($response) use ($returnType) {
  31671.                     $responseBody $response->getBody();
  31672.                     if ($returnType === '\SplFileObject') {
  31673.                         $content $responseBody//stream goes to serializer
  31674.                     } else {
  31675.                         $content $responseBody->getContents();
  31676.                     }
  31677.                     return [
  31678.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  31679.                         $response->getStatusCode(),
  31680.                         $response->getHeaders()
  31681.                     ];
  31682.                 },
  31683.                 function ($exception) {
  31684.                     $response $exception->getResponse();
  31685.                     $statusCode $response->getStatusCode();
  31686.                     throw new ApiException(
  31687.                         sprintf(
  31688.                             '[%d] Error connecting to the API (%s)',
  31689.                             $statusCode,
  31690.                             $exception->getRequest()->getUri()
  31691.                         ),
  31692.                         $statusCode,
  31693.                         $response->getHeaders(),
  31694.                         $response->getBody()
  31695.                     );
  31696.                 }
  31697.             );
  31698.     }
  31699.     /**
  31700.      * Create request for operation 'getInvoiceAttachmentById'
  31701.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  31702.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  31703.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  31704.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  31705.      * @throws \InvalidArgumentException
  31706.      * @return \GuzzleHttp\Psr7\Request  */
  31707.     protected function getInvoiceAttachmentByIdRequest($xero_tenant_id$invoice_id$attachment_id$content_type)
  31708.     {
  31709.         // verify the required parameter 'xero_tenant_id' is set
  31710.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  31711.             throw new \InvalidArgumentException(
  31712.                 'Missing the required parameter $xero_tenant_id when calling getInvoiceAttachmentById'
  31713.             );
  31714.         }
  31715.         // verify the required parameter 'invoice_id' is set
  31716.         if ($invoice_id === null || (is_array($invoice_id) && count($invoice_id) === 0)) {
  31717.             throw new \InvalidArgumentException(
  31718.                 'Missing the required parameter $invoice_id when calling getInvoiceAttachmentById'
  31719.             );
  31720.         }
  31721.         // verify the required parameter 'attachment_id' is set
  31722.         if ($attachment_id === null || (is_array($attachment_id) && count($attachment_id) === 0)) {
  31723.             throw new \InvalidArgumentException(
  31724.                 'Missing the required parameter $attachment_id when calling getInvoiceAttachmentById'
  31725.             );
  31726.         }
  31727.         // verify the required parameter 'content_type' is set
  31728.         if ($content_type === null || (is_array($content_type) && count($content_type) === 0)) {
  31729.             throw new \InvalidArgumentException(
  31730.                 'Missing the required parameter $content_type when calling getInvoiceAttachmentById'
  31731.             );
  31732.         }
  31733.         $resourcePath '/Invoices/{InvoiceID}/Attachments/{AttachmentID}';
  31734.         $formParams = [];
  31735.         $queryParams = [];
  31736.         $headerParams = [];
  31737.         $httpBody '';
  31738.         $multipart false;
  31739.         // header params
  31740.         if ($xero_tenant_id !== null) {
  31741.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  31742.         }
  31743.         // header params
  31744.         if ($content_type !== null) {
  31745.             $headerParams['contentType'] = AccountingObjectSerializer::toHeaderValue($content_type);
  31746.         }
  31747.         // path params
  31748.         if ($invoice_id !== null) {
  31749.             $resourcePath str_replace(
  31750.                 '{' 'InvoiceID' '}',
  31751.                 AccountingObjectSerializer::toPathValue($invoice_id),
  31752.                 $resourcePath
  31753.             );
  31754.         }
  31755.         // path params
  31756.         if ($attachment_id !== null) {
  31757.             $resourcePath str_replace(
  31758.                 '{' 'AttachmentID' '}',
  31759.                 AccountingObjectSerializer::toPathValue($attachment_id),
  31760.                 $resourcePath
  31761.             );
  31762.         }
  31763.         // body params
  31764.         $_tempBody null;
  31765.         if ($multipart) {
  31766.             $headers $this->headerSelector->selectHeadersForMultipart(
  31767.                 ['application/octet-stream']
  31768.             );
  31769.         } else {
  31770.             $headers $this->headerSelector->selectHeaders(
  31771.                 ['application/octet-stream'],
  31772.                 []
  31773.             );
  31774.         }
  31775.         // for model (json/xml)
  31776.         if (isset($_tempBody)) {
  31777.             // $_tempBody is the method argument, if present
  31778.             if ($headers['Content-Type'] === 'application/json') {
  31779.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  31780.             } else {
  31781.                 $httpBody $_tempBody;
  31782.             }
  31783.         } elseif (count($formParams) > 0) {
  31784.             if ($multipart) {
  31785.                 $multipartContents = [
  31786.                     [
  31787.                         'Content-type' => 'multipart/form-data',
  31788.                     ]
  31789.                 ];
  31790.                 
  31791.                 // for HTTP post (form)
  31792.                 $httpBody = new MultipartStream($multipartContents);
  31793.             } elseif ($headers['Content-Type'] === 'application/json') {
  31794.                 $httpBody \GuzzleHttp\json_encode($formParams);
  31795.             } else {
  31796.                 // for HTTP post (form)
  31797.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  31798.             }
  31799.         }
  31800.         // this endpoint requires OAuth (access token)
  31801.         if ($this->config->getAccessToken() !== null) {
  31802.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  31803.         }
  31804.         $defaultHeaders = [];
  31805.         if ($this->config->getUserAgent()) {
  31806.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  31807.         }
  31808.         $headers array_merge(
  31809.             $defaultHeaders,
  31810.             $headerParams,
  31811.             $headers
  31812.         );
  31813.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  31814.         return new Request(
  31815.             'GET',
  31816.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  31817.             $headers,
  31818.             $httpBody
  31819.         );
  31820.     }
  31821.     /**
  31822.      * Operation getInvoiceAttachments
  31823.      * Retrieves attachments for a specific invoice or purchase bill
  31824.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  31825.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  31826.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  31827.      * @throws \InvalidArgumentException
  31828.      * @return \XeroAPI\XeroPHP\Models\Accounting\Attachments
  31829.      */
  31830.     public function getInvoiceAttachments($xero_tenant_id$invoice_id)
  31831.     {
  31832.         list($response) = $this->getInvoiceAttachmentsWithHttpInfo($xero_tenant_id$invoice_id);
  31833.         return $response;
  31834.     }
  31835.     /**
  31836.      * Operation getInvoiceAttachmentsWithHttpInfo
  31837.      * Retrieves attachments for a specific invoice or purchase bill
  31838.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  31839.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  31840.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  31841.      * @throws \InvalidArgumentException
  31842.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Attachments, HTTP status code, HTTP response headers (array of strings)
  31843.      */
  31844.     public function getInvoiceAttachmentsWithHttpInfo($xero_tenant_id$invoice_id)
  31845.     {
  31846.         $request $this->getInvoiceAttachmentsRequest($xero_tenant_id$invoice_id);
  31847.         try {
  31848.             $options $this->createHttpClientOption();
  31849.             try {
  31850.                 $response $this->client->send($request$options);
  31851.             } catch (RequestException $e) {
  31852.                 throw new ApiException(
  31853.                     "[{$e->getCode()}{$e->getMessage()}",
  31854.                     $e->getCode(),
  31855.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  31856.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  31857.                 );
  31858.             }
  31859.             $statusCode $response->getStatusCode();
  31860.             if ($statusCode 200 || $statusCode 299) {
  31861.                 throw new ApiException(
  31862.                     sprintf(
  31863.                         '[%d] Error connecting to the API (%s)',
  31864.                         $statusCode,
  31865.                         $request->getUri()
  31866.                     ),
  31867.                     $statusCode,
  31868.                     $response->getHeaders(),
  31869.                     $response->getBody()
  31870.                 );
  31871.             }
  31872.             $responseBody $response->getBody();
  31873.             switch($statusCode) {
  31874.                 case 200:
  31875.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Attachments' === '\SplFileObject') {
  31876.                         $content $responseBody//stream goes to serializer
  31877.                     } else {
  31878.                         $content $responseBody->getContents();
  31879.                     }
  31880.                     return [
  31881.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Attachments', []),
  31882.                         $response->getStatusCode(),
  31883.                         $response->getHeaders()
  31884.                     ];
  31885.             }
  31886.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  31887.             $responseBody $response->getBody();
  31888.             if ($returnType === '\SplFileObject') {
  31889.                 $content $responseBody//stream goes to serializer
  31890.             } else {
  31891.                 $content $responseBody->getContents();
  31892.             }
  31893.             return [
  31894.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  31895.                 $response->getStatusCode(),
  31896.                 $response->getHeaders()
  31897.             ];
  31898.         } catch (ApiException $e) {
  31899.             switch ($e->getCode()) {
  31900.                 case 200:
  31901.                     $data AccountingObjectSerializer::deserialize(
  31902.                         $e->getResponseBody(),
  31903.                         '\XeroAPI\XeroPHP\Models\Accounting\Attachments',
  31904.                         $e->getResponseHeaders()
  31905.                     );
  31906.                     $e->setResponseObject($data);
  31907.                     break;
  31908.             }
  31909.             throw $e;
  31910.         }
  31911.     }
  31912.     /**
  31913.      * Operation getInvoiceAttachmentsAsync
  31914.      * Retrieves attachments for a specific invoice or purchase bill
  31915.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  31916.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  31917.      * @throws \InvalidArgumentException
  31918.      * @return \GuzzleHttp\Promise\PromiseInterface
  31919.      */
  31920.     public function getInvoiceAttachmentsAsync($xero_tenant_id$invoice_id)
  31921.     {
  31922.         return $this->getInvoiceAttachmentsAsyncWithHttpInfo($xero_tenant_id$invoice_id)
  31923.             ->then(
  31924.                 function ($response) {
  31925.                     return $response[0];
  31926.                 }
  31927.             );
  31928.     }
  31929.     /**
  31930.      * Operation getInvoiceAttachmentsAsyncWithHttpInfo
  31931.      * Retrieves attachments for a specific invoice or purchase bill
  31932.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  31933.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  31934.      * @throws \InvalidArgumentException
  31935.      * @return \GuzzleHttp\Promise\PromiseInterface */
  31936.     public function getInvoiceAttachmentsAsyncWithHttpInfo($xero_tenant_id$invoice_id)
  31937.     {
  31938.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  31939.         $request $this->getInvoiceAttachmentsRequest($xero_tenant_id$invoice_id);
  31940.         return $this->client
  31941.             ->sendAsync($request$this->createHttpClientOption())
  31942.             ->then(
  31943.                 function ($response) use ($returnType) {
  31944.                     $responseBody $response->getBody();
  31945.                     if ($returnType === '\SplFileObject') {
  31946.                         $content $responseBody//stream goes to serializer
  31947.                     } else {
  31948.                         $content $responseBody->getContents();
  31949.                     }
  31950.                     return [
  31951.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  31952.                         $response->getStatusCode(),
  31953.                         $response->getHeaders()
  31954.                     ];
  31955.                 },
  31956.                 function ($exception) {
  31957.                     $response $exception->getResponse();
  31958.                     $statusCode $response->getStatusCode();
  31959.                     throw new ApiException(
  31960.                         sprintf(
  31961.                             '[%d] Error connecting to the API (%s)',
  31962.                             $statusCode,
  31963.                             $exception->getRequest()->getUri()
  31964.                         ),
  31965.                         $statusCode,
  31966.                         $response->getHeaders(),
  31967.                         $response->getBody()
  31968.                     );
  31969.                 }
  31970.             );
  31971.     }
  31972.     /**
  31973.      * Create request for operation 'getInvoiceAttachments'
  31974.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  31975.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  31976.      * @throws \InvalidArgumentException
  31977.      * @return \GuzzleHttp\Psr7\Request  */
  31978.     protected function getInvoiceAttachmentsRequest($xero_tenant_id$invoice_id)
  31979.     {
  31980.         // verify the required parameter 'xero_tenant_id' is set
  31981.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  31982.             throw new \InvalidArgumentException(
  31983.                 'Missing the required parameter $xero_tenant_id when calling getInvoiceAttachments'
  31984.             );
  31985.         }
  31986.         // verify the required parameter 'invoice_id' is set
  31987.         if ($invoice_id === null || (is_array($invoice_id) && count($invoice_id) === 0)) {
  31988.             throw new \InvalidArgumentException(
  31989.                 'Missing the required parameter $invoice_id when calling getInvoiceAttachments'
  31990.             );
  31991.         }
  31992.         $resourcePath '/Invoices/{InvoiceID}/Attachments';
  31993.         $formParams = [];
  31994.         $queryParams = [];
  31995.         $headerParams = [];
  31996.         $httpBody '';
  31997.         $multipart false;
  31998.         // header params
  31999.         if ($xero_tenant_id !== null) {
  32000.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  32001.         }
  32002.         // path params
  32003.         if ($invoice_id !== null) {
  32004.             $resourcePath str_replace(
  32005.                 '{' 'InvoiceID' '}',
  32006.                 AccountingObjectSerializer::toPathValue($invoice_id),
  32007.                 $resourcePath
  32008.             );
  32009.         }
  32010.         // body params
  32011.         $_tempBody null;
  32012.         if ($multipart) {
  32013.             $headers $this->headerSelector->selectHeadersForMultipart(
  32014.                 ['application/json']
  32015.             );
  32016.         } else {
  32017.             $headers $this->headerSelector->selectHeaders(
  32018.                 ['application/json'],
  32019.                 []
  32020.             );
  32021.         }
  32022.         // for model (json/xml)
  32023.         if (isset($_tempBody)) {
  32024.             // $_tempBody is the method argument, if present
  32025.             if ($headers['Content-Type'] === 'application/json') {
  32026.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  32027.             } else {
  32028.                 $httpBody $_tempBody;
  32029.             }
  32030.         } elseif (count($formParams) > 0) {
  32031.             if ($multipart) {
  32032.                 $multipartContents = [
  32033.                     [
  32034.                         'Content-type' => 'multipart/form-data',
  32035.                     ]
  32036.                 ];
  32037.                 
  32038.                 // for HTTP post (form)
  32039.                 $httpBody = new MultipartStream($multipartContents);
  32040.             } elseif ($headers['Content-Type'] === 'application/json') {
  32041.                 $httpBody \GuzzleHttp\json_encode($formParams);
  32042.             } else {
  32043.                 // for HTTP post (form)
  32044.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  32045.             }
  32046.         }
  32047.         // this endpoint requires OAuth (access token)
  32048.         if ($this->config->getAccessToken() !== null) {
  32049.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  32050.         }
  32051.         $defaultHeaders = [];
  32052.         if ($this->config->getUserAgent()) {
  32053.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  32054.         }
  32055.         $headers array_merge(
  32056.             $defaultHeaders,
  32057.             $headerParams,
  32058.             $headers
  32059.         );
  32060.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  32061.         return new Request(
  32062.             'GET',
  32063.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  32064.             $headers,
  32065.             $httpBody
  32066.         );
  32067.     }
  32068.     /**
  32069.      * Operation getInvoiceHistory
  32070.      * Retrieves history records for a specific invoice
  32071.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  32072.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  32073.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  32074.      * @throws \InvalidArgumentException
  32075.      * @return \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords
  32076.      */
  32077.     public function getInvoiceHistory($xero_tenant_id$invoice_id)
  32078.     {
  32079.         list($response) = $this->getInvoiceHistoryWithHttpInfo($xero_tenant_id$invoice_id);
  32080.         return $response;
  32081.     }
  32082.     /**
  32083.      * Operation getInvoiceHistoryWithHttpInfo
  32084.      * Retrieves history records for a specific invoice
  32085.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  32086.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  32087.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  32088.      * @throws \InvalidArgumentException
  32089.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords, HTTP status code, HTTP response headers (array of strings)
  32090.      */
  32091.     public function getInvoiceHistoryWithHttpInfo($xero_tenant_id$invoice_id)
  32092.     {
  32093.         $request $this->getInvoiceHistoryRequest($xero_tenant_id$invoice_id);
  32094.         try {
  32095.             $options $this->createHttpClientOption();
  32096.             try {
  32097.                 $response $this->client->send($request$options);
  32098.             } catch (RequestException $e) {
  32099.                 throw new ApiException(
  32100.                     "[{$e->getCode()}{$e->getMessage()}",
  32101.                     $e->getCode(),
  32102.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  32103.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  32104.                 );
  32105.             }
  32106.             $statusCode $response->getStatusCode();
  32107.             if ($statusCode 200 || $statusCode 299) {
  32108.                 throw new ApiException(
  32109.                     sprintf(
  32110.                         '[%d] Error connecting to the API (%s)',
  32111.                         $statusCode,
  32112.                         $request->getUri()
  32113.                     ),
  32114.                     $statusCode,
  32115.                     $response->getHeaders(),
  32116.                     $response->getBody()
  32117.                 );
  32118.             }
  32119.             $responseBody $response->getBody();
  32120.             switch($statusCode) {
  32121.                 case 200:
  32122.                     if ('\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords' === '\SplFileObject') {
  32123.                         $content $responseBody//stream goes to serializer
  32124.                     } else {
  32125.                         $content $responseBody->getContents();
  32126.                     }
  32127.                     return [
  32128.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords', []),
  32129.                         $response->getStatusCode(),
  32130.                         $response->getHeaders()
  32131.                     ];
  32132.             }
  32133.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  32134.             $responseBody $response->getBody();
  32135.             if ($returnType === '\SplFileObject') {
  32136.                 $content $responseBody//stream goes to serializer
  32137.             } else {
  32138.                 $content $responseBody->getContents();
  32139.             }
  32140.             return [
  32141.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  32142.                 $response->getStatusCode(),
  32143.                 $response->getHeaders()
  32144.             ];
  32145.         } catch (ApiException $e) {
  32146.             switch ($e->getCode()) {
  32147.                 case 200:
  32148.                     $data AccountingObjectSerializer::deserialize(
  32149.                         $e->getResponseBody(),
  32150.                         '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords',
  32151.                         $e->getResponseHeaders()
  32152.                     );
  32153.                     $e->setResponseObject($data);
  32154.                     break;
  32155.             }
  32156.             throw $e;
  32157.         }
  32158.     }
  32159.     /**
  32160.      * Operation getInvoiceHistoryAsync
  32161.      * Retrieves history records for a specific invoice
  32162.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  32163.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  32164.      * @throws \InvalidArgumentException
  32165.      * @return \GuzzleHttp\Promise\PromiseInterface
  32166.      */
  32167.     public function getInvoiceHistoryAsync($xero_tenant_id$invoice_id)
  32168.     {
  32169.         return $this->getInvoiceHistoryAsyncWithHttpInfo($xero_tenant_id$invoice_id)
  32170.             ->then(
  32171.                 function ($response) {
  32172.                     return $response[0];
  32173.                 }
  32174.             );
  32175.     }
  32176.     /**
  32177.      * Operation getInvoiceHistoryAsyncWithHttpInfo
  32178.      * Retrieves history records for a specific invoice
  32179.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  32180.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  32181.      * @throws \InvalidArgumentException
  32182.      * @return \GuzzleHttp\Promise\PromiseInterface */
  32183.     public function getInvoiceHistoryAsyncWithHttpInfo($xero_tenant_id$invoice_id)
  32184.     {
  32185.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  32186.         $request $this->getInvoiceHistoryRequest($xero_tenant_id$invoice_id);
  32187.         return $this->client
  32188.             ->sendAsync($request$this->createHttpClientOption())
  32189.             ->then(
  32190.                 function ($response) use ($returnType) {
  32191.                     $responseBody $response->getBody();
  32192.                     if ($returnType === '\SplFileObject') {
  32193.                         $content $responseBody//stream goes to serializer
  32194.                     } else {
  32195.                         $content $responseBody->getContents();
  32196.                     }
  32197.                     return [
  32198.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  32199.                         $response->getStatusCode(),
  32200.                         $response->getHeaders()
  32201.                     ];
  32202.                 },
  32203.                 function ($exception) {
  32204.                     $response $exception->getResponse();
  32205.                     $statusCode $response->getStatusCode();
  32206.                     throw new ApiException(
  32207.                         sprintf(
  32208.                             '[%d] Error connecting to the API (%s)',
  32209.                             $statusCode,
  32210.                             $exception->getRequest()->getUri()
  32211.                         ),
  32212.                         $statusCode,
  32213.                         $response->getHeaders(),
  32214.                         $response->getBody()
  32215.                     );
  32216.                 }
  32217.             );
  32218.     }
  32219.     /**
  32220.      * Create request for operation 'getInvoiceHistory'
  32221.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  32222.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  32223.      * @throws \InvalidArgumentException
  32224.      * @return \GuzzleHttp\Psr7\Request  */
  32225.     protected function getInvoiceHistoryRequest($xero_tenant_id$invoice_id)
  32226.     {
  32227.         // verify the required parameter 'xero_tenant_id' is set
  32228.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  32229.             throw new \InvalidArgumentException(
  32230.                 'Missing the required parameter $xero_tenant_id when calling getInvoiceHistory'
  32231.             );
  32232.         }
  32233.         // verify the required parameter 'invoice_id' is set
  32234.         if ($invoice_id === null || (is_array($invoice_id) && count($invoice_id) === 0)) {
  32235.             throw new \InvalidArgumentException(
  32236.                 'Missing the required parameter $invoice_id when calling getInvoiceHistory'
  32237.             );
  32238.         }
  32239.         $resourcePath '/Invoices/{InvoiceID}/History';
  32240.         $formParams = [];
  32241.         $queryParams = [];
  32242.         $headerParams = [];
  32243.         $httpBody '';
  32244.         $multipart false;
  32245.         // header params
  32246.         if ($xero_tenant_id !== null) {
  32247.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  32248.         }
  32249.         // path params
  32250.         if ($invoice_id !== null) {
  32251.             $resourcePath str_replace(
  32252.                 '{' 'InvoiceID' '}',
  32253.                 AccountingObjectSerializer::toPathValue($invoice_id),
  32254.                 $resourcePath
  32255.             );
  32256.         }
  32257.         // body params
  32258.         $_tempBody null;
  32259.         if ($multipart) {
  32260.             $headers $this->headerSelector->selectHeadersForMultipart(
  32261.                 ['application/json']
  32262.             );
  32263.         } else {
  32264.             $headers $this->headerSelector->selectHeaders(
  32265.                 ['application/json'],
  32266.                 []
  32267.             );
  32268.         }
  32269.         // for model (json/xml)
  32270.         if (isset($_tempBody)) {
  32271.             // $_tempBody is the method argument, if present
  32272.             if ($headers['Content-Type'] === 'application/json') {
  32273.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  32274.             } else {
  32275.                 $httpBody $_tempBody;
  32276.             }
  32277.         } elseif (count($formParams) > 0) {
  32278.             if ($multipart) {
  32279.                 $multipartContents = [
  32280.                     [
  32281.                         'Content-type' => 'multipart/form-data',
  32282.                     ]
  32283.                 ];
  32284.                 
  32285.                 // for HTTP post (form)
  32286.                 $httpBody = new MultipartStream($multipartContents);
  32287.             } elseif ($headers['Content-Type'] === 'application/json') {
  32288.                 $httpBody \GuzzleHttp\json_encode($formParams);
  32289.             } else {
  32290.                 // for HTTP post (form)
  32291.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  32292.             }
  32293.         }
  32294.         // this endpoint requires OAuth (access token)
  32295.         if ($this->config->getAccessToken() !== null) {
  32296.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  32297.         }
  32298.         $defaultHeaders = [];
  32299.         if ($this->config->getUserAgent()) {
  32300.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  32301.         }
  32302.         $headers array_merge(
  32303.             $defaultHeaders,
  32304.             $headerParams,
  32305.             $headers
  32306.         );
  32307.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  32308.         return new Request(
  32309.             'GET',
  32310.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  32311.             $headers,
  32312.             $httpBody
  32313.         );
  32314.     }
  32315.     /**
  32316.      * Operation getInvoiceReminders
  32317.      * Retrieves invoice reminder settings
  32318.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  32319.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  32320.      * @throws \InvalidArgumentException
  32321.      * @return \XeroAPI\XeroPHP\Models\Accounting\InvoiceReminders
  32322.      */
  32323.     public function getInvoiceReminders($xero_tenant_id)
  32324.     {
  32325.         list($response) = $this->getInvoiceRemindersWithHttpInfo($xero_tenant_id);
  32326.         return $response;
  32327.     }
  32328.     /**
  32329.      * Operation getInvoiceRemindersWithHttpInfo
  32330.      * Retrieves invoice reminder settings
  32331.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  32332.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  32333.      * @throws \InvalidArgumentException
  32334.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\InvoiceReminders, HTTP status code, HTTP response headers (array of strings)
  32335.      */
  32336.     public function getInvoiceRemindersWithHttpInfo($xero_tenant_id)
  32337.     {
  32338.         $request $this->getInvoiceRemindersRequest($xero_tenant_id);
  32339.         try {
  32340.             $options $this->createHttpClientOption();
  32341.             try {
  32342.                 $response $this->client->send($request$options);
  32343.             } catch (RequestException $e) {
  32344.                 throw new ApiException(
  32345.                     "[{$e->getCode()}{$e->getMessage()}",
  32346.                     $e->getCode(),
  32347.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  32348.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  32349.                 );
  32350.             }
  32351.             $statusCode $response->getStatusCode();
  32352.             if ($statusCode 200 || $statusCode 299) {
  32353.                 throw new ApiException(
  32354.                     sprintf(
  32355.                         '[%d] Error connecting to the API (%s)',
  32356.                         $statusCode,
  32357.                         $request->getUri()
  32358.                     ),
  32359.                     $statusCode,
  32360.                     $response->getHeaders(),
  32361.                     $response->getBody()
  32362.                 );
  32363.             }
  32364.             $responseBody $response->getBody();
  32365.             switch($statusCode) {
  32366.                 case 200:
  32367.                     if ('\XeroAPI\XeroPHP\Models\Accounting\InvoiceReminders' === '\SplFileObject') {
  32368.                         $content $responseBody//stream goes to serializer
  32369.                     } else {
  32370.                         $content $responseBody->getContents();
  32371.                     }
  32372.                     return [
  32373.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\InvoiceReminders', []),
  32374.                         $response->getStatusCode(),
  32375.                         $response->getHeaders()
  32376.                     ];
  32377.             }
  32378.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\InvoiceReminders';
  32379.             $responseBody $response->getBody();
  32380.             if ($returnType === '\SplFileObject') {
  32381.                 $content $responseBody//stream goes to serializer
  32382.             } else {
  32383.                 $content $responseBody->getContents();
  32384.             }
  32385.             return [
  32386.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  32387.                 $response->getStatusCode(),
  32388.                 $response->getHeaders()
  32389.             ];
  32390.         } catch (ApiException $e) {
  32391.             switch ($e->getCode()) {
  32392.                 case 200:
  32393.                     $data AccountingObjectSerializer::deserialize(
  32394.                         $e->getResponseBody(),
  32395.                         '\XeroAPI\XeroPHP\Models\Accounting\InvoiceReminders',
  32396.                         $e->getResponseHeaders()
  32397.                     );
  32398.                     $e->setResponseObject($data);
  32399.                     break;
  32400.             }
  32401.             throw $e;
  32402.         }
  32403.     }
  32404.     /**
  32405.      * Operation getInvoiceRemindersAsync
  32406.      * Retrieves invoice reminder settings
  32407.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  32408.      * @throws \InvalidArgumentException
  32409.      * @return \GuzzleHttp\Promise\PromiseInterface
  32410.      */
  32411.     public function getInvoiceRemindersAsync($xero_tenant_id)
  32412.     {
  32413.         return $this->getInvoiceRemindersAsyncWithHttpInfo($xero_tenant_id)
  32414.             ->then(
  32415.                 function ($response) {
  32416.                     return $response[0];
  32417.                 }
  32418.             );
  32419.     }
  32420.     /**
  32421.      * Operation getInvoiceRemindersAsyncWithHttpInfo
  32422.      * Retrieves invoice reminder settings
  32423.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  32424.      * @throws \InvalidArgumentException
  32425.      * @return \GuzzleHttp\Promise\PromiseInterface */
  32426.     public function getInvoiceRemindersAsyncWithHttpInfo($xero_tenant_id)
  32427.     {
  32428.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\InvoiceReminders';
  32429.         $request $this->getInvoiceRemindersRequest($xero_tenant_id);
  32430.         return $this->client
  32431.             ->sendAsync($request$this->createHttpClientOption())
  32432.             ->then(
  32433.                 function ($response) use ($returnType) {
  32434.                     $responseBody $response->getBody();
  32435.                     if ($returnType === '\SplFileObject') {
  32436.                         $content $responseBody//stream goes to serializer
  32437.                     } else {
  32438.                         $content $responseBody->getContents();
  32439.                     }
  32440.                     return [
  32441.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  32442.                         $response->getStatusCode(),
  32443.                         $response->getHeaders()
  32444.                     ];
  32445.                 },
  32446.                 function ($exception) {
  32447.                     $response $exception->getResponse();
  32448.                     $statusCode $response->getStatusCode();
  32449.                     throw new ApiException(
  32450.                         sprintf(
  32451.                             '[%d] Error connecting to the API (%s)',
  32452.                             $statusCode,
  32453.                             $exception->getRequest()->getUri()
  32454.                         ),
  32455.                         $statusCode,
  32456.                         $response->getHeaders(),
  32457.                         $response->getBody()
  32458.                     );
  32459.                 }
  32460.             );
  32461.     }
  32462.     /**
  32463.      * Create request for operation 'getInvoiceReminders'
  32464.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  32465.      * @throws \InvalidArgumentException
  32466.      * @return \GuzzleHttp\Psr7\Request  */
  32467.     protected function getInvoiceRemindersRequest($xero_tenant_id)
  32468.     {
  32469.         // verify the required parameter 'xero_tenant_id' is set
  32470.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  32471.             throw new \InvalidArgumentException(
  32472.                 'Missing the required parameter $xero_tenant_id when calling getInvoiceReminders'
  32473.             );
  32474.         }
  32475.         $resourcePath '/InvoiceReminders/Settings';
  32476.         $formParams = [];
  32477.         $queryParams = [];
  32478.         $headerParams = [];
  32479.         $httpBody '';
  32480.         $multipart false;
  32481.         // header params
  32482.         if ($xero_tenant_id !== null) {
  32483.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  32484.         }
  32485.         // body params
  32486.         $_tempBody null;
  32487.         if ($multipart) {
  32488.             $headers $this->headerSelector->selectHeadersForMultipart(
  32489.                 ['application/json']
  32490.             );
  32491.         } else {
  32492.             $headers $this->headerSelector->selectHeaders(
  32493.                 ['application/json'],
  32494.                 []
  32495.             );
  32496.         }
  32497.         // for model (json/xml)
  32498.         if (isset($_tempBody)) {
  32499.             // $_tempBody is the method argument, if present
  32500.             if ($headers['Content-Type'] === 'application/json') {
  32501.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  32502.             } else {
  32503.                 $httpBody $_tempBody;
  32504.             }
  32505.         } elseif (count($formParams) > 0) {
  32506.             if ($multipart) {
  32507.                 $multipartContents = [
  32508.                     [
  32509.                         'Content-type' => 'multipart/form-data',
  32510.                     ]
  32511.                 ];
  32512.                 
  32513.                 // for HTTP post (form)
  32514.                 $httpBody = new MultipartStream($multipartContents);
  32515.             } elseif ($headers['Content-Type'] === 'application/json') {
  32516.                 $httpBody \GuzzleHttp\json_encode($formParams);
  32517.             } else {
  32518.                 // for HTTP post (form)
  32519.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  32520.             }
  32521.         }
  32522.         // this endpoint requires OAuth (access token)
  32523.         if ($this->config->getAccessToken() !== null) {
  32524.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  32525.         }
  32526.         $defaultHeaders = [];
  32527.         if ($this->config->getUserAgent()) {
  32528.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  32529.         }
  32530.         $headers array_merge(
  32531.             $defaultHeaders,
  32532.             $headerParams,
  32533.             $headers
  32534.         );
  32535.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  32536.         return new Request(
  32537.             'GET',
  32538.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  32539.             $headers,
  32540.             $httpBody
  32541.         );
  32542.     }
  32543.     /**
  32544.      * Operation getInvoices
  32545.      * Retrieves sales invoices or purchase bills
  32546.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  32547.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  32548.      * @param  string $where Filter by an any element (optional)
  32549.      * @param  string $order Order by an any element (optional)
  32550.      * @param  string[] $ids Filter by a comma-separated list of InvoicesIDs. (optional)
  32551.      * @param  string[] $invoice_numbers Filter by a comma-separated list of InvoiceNumbers. (optional)
  32552.      * @param  string[] $contact_ids Filter by a comma-separated list of ContactIDs. (optional)
  32553.      * @param  string[] $statuses Filter by a comma-separated list Statuses. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. (optional)
  32554.      * @param  int $page e.g. page&#x3D;1 â€“ Up to 100 invoices will be returned in a single API call with line items shown for each invoice (optional)
  32555.      * @param  bool $include_archived e.g. includeArchived&#x3D;true - Invoices with a status of ARCHIVED will be included in the response (optional)
  32556.      * @param  bool $created_by_my_app When set to true you&#39;ll only retrieve Invoices created by your app (optional)
  32557.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  32558.      * @param  bool $summary_only Use summaryOnly&#x3D;true in GET Contacts and Invoices endpoint to retrieve a smaller version of the response object. This returns only lightweight fields, excluding computation-heavy fields from the response, making the API calls quick and efficient. (optional, default to false)
  32559.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  32560.      * @throws \InvalidArgumentException
  32561.      * @return \XeroAPI\XeroPHP\Models\Accounting\Invoices
  32562.      */
  32563.     public function getInvoices($xero_tenant_id$if_modified_since null$where null$order null$ids null$invoice_numbers null$contact_ids null$statuses null$page null$include_archived null$created_by_my_app null$unitdp null$summary_only false)
  32564.     {
  32565.         list($response) = $this->getInvoicesWithHttpInfo($xero_tenant_id$if_modified_since$where$order$ids$invoice_numbers$contact_ids$statuses$page$include_archived$created_by_my_app$unitdp$summary_only);
  32566.         return $response;
  32567.     }
  32568.     /**
  32569.      * Operation getInvoicesWithHttpInfo
  32570.      * Retrieves sales invoices or purchase bills
  32571.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  32572.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  32573.      * @param  string $where Filter by an any element (optional)
  32574.      * @param  string $order Order by an any element (optional)
  32575.      * @param  string[] $ids Filter by a comma-separated list of InvoicesIDs. (optional)
  32576.      * @param  string[] $invoice_numbers Filter by a comma-separated list of InvoiceNumbers. (optional)
  32577.      * @param  string[] $contact_ids Filter by a comma-separated list of ContactIDs. (optional)
  32578.      * @param  string[] $statuses Filter by a comma-separated list Statuses. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. (optional)
  32579.      * @param  int $page e.g. page&#x3D;1 â€“ Up to 100 invoices will be returned in a single API call with line items shown for each invoice (optional)
  32580.      * @param  bool $include_archived e.g. includeArchived&#x3D;true - Invoices with a status of ARCHIVED will be included in the response (optional)
  32581.      * @param  bool $created_by_my_app When set to true you&#39;ll only retrieve Invoices created by your app (optional)
  32582.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  32583.      * @param  bool $summary_only Use summaryOnly&#x3D;true in GET Contacts and Invoices endpoint to retrieve a smaller version of the response object. This returns only lightweight fields, excluding computation-heavy fields from the response, making the API calls quick and efficient. (optional, default to false)
  32584.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  32585.      * @throws \InvalidArgumentException
  32586.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Invoices, HTTP status code, HTTP response headers (array of strings)
  32587.      */
  32588.     public function getInvoicesWithHttpInfo($xero_tenant_id$if_modified_since null$where null$order null$ids null$invoice_numbers null$contact_ids null$statuses null$page null$include_archived null$created_by_my_app null$unitdp null$summary_only false)
  32589.     {
  32590.         $request $this->getInvoicesRequest($xero_tenant_id$if_modified_since$where$order$ids$invoice_numbers$contact_ids$statuses$page$include_archived$created_by_my_app$unitdp$summary_only);
  32591.         try {
  32592.             $options $this->createHttpClientOption();
  32593.             try {
  32594.                 $response $this->client->send($request$options);
  32595.             } catch (RequestException $e) {
  32596.                 throw new ApiException(
  32597.                     "[{$e->getCode()}{$e->getMessage()}",
  32598.                     $e->getCode(),
  32599.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  32600.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  32601.                 );
  32602.             }
  32603.             $statusCode $response->getStatusCode();
  32604.             if ($statusCode 200 || $statusCode 299) {
  32605.                 throw new ApiException(
  32606.                     sprintf(
  32607.                         '[%d] Error connecting to the API (%s)',
  32608.                         $statusCode,
  32609.                         $request->getUri()
  32610.                     ),
  32611.                     $statusCode,
  32612.                     $response->getHeaders(),
  32613.                     $response->getBody()
  32614.                 );
  32615.             }
  32616.             $responseBody $response->getBody();
  32617.             switch($statusCode) {
  32618.                 case 200:
  32619.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Invoices' === '\SplFileObject') {
  32620.                         $content $responseBody//stream goes to serializer
  32621.                     } else {
  32622.                         $content $responseBody->getContents();
  32623.                     }
  32624.                     return [
  32625.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Invoices', []),
  32626.                         $response->getStatusCode(),
  32627.                         $response->getHeaders()
  32628.                     ];
  32629.             }
  32630.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Invoices';
  32631.             $responseBody $response->getBody();
  32632.             if ($returnType === '\SplFileObject') {
  32633.                 $content $responseBody//stream goes to serializer
  32634.             } else {
  32635.                 $content $responseBody->getContents();
  32636.             }
  32637.             return [
  32638.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  32639.                 $response->getStatusCode(),
  32640.                 $response->getHeaders()
  32641.             ];
  32642.         } catch (ApiException $e) {
  32643.             switch ($e->getCode()) {
  32644.                 case 200:
  32645.                     $data AccountingObjectSerializer::deserialize(
  32646.                         $e->getResponseBody(),
  32647.                         '\XeroAPI\XeroPHP\Models\Accounting\Invoices',
  32648.                         $e->getResponseHeaders()
  32649.                     );
  32650.                     $e->setResponseObject($data);
  32651.                     break;
  32652.             }
  32653.             throw $e;
  32654.         }
  32655.     }
  32656.     /**
  32657.      * Operation getInvoicesAsync
  32658.      * Retrieves sales invoices or purchase bills
  32659.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  32660.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  32661.      * @param  string $where Filter by an any element (optional)
  32662.      * @param  string $order Order by an any element (optional)
  32663.      * @param  string[] $ids Filter by a comma-separated list of InvoicesIDs. (optional)
  32664.      * @param  string[] $invoice_numbers Filter by a comma-separated list of InvoiceNumbers. (optional)
  32665.      * @param  string[] $contact_ids Filter by a comma-separated list of ContactIDs. (optional)
  32666.      * @param  string[] $statuses Filter by a comma-separated list Statuses. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. (optional)
  32667.      * @param  int $page e.g. page&#x3D;1 â€“ Up to 100 invoices will be returned in a single API call with line items shown for each invoice (optional)
  32668.      * @param  bool $include_archived e.g. includeArchived&#x3D;true - Invoices with a status of ARCHIVED will be included in the response (optional)
  32669.      * @param  bool $created_by_my_app When set to true you&#39;ll only retrieve Invoices created by your app (optional)
  32670.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  32671.      * @param  bool $summary_only Use summaryOnly&#x3D;true in GET Contacts and Invoices endpoint to retrieve a smaller version of the response object. This returns only lightweight fields, excluding computation-heavy fields from the response, making the API calls quick and efficient. (optional, default to false)
  32672.      * @throws \InvalidArgumentException
  32673.      * @return \GuzzleHttp\Promise\PromiseInterface
  32674.      */
  32675.     public function getInvoicesAsync($xero_tenant_id$if_modified_since null$where null$order null$ids null$invoice_numbers null$contact_ids null$statuses null$page null$include_archived null$created_by_my_app null$unitdp null$summary_only false)
  32676.     {
  32677.         return $this->getInvoicesAsyncWithHttpInfo($xero_tenant_id$if_modified_since$where$order$ids$invoice_numbers$contact_ids$statuses$page$include_archived$created_by_my_app$unitdp$summary_only)
  32678.             ->then(
  32679.                 function ($response) {
  32680.                     return $response[0];
  32681.                 }
  32682.             );
  32683.     }
  32684.     /**
  32685.      * Operation getInvoicesAsyncWithHttpInfo
  32686.      * Retrieves sales invoices or purchase bills
  32687.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  32688.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  32689.      * @param  string $where Filter by an any element (optional)
  32690.      * @param  string $order Order by an any element (optional)
  32691.      * @param  string[] $ids Filter by a comma-separated list of InvoicesIDs. (optional)
  32692.      * @param  string[] $invoice_numbers Filter by a comma-separated list of InvoiceNumbers. (optional)
  32693.      * @param  string[] $contact_ids Filter by a comma-separated list of ContactIDs. (optional)
  32694.      * @param  string[] $statuses Filter by a comma-separated list Statuses. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. (optional)
  32695.      * @param  int $page e.g. page&#x3D;1 â€“ Up to 100 invoices will be returned in a single API call with line items shown for each invoice (optional)
  32696.      * @param  bool $include_archived e.g. includeArchived&#x3D;true - Invoices with a status of ARCHIVED will be included in the response (optional)
  32697.      * @param  bool $created_by_my_app When set to true you&#39;ll only retrieve Invoices created by your app (optional)
  32698.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  32699.      * @param  bool $summary_only Use summaryOnly&#x3D;true in GET Contacts and Invoices endpoint to retrieve a smaller version of the response object. This returns only lightweight fields, excluding computation-heavy fields from the response, making the API calls quick and efficient. (optional, default to false)
  32700.      * @throws \InvalidArgumentException
  32701.      * @return \GuzzleHttp\Promise\PromiseInterface */
  32702.     public function getInvoicesAsyncWithHttpInfo($xero_tenant_id$if_modified_since null$where null$order null$ids null$invoice_numbers null$contact_ids null$statuses null$page null$include_archived null$created_by_my_app null$unitdp null$summary_only false)
  32703.     {
  32704.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Invoices';
  32705.         $request $this->getInvoicesRequest($xero_tenant_id$if_modified_since$where$order$ids$invoice_numbers$contact_ids$statuses$page$include_archived$created_by_my_app$unitdp$summary_only);
  32706.         return $this->client
  32707.             ->sendAsync($request$this->createHttpClientOption())
  32708.             ->then(
  32709.                 function ($response) use ($returnType) {
  32710.                     $responseBody $response->getBody();
  32711.                     if ($returnType === '\SplFileObject') {
  32712.                         $content $responseBody//stream goes to serializer
  32713.                     } else {
  32714.                         $content $responseBody->getContents();
  32715.                     }
  32716.                     return [
  32717.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  32718.                         $response->getStatusCode(),
  32719.                         $response->getHeaders()
  32720.                     ];
  32721.                 },
  32722.                 function ($exception) {
  32723.                     $response $exception->getResponse();
  32724.                     $statusCode $response->getStatusCode();
  32725.                     throw new ApiException(
  32726.                         sprintf(
  32727.                             '[%d] Error connecting to the API (%s)',
  32728.                             $statusCode,
  32729.                             $exception->getRequest()->getUri()
  32730.                         ),
  32731.                         $statusCode,
  32732.                         $response->getHeaders(),
  32733.                         $response->getBody()
  32734.                     );
  32735.                 }
  32736.             );
  32737.     }
  32738.     /**
  32739.      * Create request for operation 'getInvoices'
  32740.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  32741.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  32742.      * @param  string $where Filter by an any element (optional)
  32743.      * @param  string $order Order by an any element (optional)
  32744.      * @param  string[] $ids Filter by a comma-separated list of InvoicesIDs. (optional)
  32745.      * @param  string[] $invoice_numbers Filter by a comma-separated list of InvoiceNumbers. (optional)
  32746.      * @param  string[] $contact_ids Filter by a comma-separated list of ContactIDs. (optional)
  32747.      * @param  string[] $statuses Filter by a comma-separated list Statuses. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. (optional)
  32748.      * @param  int $page e.g. page&#x3D;1 â€“ Up to 100 invoices will be returned in a single API call with line items shown for each invoice (optional)
  32749.      * @param  bool $include_archived e.g. includeArchived&#x3D;true - Invoices with a status of ARCHIVED will be included in the response (optional)
  32750.      * @param  bool $created_by_my_app When set to true you&#39;ll only retrieve Invoices created by your app (optional)
  32751.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  32752.      * @param  bool $summary_only Use summaryOnly&#x3D;true in GET Contacts and Invoices endpoint to retrieve a smaller version of the response object. This returns only lightweight fields, excluding computation-heavy fields from the response, making the API calls quick and efficient. (optional, default to false)
  32753.      * @throws \InvalidArgumentException
  32754.      * @return \GuzzleHttp\Psr7\Request  */
  32755.     protected function getInvoicesRequest($xero_tenant_id$if_modified_since null$where null$order null$ids null$invoice_numbers null$contact_ids null$statuses null$page null$include_archived null$created_by_my_app null$unitdp null$summary_only false)
  32756.     {
  32757.         // verify the required parameter 'xero_tenant_id' is set
  32758.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  32759.             throw new \InvalidArgumentException(
  32760.                 'Missing the required parameter $xero_tenant_id when calling getInvoices'
  32761.             );
  32762.         }
  32763.         $resourcePath '/Invoices';
  32764.         $formParams = [];
  32765.         $queryParams = [];
  32766.         $headerParams = [];
  32767.         $httpBody '';
  32768.         $multipart false;
  32769.         // query params
  32770.         if ($where !== null) {
  32771.             $queryParams['where'] = AccountingObjectSerializer::toQueryValue($where);
  32772.         }
  32773.         // query params
  32774.         if ($order !== null) {
  32775.             $queryParams['order'] = AccountingObjectSerializer::toQueryValue($order);
  32776.         }
  32777.         // query params
  32778.         if (is_array($ids)) {
  32779.             $ids AccountingObjectSerializer::serializeCollection($ids'csv'true);
  32780.         }
  32781.         if ($ids !== null) {
  32782.             $queryParams['IDs'] = AccountingObjectSerializer::toQueryValue($ids);
  32783.         }
  32784.         // query params
  32785.         if (is_array($invoice_numbers)) {
  32786.             $invoice_numbers AccountingObjectSerializer::serializeCollection($invoice_numbers'csv'true);
  32787.         }
  32788.         if ($invoice_numbers !== null) {
  32789.             $queryParams['InvoiceNumbers'] = AccountingObjectSerializer::toQueryValue($invoice_numbers);
  32790.         }
  32791.         // query params
  32792.         if (is_array($contact_ids)) {
  32793.             $contact_ids AccountingObjectSerializer::serializeCollection($contact_ids'csv'true);
  32794.         }
  32795.         if ($contact_ids !== null) {
  32796.             $queryParams['ContactIDs'] = AccountingObjectSerializer::toQueryValue($contact_ids);
  32797.         }
  32798.         // query params
  32799.         if (is_array($statuses)) {
  32800.             $statuses AccountingObjectSerializer::serializeCollection($statuses'csv'true);
  32801.         }
  32802.         if ($statuses !== null) {
  32803.             $queryParams['Statuses'] = AccountingObjectSerializer::toQueryValue($statuses);
  32804.         }
  32805.         // query params
  32806.         if ($page !== null) {
  32807.             $queryParams['page'] = AccountingObjectSerializer::toQueryValue($page);
  32808.         }
  32809.         // query params
  32810.         if ($include_archived !== null) {
  32811.             $queryParams['includeArchived'] = $include_archived 'true' 'false';
  32812.         }
  32813.         // query params
  32814.         if ($created_by_my_app !== null) {
  32815.             $queryParams['createdByMyApp'] = $created_by_my_app 'true' 'false';
  32816.         }
  32817.         // query params
  32818.         if ($unitdp !== null) {
  32819.             $queryParams['unitdp'] = AccountingObjectSerializer::toQueryValue($unitdp);
  32820.         }
  32821.         // query params
  32822.         if ($summary_only !== null) {
  32823.             $queryParams['summaryOnly'] = $summary_only 'true' 'false';
  32824.         }
  32825.         // header params
  32826.         if ($xero_tenant_id !== null) {
  32827.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  32828.         }
  32829.         // header params
  32830.         if ($if_modified_since !== null) {
  32831.             $headerParams['If-Modified-Since'] = AccountingObjectSerializer::toHeaderValue($if_modified_since);
  32832.         }
  32833.         // body params
  32834.         $_tempBody null;
  32835.         if ($multipart) {
  32836.             $headers $this->headerSelector->selectHeadersForMultipart(
  32837.                 ['application/json']
  32838.             );
  32839.         } else {
  32840.             $headers $this->headerSelector->selectHeaders(
  32841.                 ['application/json'],
  32842.                 []
  32843.             );
  32844.         }
  32845.         // for model (json/xml)
  32846.         if (isset($_tempBody)) {
  32847.             // $_tempBody is the method argument, if present
  32848.             if ($headers['Content-Type'] === 'application/json') {
  32849.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  32850.             } else {
  32851.                 $httpBody $_tempBody;
  32852.             }
  32853.         } elseif (count($formParams) > 0) {
  32854.             if ($multipart) {
  32855.                 $multipartContents = [
  32856.                     [
  32857.                         'Content-type' => 'multipart/form-data',
  32858.                     ]
  32859.                 ];
  32860.                 
  32861.                 // for HTTP post (form)
  32862.                 $httpBody = new MultipartStream($multipartContents);
  32863.             } elseif ($headers['Content-Type'] === 'application/json') {
  32864.                 $httpBody \GuzzleHttp\json_encode($formParams);
  32865.             } else {
  32866.                 // for HTTP post (form)
  32867.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  32868.             }
  32869.         }
  32870.         // this endpoint requires OAuth (access token)
  32871.         if ($this->config->getAccessToken() !== null) {
  32872.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  32873.         }
  32874.         $defaultHeaders = [];
  32875.         if ($this->config->getUserAgent()) {
  32876.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  32877.         }
  32878.         $headers array_merge(
  32879.             $defaultHeaders,
  32880.             $headerParams,
  32881.             $headers
  32882.         );
  32883.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  32884.         return new Request(
  32885.             'GET',
  32886.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  32887.             $headers,
  32888.             $httpBody
  32889.         );
  32890.     }
  32891.     /**
  32892.      * Operation getItem
  32893.      * Retrieves a specific item using a unique item Id
  32894.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  32895.      * @param  string $item_id Unique identifier for an Item (required)
  32896.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  32897.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  32898.      * @throws \InvalidArgumentException
  32899.      * @return \XeroAPI\XeroPHP\Models\Accounting\Items
  32900.      */
  32901.     public function getItem($xero_tenant_id$item_id$unitdp null)
  32902.     {
  32903.         list($response) = $this->getItemWithHttpInfo($xero_tenant_id$item_id$unitdp);
  32904.         return $response;
  32905.     }
  32906.     /**
  32907.      * Operation getItemWithHttpInfo
  32908.      * Retrieves a specific item using a unique item Id
  32909.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  32910.      * @param  string $item_id Unique identifier for an Item (required)
  32911.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  32912.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  32913.      * @throws \InvalidArgumentException
  32914.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Items, HTTP status code, HTTP response headers (array of strings)
  32915.      */
  32916.     public function getItemWithHttpInfo($xero_tenant_id$item_id$unitdp null)
  32917.     {
  32918.         $request $this->getItemRequest($xero_tenant_id$item_id$unitdp);
  32919.         try {
  32920.             $options $this->createHttpClientOption();
  32921.             try {
  32922.                 $response $this->client->send($request$options);
  32923.             } catch (RequestException $e) {
  32924.                 throw new ApiException(
  32925.                     "[{$e->getCode()}{$e->getMessage()}",
  32926.                     $e->getCode(),
  32927.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  32928.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  32929.                 );
  32930.             }
  32931.             $statusCode $response->getStatusCode();
  32932.             if ($statusCode 200 || $statusCode 299) {
  32933.                 throw new ApiException(
  32934.                     sprintf(
  32935.                         '[%d] Error connecting to the API (%s)',
  32936.                         $statusCode,
  32937.                         $request->getUri()
  32938.                     ),
  32939.                     $statusCode,
  32940.                     $response->getHeaders(),
  32941.                     $response->getBody()
  32942.                 );
  32943.             }
  32944.             $responseBody $response->getBody();
  32945.             switch($statusCode) {
  32946.                 case 200:
  32947.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Items' === '\SplFileObject') {
  32948.                         $content $responseBody//stream goes to serializer
  32949.                     } else {
  32950.                         $content $responseBody->getContents();
  32951.                     }
  32952.                     return [
  32953.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Items', []),
  32954.                         $response->getStatusCode(),
  32955.                         $response->getHeaders()
  32956.                     ];
  32957.             }
  32958.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Items';
  32959.             $responseBody $response->getBody();
  32960.             if ($returnType === '\SplFileObject') {
  32961.                 $content $responseBody//stream goes to serializer
  32962.             } else {
  32963.                 $content $responseBody->getContents();
  32964.             }
  32965.             return [
  32966.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  32967.                 $response->getStatusCode(),
  32968.                 $response->getHeaders()
  32969.             ];
  32970.         } catch (ApiException $e) {
  32971.             switch ($e->getCode()) {
  32972.                 case 200:
  32973.                     $data AccountingObjectSerializer::deserialize(
  32974.                         $e->getResponseBody(),
  32975.                         '\XeroAPI\XeroPHP\Models\Accounting\Items',
  32976.                         $e->getResponseHeaders()
  32977.                     );
  32978.                     $e->setResponseObject($data);
  32979.                     break;
  32980.             }
  32981.             throw $e;
  32982.         }
  32983.     }
  32984.     /**
  32985.      * Operation getItemAsync
  32986.      * Retrieves a specific item using a unique item Id
  32987.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  32988.      * @param  string $item_id Unique identifier for an Item (required)
  32989.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  32990.      * @throws \InvalidArgumentException
  32991.      * @return \GuzzleHttp\Promise\PromiseInterface
  32992.      */
  32993.     public function getItemAsync($xero_tenant_id$item_id$unitdp null)
  32994.     {
  32995.         return $this->getItemAsyncWithHttpInfo($xero_tenant_id$item_id$unitdp)
  32996.             ->then(
  32997.                 function ($response) {
  32998.                     return $response[0];
  32999.                 }
  33000.             );
  33001.     }
  33002.     /**
  33003.      * Operation getItemAsyncWithHttpInfo
  33004.      * Retrieves a specific item using a unique item Id
  33005.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  33006.      * @param  string $item_id Unique identifier for an Item (required)
  33007.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  33008.      * @throws \InvalidArgumentException
  33009.      * @return \GuzzleHttp\Promise\PromiseInterface */
  33010.     public function getItemAsyncWithHttpInfo($xero_tenant_id$item_id$unitdp null)
  33011.     {
  33012.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Items';
  33013.         $request $this->getItemRequest($xero_tenant_id$item_id$unitdp);
  33014.         return $this->client
  33015.             ->sendAsync($request$this->createHttpClientOption())
  33016.             ->then(
  33017.                 function ($response) use ($returnType) {
  33018.                     $responseBody $response->getBody();
  33019.                     if ($returnType === '\SplFileObject') {
  33020.                         $content $responseBody//stream goes to serializer
  33021.                     } else {
  33022.                         $content $responseBody->getContents();
  33023.                     }
  33024.                     return [
  33025.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  33026.                         $response->getStatusCode(),
  33027.                         $response->getHeaders()
  33028.                     ];
  33029.                 },
  33030.                 function ($exception) {
  33031.                     $response $exception->getResponse();
  33032.                     $statusCode $response->getStatusCode();
  33033.                     throw new ApiException(
  33034.                         sprintf(
  33035.                             '[%d] Error connecting to the API (%s)',
  33036.                             $statusCode,
  33037.                             $exception->getRequest()->getUri()
  33038.                         ),
  33039.                         $statusCode,
  33040.                         $response->getHeaders(),
  33041.                         $response->getBody()
  33042.                     );
  33043.                 }
  33044.             );
  33045.     }
  33046.     /**
  33047.      * Create request for operation 'getItem'
  33048.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  33049.      * @param  string $item_id Unique identifier for an Item (required)
  33050.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  33051.      * @throws \InvalidArgumentException
  33052.      * @return \GuzzleHttp\Psr7\Request  */
  33053.     protected function getItemRequest($xero_tenant_id$item_id$unitdp null)
  33054.     {
  33055.         // verify the required parameter 'xero_tenant_id' is set
  33056.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  33057.             throw new \InvalidArgumentException(
  33058.                 'Missing the required parameter $xero_tenant_id when calling getItem'
  33059.             );
  33060.         }
  33061.         // verify the required parameter 'item_id' is set
  33062.         if ($item_id === null || (is_array($item_id) && count($item_id) === 0)) {
  33063.             throw new \InvalidArgumentException(
  33064.                 'Missing the required parameter $item_id when calling getItem'
  33065.             );
  33066.         }
  33067.         $resourcePath '/Items/{ItemID}';
  33068.         $formParams = [];
  33069.         $queryParams = [];
  33070.         $headerParams = [];
  33071.         $httpBody '';
  33072.         $multipart false;
  33073.         // query params
  33074.         if ($unitdp !== null) {
  33075.             $queryParams['unitdp'] = AccountingObjectSerializer::toQueryValue($unitdp);
  33076.         }
  33077.         // header params
  33078.         if ($xero_tenant_id !== null) {
  33079.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  33080.         }
  33081.         // path params
  33082.         if ($item_id !== null) {
  33083.             $resourcePath str_replace(
  33084.                 '{' 'ItemID' '}',
  33085.                 AccountingObjectSerializer::toPathValue($item_id),
  33086.                 $resourcePath
  33087.             );
  33088.         }
  33089.         // body params
  33090.         $_tempBody null;
  33091.         if ($multipart) {
  33092.             $headers $this->headerSelector->selectHeadersForMultipart(
  33093.                 ['application/json']
  33094.             );
  33095.         } else {
  33096.             $headers $this->headerSelector->selectHeaders(
  33097.                 ['application/json'],
  33098.                 []
  33099.             );
  33100.         }
  33101.         // for model (json/xml)
  33102.         if (isset($_tempBody)) {
  33103.             // $_tempBody is the method argument, if present
  33104.             if ($headers['Content-Type'] === 'application/json') {
  33105.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  33106.             } else {
  33107.                 $httpBody $_tempBody;
  33108.             }
  33109.         } elseif (count($formParams) > 0) {
  33110.             if ($multipart) {
  33111.                 $multipartContents = [
  33112.                     [
  33113.                         'Content-type' => 'multipart/form-data',
  33114.                     ]
  33115.                 ];
  33116.                 
  33117.                 // for HTTP post (form)
  33118.                 $httpBody = new MultipartStream($multipartContents);
  33119.             } elseif ($headers['Content-Type'] === 'application/json') {
  33120.                 $httpBody \GuzzleHttp\json_encode($formParams);
  33121.             } else {
  33122.                 // for HTTP post (form)
  33123.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  33124.             }
  33125.         }
  33126.         // this endpoint requires OAuth (access token)
  33127.         if ($this->config->getAccessToken() !== null) {
  33128.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  33129.         }
  33130.         $defaultHeaders = [];
  33131.         if ($this->config->getUserAgent()) {
  33132.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  33133.         }
  33134.         $headers array_merge(
  33135.             $defaultHeaders,
  33136.             $headerParams,
  33137.             $headers
  33138.         );
  33139.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  33140.         return new Request(
  33141.             'GET',
  33142.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  33143.             $headers,
  33144.             $httpBody
  33145.         );
  33146.     }
  33147.     /**
  33148.      * Operation getItemHistory
  33149.      * Retrieves history for a specific item
  33150.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  33151.      * @param  string $item_id Unique identifier for an Item (required)
  33152.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  33153.      * @throws \InvalidArgumentException
  33154.      * @return \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords
  33155.      */
  33156.     public function getItemHistory($xero_tenant_id$item_id)
  33157.     {
  33158.         list($response) = $this->getItemHistoryWithHttpInfo($xero_tenant_id$item_id);
  33159.         return $response;
  33160.     }
  33161.     /**
  33162.      * Operation getItemHistoryWithHttpInfo
  33163.      * Retrieves history for a specific item
  33164.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  33165.      * @param  string $item_id Unique identifier for an Item (required)
  33166.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  33167.      * @throws \InvalidArgumentException
  33168.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords, HTTP status code, HTTP response headers (array of strings)
  33169.      */
  33170.     public function getItemHistoryWithHttpInfo($xero_tenant_id$item_id)
  33171.     {
  33172.         $request $this->getItemHistoryRequest($xero_tenant_id$item_id);
  33173.         try {
  33174.             $options $this->createHttpClientOption();
  33175.             try {
  33176.                 $response $this->client->send($request$options);
  33177.             } catch (RequestException $e) {
  33178.                 throw new ApiException(
  33179.                     "[{$e->getCode()}{$e->getMessage()}",
  33180.                     $e->getCode(),
  33181.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  33182.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  33183.                 );
  33184.             }
  33185.             $statusCode $response->getStatusCode();
  33186.             if ($statusCode 200 || $statusCode 299) {
  33187.                 throw new ApiException(
  33188.                     sprintf(
  33189.                         '[%d] Error connecting to the API (%s)',
  33190.                         $statusCode,
  33191.                         $request->getUri()
  33192.                     ),
  33193.                     $statusCode,
  33194.                     $response->getHeaders(),
  33195.                     $response->getBody()
  33196.                 );
  33197.             }
  33198.             $responseBody $response->getBody();
  33199.             switch($statusCode) {
  33200.                 case 200:
  33201.                     if ('\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords' === '\SplFileObject') {
  33202.                         $content $responseBody//stream goes to serializer
  33203.                     } else {
  33204.                         $content $responseBody->getContents();
  33205.                     }
  33206.                     return [
  33207.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords', []),
  33208.                         $response->getStatusCode(),
  33209.                         $response->getHeaders()
  33210.                     ];
  33211.             }
  33212.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  33213.             $responseBody $response->getBody();
  33214.             if ($returnType === '\SplFileObject') {
  33215.                 $content $responseBody//stream goes to serializer
  33216.             } else {
  33217.                 $content $responseBody->getContents();
  33218.             }
  33219.             return [
  33220.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  33221.                 $response->getStatusCode(),
  33222.                 $response->getHeaders()
  33223.             ];
  33224.         } catch (ApiException $e) {
  33225.             switch ($e->getCode()) {
  33226.                 case 200:
  33227.                     $data AccountingObjectSerializer::deserialize(
  33228.                         $e->getResponseBody(),
  33229.                         '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords',
  33230.                         $e->getResponseHeaders()
  33231.                     );
  33232.                     $e->setResponseObject($data);
  33233.                     break;
  33234.             }
  33235.             throw $e;
  33236.         }
  33237.     }
  33238.     /**
  33239.      * Operation getItemHistoryAsync
  33240.      * Retrieves history for a specific item
  33241.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  33242.      * @param  string $item_id Unique identifier for an Item (required)
  33243.      * @throws \InvalidArgumentException
  33244.      * @return \GuzzleHttp\Promise\PromiseInterface
  33245.      */
  33246.     public function getItemHistoryAsync($xero_tenant_id$item_id)
  33247.     {
  33248.         return $this->getItemHistoryAsyncWithHttpInfo($xero_tenant_id$item_id)
  33249.             ->then(
  33250.                 function ($response) {
  33251.                     return $response[0];
  33252.                 }
  33253.             );
  33254.     }
  33255.     /**
  33256.      * Operation getItemHistoryAsyncWithHttpInfo
  33257.      * Retrieves history for a specific item
  33258.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  33259.      * @param  string $item_id Unique identifier for an Item (required)
  33260.      * @throws \InvalidArgumentException
  33261.      * @return \GuzzleHttp\Promise\PromiseInterface */
  33262.     public function getItemHistoryAsyncWithHttpInfo($xero_tenant_id$item_id)
  33263.     {
  33264.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  33265.         $request $this->getItemHistoryRequest($xero_tenant_id$item_id);
  33266.         return $this->client
  33267.             ->sendAsync($request$this->createHttpClientOption())
  33268.             ->then(
  33269.                 function ($response) use ($returnType) {
  33270.                     $responseBody $response->getBody();
  33271.                     if ($returnType === '\SplFileObject') {
  33272.                         $content $responseBody//stream goes to serializer
  33273.                     } else {
  33274.                         $content $responseBody->getContents();
  33275.                     }
  33276.                     return [
  33277.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  33278.                         $response->getStatusCode(),
  33279.                         $response->getHeaders()
  33280.                     ];
  33281.                 },
  33282.                 function ($exception) {
  33283.                     $response $exception->getResponse();
  33284.                     $statusCode $response->getStatusCode();
  33285.                     throw new ApiException(
  33286.                         sprintf(
  33287.                             '[%d] Error connecting to the API (%s)',
  33288.                             $statusCode,
  33289.                             $exception->getRequest()->getUri()
  33290.                         ),
  33291.                         $statusCode,
  33292.                         $response->getHeaders(),
  33293.                         $response->getBody()
  33294.                     );
  33295.                 }
  33296.             );
  33297.     }
  33298.     /**
  33299.      * Create request for operation 'getItemHistory'
  33300.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  33301.      * @param  string $item_id Unique identifier for an Item (required)
  33302.      * @throws \InvalidArgumentException
  33303.      * @return \GuzzleHttp\Psr7\Request  */
  33304.     protected function getItemHistoryRequest($xero_tenant_id$item_id)
  33305.     {
  33306.         // verify the required parameter 'xero_tenant_id' is set
  33307.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  33308.             throw new \InvalidArgumentException(
  33309.                 'Missing the required parameter $xero_tenant_id when calling getItemHistory'
  33310.             );
  33311.         }
  33312.         // verify the required parameter 'item_id' is set
  33313.         if ($item_id === null || (is_array($item_id) && count($item_id) === 0)) {
  33314.             throw new \InvalidArgumentException(
  33315.                 'Missing the required parameter $item_id when calling getItemHistory'
  33316.             );
  33317.         }
  33318.         $resourcePath '/Items/{ItemID}/History';
  33319.         $formParams = [];
  33320.         $queryParams = [];
  33321.         $headerParams = [];
  33322.         $httpBody '';
  33323.         $multipart false;
  33324.         // header params
  33325.         if ($xero_tenant_id !== null) {
  33326.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  33327.         }
  33328.         // path params
  33329.         if ($item_id !== null) {
  33330.             $resourcePath str_replace(
  33331.                 '{' 'ItemID' '}',
  33332.                 AccountingObjectSerializer::toPathValue($item_id),
  33333.                 $resourcePath
  33334.             );
  33335.         }
  33336.         // body params
  33337.         $_tempBody null;
  33338.         if ($multipart) {
  33339.             $headers $this->headerSelector->selectHeadersForMultipart(
  33340.                 ['application/json']
  33341.             );
  33342.         } else {
  33343.             $headers $this->headerSelector->selectHeaders(
  33344.                 ['application/json'],
  33345.                 []
  33346.             );
  33347.         }
  33348.         // for model (json/xml)
  33349.         if (isset($_tempBody)) {
  33350.             // $_tempBody is the method argument, if present
  33351.             if ($headers['Content-Type'] === 'application/json') {
  33352.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  33353.             } else {
  33354.                 $httpBody $_tempBody;
  33355.             }
  33356.         } elseif (count($formParams) > 0) {
  33357.             if ($multipart) {
  33358.                 $multipartContents = [
  33359.                     [
  33360.                         'Content-type' => 'multipart/form-data',
  33361.                     ]
  33362.                 ];
  33363.                 
  33364.                 // for HTTP post (form)
  33365.                 $httpBody = new MultipartStream($multipartContents);
  33366.             } elseif ($headers['Content-Type'] === 'application/json') {
  33367.                 $httpBody \GuzzleHttp\json_encode($formParams);
  33368.             } else {
  33369.                 // for HTTP post (form)
  33370.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  33371.             }
  33372.         }
  33373.         // this endpoint requires OAuth (access token)
  33374.         if ($this->config->getAccessToken() !== null) {
  33375.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  33376.         }
  33377.         $defaultHeaders = [];
  33378.         if ($this->config->getUserAgent()) {
  33379.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  33380.         }
  33381.         $headers array_merge(
  33382.             $defaultHeaders,
  33383.             $headerParams,
  33384.             $headers
  33385.         );
  33386.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  33387.         return new Request(
  33388.             'GET',
  33389.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  33390.             $headers,
  33391.             $httpBody
  33392.         );
  33393.     }
  33394.     /**
  33395.      * Operation getItems
  33396.      * Retrieves items
  33397.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  33398.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  33399.      * @param  string $where Filter by an any element (optional)
  33400.      * @param  string $order Order by an any element (optional)
  33401.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  33402.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  33403.      * @throws \InvalidArgumentException
  33404.      * @return \XeroAPI\XeroPHP\Models\Accounting\Items
  33405.      */
  33406.     public function getItems($xero_tenant_id$if_modified_since null$where null$order null$unitdp null)
  33407.     {
  33408.         list($response) = $this->getItemsWithHttpInfo($xero_tenant_id$if_modified_since$where$order$unitdp);
  33409.         return $response;
  33410.     }
  33411.     /**
  33412.      * Operation getItemsWithHttpInfo
  33413.      * Retrieves items
  33414.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  33415.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  33416.      * @param  string $where Filter by an any element (optional)
  33417.      * @param  string $order Order by an any element (optional)
  33418.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  33419.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  33420.      * @throws \InvalidArgumentException
  33421.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Items, HTTP status code, HTTP response headers (array of strings)
  33422.      */
  33423.     public function getItemsWithHttpInfo($xero_tenant_id$if_modified_since null$where null$order null$unitdp null)
  33424.     {
  33425.         $request $this->getItemsRequest($xero_tenant_id$if_modified_since$where$order$unitdp);
  33426.         try {
  33427.             $options $this->createHttpClientOption();
  33428.             try {
  33429.                 $response $this->client->send($request$options);
  33430.             } catch (RequestException $e) {
  33431.                 throw new ApiException(
  33432.                     "[{$e->getCode()}{$e->getMessage()}",
  33433.                     $e->getCode(),
  33434.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  33435.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  33436.                 );
  33437.             }
  33438.             $statusCode $response->getStatusCode();
  33439.             if ($statusCode 200 || $statusCode 299) {
  33440.                 throw new ApiException(
  33441.                     sprintf(
  33442.                         '[%d] Error connecting to the API (%s)',
  33443.                         $statusCode,
  33444.                         $request->getUri()
  33445.                     ),
  33446.                     $statusCode,
  33447.                     $response->getHeaders(),
  33448.                     $response->getBody()
  33449.                 );
  33450.             }
  33451.             $responseBody $response->getBody();
  33452.             switch($statusCode) {
  33453.                 case 200:
  33454.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Items' === '\SplFileObject') {
  33455.                         $content $responseBody//stream goes to serializer
  33456.                     } else {
  33457.                         $content $responseBody->getContents();
  33458.                     }
  33459.                     return [
  33460.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Items', []),
  33461.                         $response->getStatusCode(),
  33462.                         $response->getHeaders()
  33463.                     ];
  33464.             }
  33465.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Items';
  33466.             $responseBody $response->getBody();
  33467.             if ($returnType === '\SplFileObject') {
  33468.                 $content $responseBody//stream goes to serializer
  33469.             } else {
  33470.                 $content $responseBody->getContents();
  33471.             }
  33472.             return [
  33473.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  33474.                 $response->getStatusCode(),
  33475.                 $response->getHeaders()
  33476.             ];
  33477.         } catch (ApiException $e) {
  33478.             switch ($e->getCode()) {
  33479.                 case 200:
  33480.                     $data AccountingObjectSerializer::deserialize(
  33481.                         $e->getResponseBody(),
  33482.                         '\XeroAPI\XeroPHP\Models\Accounting\Items',
  33483.                         $e->getResponseHeaders()
  33484.                     );
  33485.                     $e->setResponseObject($data);
  33486.                     break;
  33487.             }
  33488.             throw $e;
  33489.         }
  33490.     }
  33491.     /**
  33492.      * Operation getItemsAsync
  33493.      * Retrieves items
  33494.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  33495.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  33496.      * @param  string $where Filter by an any element (optional)
  33497.      * @param  string $order Order by an any element (optional)
  33498.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  33499.      * @throws \InvalidArgumentException
  33500.      * @return \GuzzleHttp\Promise\PromiseInterface
  33501.      */
  33502.     public function getItemsAsync($xero_tenant_id$if_modified_since null$where null$order null$unitdp null)
  33503.     {
  33504.         return $this->getItemsAsyncWithHttpInfo($xero_tenant_id$if_modified_since$where$order$unitdp)
  33505.             ->then(
  33506.                 function ($response) {
  33507.                     return $response[0];
  33508.                 }
  33509.             );
  33510.     }
  33511.     /**
  33512.      * Operation getItemsAsyncWithHttpInfo
  33513.      * Retrieves items
  33514.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  33515.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  33516.      * @param  string $where Filter by an any element (optional)
  33517.      * @param  string $order Order by an any element (optional)
  33518.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  33519.      * @throws \InvalidArgumentException
  33520.      * @return \GuzzleHttp\Promise\PromiseInterface */
  33521.     public function getItemsAsyncWithHttpInfo($xero_tenant_id$if_modified_since null$where null$order null$unitdp null)
  33522.     {
  33523.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Items';
  33524.         $request $this->getItemsRequest($xero_tenant_id$if_modified_since$where$order$unitdp);
  33525.         return $this->client
  33526.             ->sendAsync($request$this->createHttpClientOption())
  33527.             ->then(
  33528.                 function ($response) use ($returnType) {
  33529.                     $responseBody $response->getBody();
  33530.                     if ($returnType === '\SplFileObject') {
  33531.                         $content $responseBody//stream goes to serializer
  33532.                     } else {
  33533.                         $content $responseBody->getContents();
  33534.                     }
  33535.                     return [
  33536.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  33537.                         $response->getStatusCode(),
  33538.                         $response->getHeaders()
  33539.                     ];
  33540.                 },
  33541.                 function ($exception) {
  33542.                     $response $exception->getResponse();
  33543.                     $statusCode $response->getStatusCode();
  33544.                     throw new ApiException(
  33545.                         sprintf(
  33546.                             '[%d] Error connecting to the API (%s)',
  33547.                             $statusCode,
  33548.                             $exception->getRequest()->getUri()
  33549.                         ),
  33550.                         $statusCode,
  33551.                         $response->getHeaders(),
  33552.                         $response->getBody()
  33553.                     );
  33554.                 }
  33555.             );
  33556.     }
  33557.     /**
  33558.      * Create request for operation 'getItems'
  33559.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  33560.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  33561.      * @param  string $where Filter by an any element (optional)
  33562.      * @param  string $order Order by an any element (optional)
  33563.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  33564.      * @throws \InvalidArgumentException
  33565.      * @return \GuzzleHttp\Psr7\Request  */
  33566.     protected function getItemsRequest($xero_tenant_id$if_modified_since null$where null$order null$unitdp null)
  33567.     {
  33568.         // verify the required parameter 'xero_tenant_id' is set
  33569.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  33570.             throw new \InvalidArgumentException(
  33571.                 'Missing the required parameter $xero_tenant_id when calling getItems'
  33572.             );
  33573.         }
  33574.         $resourcePath '/Items';
  33575.         $formParams = [];
  33576.         $queryParams = [];
  33577.         $headerParams = [];
  33578.         $httpBody '';
  33579.         $multipart false;
  33580.         // query params
  33581.         if ($where !== null) {
  33582.             $queryParams['where'] = AccountingObjectSerializer::toQueryValue($where);
  33583.         }
  33584.         // query params
  33585.         if ($order !== null) {
  33586.             $queryParams['order'] = AccountingObjectSerializer::toQueryValue($order);
  33587.         }
  33588.         // query params
  33589.         if ($unitdp !== null) {
  33590.             $queryParams['unitdp'] = AccountingObjectSerializer::toQueryValue($unitdp);
  33591.         }
  33592.         // header params
  33593.         if ($xero_tenant_id !== null) {
  33594.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  33595.         }
  33596.         // header params
  33597.         if ($if_modified_since !== null) {
  33598.             $headerParams['If-Modified-Since'] = AccountingObjectSerializer::toHeaderValue($if_modified_since);
  33599.         }
  33600.         // body params
  33601.         $_tempBody null;
  33602.         if ($multipart) {
  33603.             $headers $this->headerSelector->selectHeadersForMultipart(
  33604.                 ['application/json']
  33605.             );
  33606.         } else {
  33607.             $headers $this->headerSelector->selectHeaders(
  33608.                 ['application/json'],
  33609.                 []
  33610.             );
  33611.         }
  33612.         // for model (json/xml)
  33613.         if (isset($_tempBody)) {
  33614.             // $_tempBody is the method argument, if present
  33615.             if ($headers['Content-Type'] === 'application/json') {
  33616.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  33617.             } else {
  33618.                 $httpBody $_tempBody;
  33619.             }
  33620.         } elseif (count($formParams) > 0) {
  33621.             if ($multipart) {
  33622.                 $multipartContents = [
  33623.                     [
  33624.                         'Content-type' => 'multipart/form-data',
  33625.                     ]
  33626.                 ];
  33627.                 
  33628.                 // for HTTP post (form)
  33629.                 $httpBody = new MultipartStream($multipartContents);
  33630.             } elseif ($headers['Content-Type'] === 'application/json') {
  33631.                 $httpBody \GuzzleHttp\json_encode($formParams);
  33632.             } else {
  33633.                 // for HTTP post (form)
  33634.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  33635.             }
  33636.         }
  33637.         // this endpoint requires OAuth (access token)
  33638.         if ($this->config->getAccessToken() !== null) {
  33639.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  33640.         }
  33641.         $defaultHeaders = [];
  33642.         if ($this->config->getUserAgent()) {
  33643.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  33644.         }
  33645.         $headers array_merge(
  33646.             $defaultHeaders,
  33647.             $headerParams,
  33648.             $headers
  33649.         );
  33650.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  33651.         return new Request(
  33652.             'GET',
  33653.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  33654.             $headers,
  33655.             $httpBody
  33656.         );
  33657.     }
  33658.     /**
  33659.      * Operation getJournal
  33660.      * Retrieves a specific journal using a unique journal Id.
  33661.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  33662.      * @param  string $journal_id Unique identifier for a Journal (required)
  33663.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  33664.      * @throws \InvalidArgumentException
  33665.      * @return \XeroAPI\XeroPHP\Models\Accounting\Journals
  33666.      */
  33667.     public function getJournal($xero_tenant_id$journal_id)
  33668.     {
  33669.         list($response) = $this->getJournalWithHttpInfo($xero_tenant_id$journal_id);
  33670.         return $response;
  33671.     }
  33672.     /**
  33673.      * Operation getJournalWithHttpInfo
  33674.      * Retrieves a specific journal using a unique journal Id.
  33675.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  33676.      * @param  string $journal_id Unique identifier for a Journal (required)
  33677.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  33678.      * @throws \InvalidArgumentException
  33679.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Journals, HTTP status code, HTTP response headers (array of strings)
  33680.      */
  33681.     public function getJournalWithHttpInfo($xero_tenant_id$journal_id)
  33682.     {
  33683.         $request $this->getJournalRequest($xero_tenant_id$journal_id);
  33684.         try {
  33685.             $options $this->createHttpClientOption();
  33686.             try {
  33687.                 $response $this->client->send($request$options);
  33688.             } catch (RequestException $e) {
  33689.                 throw new ApiException(
  33690.                     "[{$e->getCode()}{$e->getMessage()}",
  33691.                     $e->getCode(),
  33692.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  33693.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  33694.                 );
  33695.             }
  33696.             $statusCode $response->getStatusCode();
  33697.             if ($statusCode 200 || $statusCode 299) {
  33698.                 throw new ApiException(
  33699.                     sprintf(
  33700.                         '[%d] Error connecting to the API (%s)',
  33701.                         $statusCode,
  33702.                         $request->getUri()
  33703.                     ),
  33704.                     $statusCode,
  33705.                     $response->getHeaders(),
  33706.                     $response->getBody()
  33707.                 );
  33708.             }
  33709.             $responseBody $response->getBody();
  33710.             switch($statusCode) {
  33711.                 case 200:
  33712.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Journals' === '\SplFileObject') {
  33713.                         $content $responseBody//stream goes to serializer
  33714.                     } else {
  33715.                         $content $responseBody->getContents();
  33716.                     }
  33717.                     return [
  33718.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Journals', []),
  33719.                         $response->getStatusCode(),
  33720.                         $response->getHeaders()
  33721.                     ];
  33722.             }
  33723.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Journals';
  33724.             $responseBody $response->getBody();
  33725.             if ($returnType === '\SplFileObject') {
  33726.                 $content $responseBody//stream goes to serializer
  33727.             } else {
  33728.                 $content $responseBody->getContents();
  33729.             }
  33730.             return [
  33731.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  33732.                 $response->getStatusCode(),
  33733.                 $response->getHeaders()
  33734.             ];
  33735.         } catch (ApiException $e) {
  33736.             switch ($e->getCode()) {
  33737.                 case 200:
  33738.                     $data AccountingObjectSerializer::deserialize(
  33739.                         $e->getResponseBody(),
  33740.                         '\XeroAPI\XeroPHP\Models\Accounting\Journals',
  33741.                         $e->getResponseHeaders()
  33742.                     );
  33743.                     $e->setResponseObject($data);
  33744.                     break;
  33745.             }
  33746.             throw $e;
  33747.         }
  33748.     }
  33749.     /**
  33750.      * Operation getJournalAsync
  33751.      * Retrieves a specific journal using a unique journal Id.
  33752.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  33753.      * @param  string $journal_id Unique identifier for a Journal (required)
  33754.      * @throws \InvalidArgumentException
  33755.      * @return \GuzzleHttp\Promise\PromiseInterface
  33756.      */
  33757.     public function getJournalAsync($xero_tenant_id$journal_id)
  33758.     {
  33759.         return $this->getJournalAsyncWithHttpInfo($xero_tenant_id$journal_id)
  33760.             ->then(
  33761.                 function ($response) {
  33762.                     return $response[0];
  33763.                 }
  33764.             );
  33765.     }
  33766.     /**
  33767.      * Operation getJournalAsyncWithHttpInfo
  33768.      * Retrieves a specific journal using a unique journal Id.
  33769.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  33770.      * @param  string $journal_id Unique identifier for a Journal (required)
  33771.      * @throws \InvalidArgumentException
  33772.      * @return \GuzzleHttp\Promise\PromiseInterface */
  33773.     public function getJournalAsyncWithHttpInfo($xero_tenant_id$journal_id)
  33774.     {
  33775.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Journals';
  33776.         $request $this->getJournalRequest($xero_tenant_id$journal_id);
  33777.         return $this->client
  33778.             ->sendAsync($request$this->createHttpClientOption())
  33779.             ->then(
  33780.                 function ($response) use ($returnType) {
  33781.                     $responseBody $response->getBody();
  33782.                     if ($returnType === '\SplFileObject') {
  33783.                         $content $responseBody//stream goes to serializer
  33784.                     } else {
  33785.                         $content $responseBody->getContents();
  33786.                     }
  33787.                     return [
  33788.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  33789.                         $response->getStatusCode(),
  33790.                         $response->getHeaders()
  33791.                     ];
  33792.                 },
  33793.                 function ($exception) {
  33794.                     $response $exception->getResponse();
  33795.                     $statusCode $response->getStatusCode();
  33796.                     throw new ApiException(
  33797.                         sprintf(
  33798.                             '[%d] Error connecting to the API (%s)',
  33799.                             $statusCode,
  33800.                             $exception->getRequest()->getUri()
  33801.                         ),
  33802.                         $statusCode,
  33803.                         $response->getHeaders(),
  33804.                         $response->getBody()
  33805.                     );
  33806.                 }
  33807.             );
  33808.     }
  33809.     /**
  33810.      * Create request for operation 'getJournal'
  33811.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  33812.      * @param  string $journal_id Unique identifier for a Journal (required)
  33813.      * @throws \InvalidArgumentException
  33814.      * @return \GuzzleHttp\Psr7\Request  */
  33815.     protected function getJournalRequest($xero_tenant_id$journal_id)
  33816.     {
  33817.         // verify the required parameter 'xero_tenant_id' is set
  33818.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  33819.             throw new \InvalidArgumentException(
  33820.                 'Missing the required parameter $xero_tenant_id when calling getJournal'
  33821.             );
  33822.         }
  33823.         // verify the required parameter 'journal_id' is set
  33824.         if ($journal_id === null || (is_array($journal_id) && count($journal_id) === 0)) {
  33825.             throw new \InvalidArgumentException(
  33826.                 'Missing the required parameter $journal_id when calling getJournal'
  33827.             );
  33828.         }
  33829.         $resourcePath '/Journals/{JournalID}';
  33830.         $formParams = [];
  33831.         $queryParams = [];
  33832.         $headerParams = [];
  33833.         $httpBody '';
  33834.         $multipart false;
  33835.         // header params
  33836.         if ($xero_tenant_id !== null) {
  33837.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  33838.         }
  33839.         // path params
  33840.         if ($journal_id !== null) {
  33841.             $resourcePath str_replace(
  33842.                 '{' 'JournalID' '}',
  33843.                 AccountingObjectSerializer::toPathValue($journal_id),
  33844.                 $resourcePath
  33845.             );
  33846.         }
  33847.         // body params
  33848.         $_tempBody null;
  33849.         if ($multipart) {
  33850.             $headers $this->headerSelector->selectHeadersForMultipart(
  33851.                 ['application/json']
  33852.             );
  33853.         } else {
  33854.             $headers $this->headerSelector->selectHeaders(
  33855.                 ['application/json'],
  33856.                 []
  33857.             );
  33858.         }
  33859.         // for model (json/xml)
  33860.         if (isset($_tempBody)) {
  33861.             // $_tempBody is the method argument, if present
  33862.             if ($headers['Content-Type'] === 'application/json') {
  33863.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  33864.             } else {
  33865.                 $httpBody $_tempBody;
  33866.             }
  33867.         } elseif (count($formParams) > 0) {
  33868.             if ($multipart) {
  33869.                 $multipartContents = [
  33870.                     [
  33871.                         'Content-type' => 'multipart/form-data',
  33872.                     ]
  33873.                 ];
  33874.                 
  33875.                 // for HTTP post (form)
  33876.                 $httpBody = new MultipartStream($multipartContents);
  33877.             } elseif ($headers['Content-Type'] === 'application/json') {
  33878.                 $httpBody \GuzzleHttp\json_encode($formParams);
  33879.             } else {
  33880.                 // for HTTP post (form)
  33881.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  33882.             }
  33883.         }
  33884.         // this endpoint requires OAuth (access token)
  33885.         if ($this->config->getAccessToken() !== null) {
  33886.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  33887.         }
  33888.         $defaultHeaders = [];
  33889.         if ($this->config->getUserAgent()) {
  33890.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  33891.         }
  33892.         $headers array_merge(
  33893.             $defaultHeaders,
  33894.             $headerParams,
  33895.             $headers
  33896.         );
  33897.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  33898.         return new Request(
  33899.             'GET',
  33900.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  33901.             $headers,
  33902.             $httpBody
  33903.         );
  33904.     }
  33905.     /**
  33906.      * Operation getJournalByNumber
  33907.      * Retrieves a specific journal using a unique journal number.
  33908.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  33909.      * @param  int $journal_number Number of a Journal (required)
  33910.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  33911.      * @throws \InvalidArgumentException
  33912.      * @return \XeroAPI\XeroPHP\Models\Accounting\Journals
  33913.      */
  33914.     public function getJournalByNumber($xero_tenant_id$journal_number)
  33915.     {
  33916.         list($response) = $this->getJournalByNumberWithHttpInfo($xero_tenant_id$journal_number);
  33917.         return $response;
  33918.     }
  33919.     /**
  33920.      * Operation getJournalByNumberWithHttpInfo
  33921.      * Retrieves a specific journal using a unique journal number.
  33922.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  33923.      * @param  int $journal_number Number of a Journal (required)
  33924.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  33925.      * @throws \InvalidArgumentException
  33926.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Journals, HTTP status code, HTTP response headers (array of strings)
  33927.      */
  33928.     public function getJournalByNumberWithHttpInfo($xero_tenant_id$journal_number)
  33929.     {
  33930.         $request $this->getJournalByNumberRequest($xero_tenant_id$journal_number);
  33931.         try {
  33932.             $options $this->createHttpClientOption();
  33933.             try {
  33934.                 $response $this->client->send($request$options);
  33935.             } catch (RequestException $e) {
  33936.                 throw new ApiException(
  33937.                     "[{$e->getCode()}{$e->getMessage()}",
  33938.                     $e->getCode(),
  33939.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  33940.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  33941.                 );
  33942.             }
  33943.             $statusCode $response->getStatusCode();
  33944.             if ($statusCode 200 || $statusCode 299) {
  33945.                 throw new ApiException(
  33946.                     sprintf(
  33947.                         '[%d] Error connecting to the API (%s)',
  33948.                         $statusCode,
  33949.                         $request->getUri()
  33950.                     ),
  33951.                     $statusCode,
  33952.                     $response->getHeaders(),
  33953.                     $response->getBody()
  33954.                 );
  33955.             }
  33956.             $responseBody $response->getBody();
  33957.             switch($statusCode) {
  33958.                 case 200:
  33959.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Journals' === '\SplFileObject') {
  33960.                         $content $responseBody//stream goes to serializer
  33961.                     } else {
  33962.                         $content $responseBody->getContents();
  33963.                     }
  33964.                     return [
  33965.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Journals', []),
  33966.                         $response->getStatusCode(),
  33967.                         $response->getHeaders()
  33968.                     ];
  33969.             }
  33970.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Journals';
  33971.             $responseBody $response->getBody();
  33972.             if ($returnType === '\SplFileObject') {
  33973.                 $content $responseBody//stream goes to serializer
  33974.             } else {
  33975.                 $content $responseBody->getContents();
  33976.             }
  33977.             return [
  33978.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  33979.                 $response->getStatusCode(),
  33980.                 $response->getHeaders()
  33981.             ];
  33982.         } catch (ApiException $e) {
  33983.             switch ($e->getCode()) {
  33984.                 case 200:
  33985.                     $data AccountingObjectSerializer::deserialize(
  33986.                         $e->getResponseBody(),
  33987.                         '\XeroAPI\XeroPHP\Models\Accounting\Journals',
  33988.                         $e->getResponseHeaders()
  33989.                     );
  33990.                     $e->setResponseObject($data);
  33991.                     break;
  33992.             }
  33993.             throw $e;
  33994.         }
  33995.     }
  33996.     /**
  33997.      * Operation getJournalByNumberAsync
  33998.      * Retrieves a specific journal using a unique journal number.
  33999.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  34000.      * @param  int $journal_number Number of a Journal (required)
  34001.      * @throws \InvalidArgumentException
  34002.      * @return \GuzzleHttp\Promise\PromiseInterface
  34003.      */
  34004.     public function getJournalByNumberAsync($xero_tenant_id$journal_number)
  34005.     {
  34006.         return $this->getJournalByNumberAsyncWithHttpInfo($xero_tenant_id$journal_number)
  34007.             ->then(
  34008.                 function ($response) {
  34009.                     return $response[0];
  34010.                 }
  34011.             );
  34012.     }
  34013.     /**
  34014.      * Operation getJournalByNumberAsyncWithHttpInfo
  34015.      * Retrieves a specific journal using a unique journal number.
  34016.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  34017.      * @param  int $journal_number Number of a Journal (required)
  34018.      * @throws \InvalidArgumentException
  34019.      * @return \GuzzleHttp\Promise\PromiseInterface */
  34020.     public function getJournalByNumberAsyncWithHttpInfo($xero_tenant_id$journal_number)
  34021.     {
  34022.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Journals';
  34023.         $request $this->getJournalByNumberRequest($xero_tenant_id$journal_number);
  34024.         return $this->client
  34025.             ->sendAsync($request$this->createHttpClientOption())
  34026.             ->then(
  34027.                 function ($response) use ($returnType) {
  34028.                     $responseBody $response->getBody();
  34029.                     if ($returnType === '\SplFileObject') {
  34030.                         $content $responseBody//stream goes to serializer
  34031.                     } else {
  34032.                         $content $responseBody->getContents();
  34033.                     }
  34034.                     return [
  34035.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  34036.                         $response->getStatusCode(),
  34037.                         $response->getHeaders()
  34038.                     ];
  34039.                 },
  34040.                 function ($exception) {
  34041.                     $response $exception->getResponse();
  34042.                     $statusCode $response->getStatusCode();
  34043.                     throw new ApiException(
  34044.                         sprintf(
  34045.                             '[%d] Error connecting to the API (%s)',
  34046.                             $statusCode,
  34047.                             $exception->getRequest()->getUri()
  34048.                         ),
  34049.                         $statusCode,
  34050.                         $response->getHeaders(),
  34051.                         $response->getBody()
  34052.                     );
  34053.                 }
  34054.             );
  34055.     }
  34056.     /**
  34057.      * Create request for operation 'getJournalByNumber'
  34058.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  34059.      * @param  int $journal_number Number of a Journal (required)
  34060.      * @throws \InvalidArgumentException
  34061.      * @return \GuzzleHttp\Psr7\Request  */
  34062.     protected function getJournalByNumberRequest($xero_tenant_id$journal_number)
  34063.     {
  34064.         // verify the required parameter 'xero_tenant_id' is set
  34065.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  34066.             throw new \InvalidArgumentException(
  34067.                 'Missing the required parameter $xero_tenant_id when calling getJournalByNumber'
  34068.             );
  34069.         }
  34070.         // verify the required parameter 'journal_number' is set
  34071.         if ($journal_number === null || (is_array($journal_number) && count($journal_number) === 0)) {
  34072.             throw new \InvalidArgumentException(
  34073.                 'Missing the required parameter $journal_number when calling getJournalByNumber'
  34074.             );
  34075.         }
  34076.         $resourcePath '/Journals/{JournalNumber}';
  34077.         $formParams = [];
  34078.         $queryParams = [];
  34079.         $headerParams = [];
  34080.         $httpBody '';
  34081.         $multipart false;
  34082.         // header params
  34083.         if ($xero_tenant_id !== null) {
  34084.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  34085.         }
  34086.         // path params
  34087.         if ($journal_number !== null) {
  34088.             $resourcePath str_replace(
  34089.                 '{' 'JournalNumber' '}',
  34090.                 AccountingObjectSerializer::toPathValue($journal_number),
  34091.                 $resourcePath
  34092.             );
  34093.         }
  34094.         // body params
  34095.         $_tempBody null;
  34096.         if ($multipart) {
  34097.             $headers $this->headerSelector->selectHeadersForMultipart(
  34098.                 ['application/json']
  34099.             );
  34100.         } else {
  34101.             $headers $this->headerSelector->selectHeaders(
  34102.                 ['application/json'],
  34103.                 []
  34104.             );
  34105.         }
  34106.         // for model (json/xml)
  34107.         if (isset($_tempBody)) {
  34108.             // $_tempBody is the method argument, if present
  34109.             if ($headers['Content-Type'] === 'application/json') {
  34110.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  34111.             } else {
  34112.                 $httpBody $_tempBody;
  34113.             }
  34114.         } elseif (count($formParams) > 0) {
  34115.             if ($multipart) {
  34116.                 $multipartContents = [
  34117.                     [
  34118.                         'Content-type' => 'multipart/form-data',
  34119.                     ]
  34120.                 ];
  34121.                 
  34122.                 // for HTTP post (form)
  34123.                 $httpBody = new MultipartStream($multipartContents);
  34124.             } elseif ($headers['Content-Type'] === 'application/json') {
  34125.                 $httpBody \GuzzleHttp\json_encode($formParams);
  34126.             } else {
  34127.                 // for HTTP post (form)
  34128.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  34129.             }
  34130.         }
  34131.         // this endpoint requires OAuth (access token)
  34132.         if ($this->config->getAccessToken() !== null) {
  34133.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  34134.         }
  34135.         $defaultHeaders = [];
  34136.         if ($this->config->getUserAgent()) {
  34137.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  34138.         }
  34139.         $headers array_merge(
  34140.             $defaultHeaders,
  34141.             $headerParams,
  34142.             $headers
  34143.         );
  34144.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  34145.         return new Request(
  34146.             'GET',
  34147.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  34148.             $headers,
  34149.             $httpBody
  34150.         );
  34151.     }
  34152.     /**
  34153.      * Operation getJournals
  34154.      * Retrieves journals
  34155.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  34156.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  34157.      * @param  int $offset Offset by a specified journal number. e.g. journals with a JournalNumber greater than the offset will be returned (optional)
  34158.      * @param  bool $payments_only Filter to retrieve journals on a cash basis. Journals are returned on an accrual basis by default. (optional)
  34159.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  34160.      * @throws \InvalidArgumentException
  34161.      * @return \XeroAPI\XeroPHP\Models\Accounting\Journals
  34162.      */
  34163.     public function getJournals($xero_tenant_id$if_modified_since null$offset null$payments_only null)
  34164.     {
  34165.         list($response) = $this->getJournalsWithHttpInfo($xero_tenant_id$if_modified_since$offset$payments_only);
  34166.         return $response;
  34167.     }
  34168.     /**
  34169.      * Operation getJournalsWithHttpInfo
  34170.      * Retrieves journals
  34171.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  34172.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  34173.      * @param  int $offset Offset by a specified journal number. e.g. journals with a JournalNumber greater than the offset will be returned (optional)
  34174.      * @param  bool $payments_only Filter to retrieve journals on a cash basis. Journals are returned on an accrual basis by default. (optional)
  34175.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  34176.      * @throws \InvalidArgumentException
  34177.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Journals, HTTP status code, HTTP response headers (array of strings)
  34178.      */
  34179.     public function getJournalsWithHttpInfo($xero_tenant_id$if_modified_since null$offset null$payments_only null)
  34180.     {
  34181.         $request $this->getJournalsRequest($xero_tenant_id$if_modified_since$offset$payments_only);
  34182.         try {
  34183.             $options $this->createHttpClientOption();
  34184.             try {
  34185.                 $response $this->client->send($request$options);
  34186.             } catch (RequestException $e) {
  34187.                 throw new ApiException(
  34188.                     "[{$e->getCode()}{$e->getMessage()}",
  34189.                     $e->getCode(),
  34190.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  34191.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  34192.                 );
  34193.             }
  34194.             $statusCode $response->getStatusCode();
  34195.             if ($statusCode 200 || $statusCode 299) {
  34196.                 throw new ApiException(
  34197.                     sprintf(
  34198.                         '[%d] Error connecting to the API (%s)',
  34199.                         $statusCode,
  34200.                         $request->getUri()
  34201.                     ),
  34202.                     $statusCode,
  34203.                     $response->getHeaders(),
  34204.                     $response->getBody()
  34205.                 );
  34206.             }
  34207.             $responseBody $response->getBody();
  34208.             switch($statusCode) {
  34209.                 case 200:
  34210.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Journals' === '\SplFileObject') {
  34211.                         $content $responseBody//stream goes to serializer
  34212.                     } else {
  34213.                         $content $responseBody->getContents();
  34214.                     }
  34215.                     return [
  34216.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Journals', []),
  34217.                         $response->getStatusCode(),
  34218.                         $response->getHeaders()
  34219.                     ];
  34220.             }
  34221.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Journals';
  34222.             $responseBody $response->getBody();
  34223.             if ($returnType === '\SplFileObject') {
  34224.                 $content $responseBody//stream goes to serializer
  34225.             } else {
  34226.                 $content $responseBody->getContents();
  34227.             }
  34228.             return [
  34229.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  34230.                 $response->getStatusCode(),
  34231.                 $response->getHeaders()
  34232.             ];
  34233.         } catch (ApiException $e) {
  34234.             switch ($e->getCode()) {
  34235.                 case 200:
  34236.                     $data AccountingObjectSerializer::deserialize(
  34237.                         $e->getResponseBody(),
  34238.                         '\XeroAPI\XeroPHP\Models\Accounting\Journals',
  34239.                         $e->getResponseHeaders()
  34240.                     );
  34241.                     $e->setResponseObject($data);
  34242.                     break;
  34243.             }
  34244.             throw $e;
  34245.         }
  34246.     }
  34247.     /**
  34248.      * Operation getJournalsAsync
  34249.      * Retrieves journals
  34250.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  34251.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  34252.      * @param  int $offset Offset by a specified journal number. e.g. journals with a JournalNumber greater than the offset will be returned (optional)
  34253.      * @param  bool $payments_only Filter to retrieve journals on a cash basis. Journals are returned on an accrual basis by default. (optional)
  34254.      * @throws \InvalidArgumentException
  34255.      * @return \GuzzleHttp\Promise\PromiseInterface
  34256.      */
  34257.     public function getJournalsAsync($xero_tenant_id$if_modified_since null$offset null$payments_only null)
  34258.     {
  34259.         return $this->getJournalsAsyncWithHttpInfo($xero_tenant_id$if_modified_since$offset$payments_only)
  34260.             ->then(
  34261.                 function ($response) {
  34262.                     return $response[0];
  34263.                 }
  34264.             );
  34265.     }
  34266.     /**
  34267.      * Operation getJournalsAsyncWithHttpInfo
  34268.      * Retrieves journals
  34269.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  34270.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  34271.      * @param  int $offset Offset by a specified journal number. e.g. journals with a JournalNumber greater than the offset will be returned (optional)
  34272.      * @param  bool $payments_only Filter to retrieve journals on a cash basis. Journals are returned on an accrual basis by default. (optional)
  34273.      * @throws \InvalidArgumentException
  34274.      * @return \GuzzleHttp\Promise\PromiseInterface */
  34275.     public function getJournalsAsyncWithHttpInfo($xero_tenant_id$if_modified_since null$offset null$payments_only null)
  34276.     {
  34277.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Journals';
  34278.         $request $this->getJournalsRequest($xero_tenant_id$if_modified_since$offset$payments_only);
  34279.         return $this->client
  34280.             ->sendAsync($request$this->createHttpClientOption())
  34281.             ->then(
  34282.                 function ($response) use ($returnType) {
  34283.                     $responseBody $response->getBody();
  34284.                     if ($returnType === '\SplFileObject') {
  34285.                         $content $responseBody//stream goes to serializer
  34286.                     } else {
  34287.                         $content $responseBody->getContents();
  34288.                     }
  34289.                     return [
  34290.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  34291.                         $response->getStatusCode(),
  34292.                         $response->getHeaders()
  34293.                     ];
  34294.                 },
  34295.                 function ($exception) {
  34296.                     $response $exception->getResponse();
  34297.                     $statusCode $response->getStatusCode();
  34298.                     throw new ApiException(
  34299.                         sprintf(
  34300.                             '[%d] Error connecting to the API (%s)',
  34301.                             $statusCode,
  34302.                             $exception->getRequest()->getUri()
  34303.                         ),
  34304.                         $statusCode,
  34305.                         $response->getHeaders(),
  34306.                         $response->getBody()
  34307.                     );
  34308.                 }
  34309.             );
  34310.     }
  34311.     /**
  34312.      * Create request for operation 'getJournals'
  34313.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  34314.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  34315.      * @param  int $offset Offset by a specified journal number. e.g. journals with a JournalNumber greater than the offset will be returned (optional)
  34316.      * @param  bool $payments_only Filter to retrieve journals on a cash basis. Journals are returned on an accrual basis by default. (optional)
  34317.      * @throws \InvalidArgumentException
  34318.      * @return \GuzzleHttp\Psr7\Request  */
  34319.     protected function getJournalsRequest($xero_tenant_id$if_modified_since null$offset null$payments_only null)
  34320.     {
  34321.         // verify the required parameter 'xero_tenant_id' is set
  34322.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  34323.             throw new \InvalidArgumentException(
  34324.                 'Missing the required parameter $xero_tenant_id when calling getJournals'
  34325.             );
  34326.         }
  34327.         $resourcePath '/Journals';
  34328.         $formParams = [];
  34329.         $queryParams = [];
  34330.         $headerParams = [];
  34331.         $httpBody '';
  34332.         $multipart false;
  34333.         // query params
  34334.         if ($offset !== null) {
  34335.             $queryParams['offset'] = AccountingObjectSerializer::toQueryValue($offset);
  34336.         }
  34337.         // query params
  34338.         if ($payments_only !== null) {
  34339.             $queryParams['paymentsOnly'] = $payments_only 'true' 'false';
  34340.         }
  34341.         // header params
  34342.         if ($xero_tenant_id !== null) {
  34343.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  34344.         }
  34345.         // header params
  34346.         if ($if_modified_since !== null) {
  34347.             $headerParams['If-Modified-Since'] = AccountingObjectSerializer::toHeaderValue($if_modified_since);
  34348.         }
  34349.         // body params
  34350.         $_tempBody null;
  34351.         if ($multipart) {
  34352.             $headers $this->headerSelector->selectHeadersForMultipart(
  34353.                 ['application/json']
  34354.             );
  34355.         } else {
  34356.             $headers $this->headerSelector->selectHeaders(
  34357.                 ['application/json'],
  34358.                 []
  34359.             );
  34360.         }
  34361.         // for model (json/xml)
  34362.         if (isset($_tempBody)) {
  34363.             // $_tempBody is the method argument, if present
  34364.             if ($headers['Content-Type'] === 'application/json') {
  34365.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  34366.             } else {
  34367.                 $httpBody $_tempBody;
  34368.             }
  34369.         } elseif (count($formParams) > 0) {
  34370.             if ($multipart) {
  34371.                 $multipartContents = [
  34372.                     [
  34373.                         'Content-type' => 'multipart/form-data',
  34374.                     ]
  34375.                 ];
  34376.                 
  34377.                 // for HTTP post (form)
  34378.                 $httpBody = new MultipartStream($multipartContents);
  34379.             } elseif ($headers['Content-Type'] === 'application/json') {
  34380.                 $httpBody \GuzzleHttp\json_encode($formParams);
  34381.             } else {
  34382.                 // for HTTP post (form)
  34383.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  34384.             }
  34385.         }
  34386.         // this endpoint requires OAuth (access token)
  34387.         if ($this->config->getAccessToken() !== null) {
  34388.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  34389.         }
  34390.         $defaultHeaders = [];
  34391.         if ($this->config->getUserAgent()) {
  34392.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  34393.         }
  34394.         $headers array_merge(
  34395.             $defaultHeaders,
  34396.             $headerParams,
  34397.             $headers
  34398.         );
  34399.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  34400.         return new Request(
  34401.             'GET',
  34402.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  34403.             $headers,
  34404.             $httpBody
  34405.         );
  34406.     }
  34407.     /**
  34408.      * Operation getLinkedTransaction
  34409.      * Retrieves a specific linked transaction (billable expenses) using a unique linked transaction Id
  34410.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  34411.      * @param  string $linked_transaction_id Unique identifier for a LinkedTransaction (required)
  34412.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  34413.      * @throws \InvalidArgumentException
  34414.      * @return \XeroAPI\XeroPHP\Models\Accounting\LinkedTransactions
  34415.      */
  34416.     public function getLinkedTransaction($xero_tenant_id$linked_transaction_id)
  34417.     {
  34418.         list($response) = $this->getLinkedTransactionWithHttpInfo($xero_tenant_id$linked_transaction_id);
  34419.         return $response;
  34420.     }
  34421.     /**
  34422.      * Operation getLinkedTransactionWithHttpInfo
  34423.      * Retrieves a specific linked transaction (billable expenses) using a unique linked transaction Id
  34424.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  34425.      * @param  string $linked_transaction_id Unique identifier for a LinkedTransaction (required)
  34426.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  34427.      * @throws \InvalidArgumentException
  34428.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\LinkedTransactions, HTTP status code, HTTP response headers (array of strings)
  34429.      */
  34430.     public function getLinkedTransactionWithHttpInfo($xero_tenant_id$linked_transaction_id)
  34431.     {
  34432.         $request $this->getLinkedTransactionRequest($xero_tenant_id$linked_transaction_id);
  34433.         try {
  34434.             $options $this->createHttpClientOption();
  34435.             try {
  34436.                 $response $this->client->send($request$options);
  34437.             } catch (RequestException $e) {
  34438.                 throw new ApiException(
  34439.                     "[{$e->getCode()}{$e->getMessage()}",
  34440.                     $e->getCode(),
  34441.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  34442.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  34443.                 );
  34444.             }
  34445.             $statusCode $response->getStatusCode();
  34446.             if ($statusCode 200 || $statusCode 299) {
  34447.                 throw new ApiException(
  34448.                     sprintf(
  34449.                         '[%d] Error connecting to the API (%s)',
  34450.                         $statusCode,
  34451.                         $request->getUri()
  34452.                     ),
  34453.                     $statusCode,
  34454.                     $response->getHeaders(),
  34455.                     $response->getBody()
  34456.                 );
  34457.             }
  34458.             $responseBody $response->getBody();
  34459.             switch($statusCode) {
  34460.                 case 200:
  34461.                     if ('\XeroAPI\XeroPHP\Models\Accounting\LinkedTransactions' === '\SplFileObject') {
  34462.                         $content $responseBody//stream goes to serializer
  34463.                     } else {
  34464.                         $content $responseBody->getContents();
  34465.                     }
  34466.                     return [
  34467.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\LinkedTransactions', []),
  34468.                         $response->getStatusCode(),
  34469.                         $response->getHeaders()
  34470.                     ];
  34471.             }
  34472.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\LinkedTransactions';
  34473.             $responseBody $response->getBody();
  34474.             if ($returnType === '\SplFileObject') {
  34475.                 $content $responseBody//stream goes to serializer
  34476.             } else {
  34477.                 $content $responseBody->getContents();
  34478.             }
  34479.             return [
  34480.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  34481.                 $response->getStatusCode(),
  34482.                 $response->getHeaders()
  34483.             ];
  34484.         } catch (ApiException $e) {
  34485.             switch ($e->getCode()) {
  34486.                 case 200:
  34487.                     $data AccountingObjectSerializer::deserialize(
  34488.                         $e->getResponseBody(),
  34489.                         '\XeroAPI\XeroPHP\Models\Accounting\LinkedTransactions',
  34490.                         $e->getResponseHeaders()
  34491.                     );
  34492.                     $e->setResponseObject($data);
  34493.                     break;
  34494.             }
  34495.             throw $e;
  34496.         }
  34497.     }
  34498.     /**
  34499.      * Operation getLinkedTransactionAsync
  34500.      * Retrieves a specific linked transaction (billable expenses) using a unique linked transaction Id
  34501.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  34502.      * @param  string $linked_transaction_id Unique identifier for a LinkedTransaction (required)
  34503.      * @throws \InvalidArgumentException
  34504.      * @return \GuzzleHttp\Promise\PromiseInterface
  34505.      */
  34506.     public function getLinkedTransactionAsync($xero_tenant_id$linked_transaction_id)
  34507.     {
  34508.         return $this->getLinkedTransactionAsyncWithHttpInfo($xero_tenant_id$linked_transaction_id)
  34509.             ->then(
  34510.                 function ($response) {
  34511.                     return $response[0];
  34512.                 }
  34513.             );
  34514.     }
  34515.     /**
  34516.      * Operation getLinkedTransactionAsyncWithHttpInfo
  34517.      * Retrieves a specific linked transaction (billable expenses) using a unique linked transaction Id
  34518.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  34519.      * @param  string $linked_transaction_id Unique identifier for a LinkedTransaction (required)
  34520.      * @throws \InvalidArgumentException
  34521.      * @return \GuzzleHttp\Promise\PromiseInterface */
  34522.     public function getLinkedTransactionAsyncWithHttpInfo($xero_tenant_id$linked_transaction_id)
  34523.     {
  34524.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\LinkedTransactions';
  34525.         $request $this->getLinkedTransactionRequest($xero_tenant_id$linked_transaction_id);
  34526.         return $this->client
  34527.             ->sendAsync($request$this->createHttpClientOption())
  34528.             ->then(
  34529.                 function ($response) use ($returnType) {
  34530.                     $responseBody $response->getBody();
  34531.                     if ($returnType === '\SplFileObject') {
  34532.                         $content $responseBody//stream goes to serializer
  34533.                     } else {
  34534.                         $content $responseBody->getContents();
  34535.                     }
  34536.                     return [
  34537.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  34538.                         $response->getStatusCode(),
  34539.                         $response->getHeaders()
  34540.                     ];
  34541.                 },
  34542.                 function ($exception) {
  34543.                     $response $exception->getResponse();
  34544.                     $statusCode $response->getStatusCode();
  34545.                     throw new ApiException(
  34546.                         sprintf(
  34547.                             '[%d] Error connecting to the API (%s)',
  34548.                             $statusCode,
  34549.                             $exception->getRequest()->getUri()
  34550.                         ),
  34551.                         $statusCode,
  34552.                         $response->getHeaders(),
  34553.                         $response->getBody()
  34554.                     );
  34555.                 }
  34556.             );
  34557.     }
  34558.     /**
  34559.      * Create request for operation 'getLinkedTransaction'
  34560.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  34561.      * @param  string $linked_transaction_id Unique identifier for a LinkedTransaction (required)
  34562.      * @throws \InvalidArgumentException
  34563.      * @return \GuzzleHttp\Psr7\Request  */
  34564.     protected function getLinkedTransactionRequest($xero_tenant_id$linked_transaction_id)
  34565.     {
  34566.         // verify the required parameter 'xero_tenant_id' is set
  34567.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  34568.             throw new \InvalidArgumentException(
  34569.                 'Missing the required parameter $xero_tenant_id when calling getLinkedTransaction'
  34570.             );
  34571.         }
  34572.         // verify the required parameter 'linked_transaction_id' is set
  34573.         if ($linked_transaction_id === null || (is_array($linked_transaction_id) && count($linked_transaction_id) === 0)) {
  34574.             throw new \InvalidArgumentException(
  34575.                 'Missing the required parameter $linked_transaction_id when calling getLinkedTransaction'
  34576.             );
  34577.         }
  34578.         $resourcePath '/LinkedTransactions/{LinkedTransactionID}';
  34579.         $formParams = [];
  34580.         $queryParams = [];
  34581.         $headerParams = [];
  34582.         $httpBody '';
  34583.         $multipart false;
  34584.         // header params
  34585.         if ($xero_tenant_id !== null) {
  34586.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  34587.         }
  34588.         // path params
  34589.         if ($linked_transaction_id !== null) {
  34590.             $resourcePath str_replace(
  34591.                 '{' 'LinkedTransactionID' '}',
  34592.                 AccountingObjectSerializer::toPathValue($linked_transaction_id),
  34593.                 $resourcePath
  34594.             );
  34595.         }
  34596.         // body params
  34597.         $_tempBody null;
  34598.         if ($multipart) {
  34599.             $headers $this->headerSelector->selectHeadersForMultipart(
  34600.                 ['application/json']
  34601.             );
  34602.         } else {
  34603.             $headers $this->headerSelector->selectHeaders(
  34604.                 ['application/json'],
  34605.                 []
  34606.             );
  34607.         }
  34608.         // for model (json/xml)
  34609.         if (isset($_tempBody)) {
  34610.             // $_tempBody is the method argument, if present
  34611.             if ($headers['Content-Type'] === 'application/json') {
  34612.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  34613.             } else {
  34614.                 $httpBody $_tempBody;
  34615.             }
  34616.         } elseif (count($formParams) > 0) {
  34617.             if ($multipart) {
  34618.                 $multipartContents = [
  34619.                     [
  34620.                         'Content-type' => 'multipart/form-data',
  34621.                     ]
  34622.                 ];
  34623.                 
  34624.                 // for HTTP post (form)
  34625.                 $httpBody = new MultipartStream($multipartContents);
  34626.             } elseif ($headers['Content-Type'] === 'application/json') {
  34627.                 $httpBody \GuzzleHttp\json_encode($formParams);
  34628.             } else {
  34629.                 // for HTTP post (form)
  34630.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  34631.             }
  34632.         }
  34633.         // this endpoint requires OAuth (access token)
  34634.         if ($this->config->getAccessToken() !== null) {
  34635.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  34636.         }
  34637.         $defaultHeaders = [];
  34638.         if ($this->config->getUserAgent()) {
  34639.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  34640.         }
  34641.         $headers array_merge(
  34642.             $defaultHeaders,
  34643.             $headerParams,
  34644.             $headers
  34645.         );
  34646.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  34647.         return new Request(
  34648.             'GET',
  34649.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  34650.             $headers,
  34651.             $httpBody
  34652.         );
  34653.     }
  34654.     /**
  34655.      * Operation getLinkedTransactions
  34656.      * Retrieves linked transactions (billable expenses)
  34657.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  34658.      * @param  int $page Up to 100 linked transactions will be returned in a single API call. Use the page parameter to specify the page to be returned e.g. page&#x3D;1. (optional)
  34659.      * @param  string $linked_transaction_id The Xero identifier for an Linked Transaction (optional)
  34660.      * @param  string $source_transaction_id Filter by the SourceTransactionID. Get the linked transactions created from a particular ACCPAY invoice (optional)
  34661.      * @param  string $contact_id Filter by the ContactID. Get all the linked transactions that have been assigned to a particular customer. (optional)
  34662.      * @param  string $status Filter by the combination of ContactID and Status. Get  the linked transactions associated to a  customer and with a status (optional)
  34663.      * @param  string $target_transaction_id Filter by the TargetTransactionID. Get all the linked transactions allocated to a particular ACCREC invoice (optional)
  34664.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  34665.      * @throws \InvalidArgumentException
  34666.      * @return \XeroAPI\XeroPHP\Models\Accounting\LinkedTransactions
  34667.      */
  34668.     public function getLinkedTransactions($xero_tenant_id$page null$linked_transaction_id null$source_transaction_id null$contact_id null$status null$target_transaction_id null)
  34669.     {
  34670.         list($response) = $this->getLinkedTransactionsWithHttpInfo($xero_tenant_id$page$linked_transaction_id$source_transaction_id$contact_id$status$target_transaction_id);
  34671.         return $response;
  34672.     }
  34673.     /**
  34674.      * Operation getLinkedTransactionsWithHttpInfo
  34675.      * Retrieves linked transactions (billable expenses)
  34676.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  34677.      * @param  int $page Up to 100 linked transactions will be returned in a single API call. Use the page parameter to specify the page to be returned e.g. page&#x3D;1. (optional)
  34678.      * @param  string $linked_transaction_id The Xero identifier for an Linked Transaction (optional)
  34679.      * @param  string $source_transaction_id Filter by the SourceTransactionID. Get the linked transactions created from a particular ACCPAY invoice (optional)
  34680.      * @param  string $contact_id Filter by the ContactID. Get all the linked transactions that have been assigned to a particular customer. (optional)
  34681.      * @param  string $status Filter by the combination of ContactID and Status. Get  the linked transactions associated to a  customer and with a status (optional)
  34682.      * @param  string $target_transaction_id Filter by the TargetTransactionID. Get all the linked transactions allocated to a particular ACCREC invoice (optional)
  34683.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  34684.      * @throws \InvalidArgumentException
  34685.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\LinkedTransactions, HTTP status code, HTTP response headers (array of strings)
  34686.      */
  34687.     public function getLinkedTransactionsWithHttpInfo($xero_tenant_id$page null$linked_transaction_id null$source_transaction_id null$contact_id null$status null$target_transaction_id null)
  34688.     {
  34689.         $request $this->getLinkedTransactionsRequest($xero_tenant_id$page$linked_transaction_id$source_transaction_id$contact_id$status$target_transaction_id);
  34690.         try {
  34691.             $options $this->createHttpClientOption();
  34692.             try {
  34693.                 $response $this->client->send($request$options);
  34694.             } catch (RequestException $e) {
  34695.                 throw new ApiException(
  34696.                     "[{$e->getCode()}{$e->getMessage()}",
  34697.                     $e->getCode(),
  34698.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  34699.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  34700.                 );
  34701.             }
  34702.             $statusCode $response->getStatusCode();
  34703.             if ($statusCode 200 || $statusCode 299) {
  34704.                 throw new ApiException(
  34705.                     sprintf(
  34706.                         '[%d] Error connecting to the API (%s)',
  34707.                         $statusCode,
  34708.                         $request->getUri()
  34709.                     ),
  34710.                     $statusCode,
  34711.                     $response->getHeaders(),
  34712.                     $response->getBody()
  34713.                 );
  34714.             }
  34715.             $responseBody $response->getBody();
  34716.             switch($statusCode) {
  34717.                 case 200:
  34718.                     if ('\XeroAPI\XeroPHP\Models\Accounting\LinkedTransactions' === '\SplFileObject') {
  34719.                         $content $responseBody//stream goes to serializer
  34720.                     } else {
  34721.                         $content $responseBody->getContents();
  34722.                     }
  34723.                     return [
  34724.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\LinkedTransactions', []),
  34725.                         $response->getStatusCode(),
  34726.                         $response->getHeaders()
  34727.                     ];
  34728.             }
  34729.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\LinkedTransactions';
  34730.             $responseBody $response->getBody();
  34731.             if ($returnType === '\SplFileObject') {
  34732.                 $content $responseBody//stream goes to serializer
  34733.             } else {
  34734.                 $content $responseBody->getContents();
  34735.             }
  34736.             return [
  34737.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  34738.                 $response->getStatusCode(),
  34739.                 $response->getHeaders()
  34740.             ];
  34741.         } catch (ApiException $e) {
  34742.             switch ($e->getCode()) {
  34743.                 case 200:
  34744.                     $data AccountingObjectSerializer::deserialize(
  34745.                         $e->getResponseBody(),
  34746.                         '\XeroAPI\XeroPHP\Models\Accounting\LinkedTransactions',
  34747.                         $e->getResponseHeaders()
  34748.                     );
  34749.                     $e->setResponseObject($data);
  34750.                     break;
  34751.             }
  34752.             throw $e;
  34753.         }
  34754.     }
  34755.     /**
  34756.      * Operation getLinkedTransactionsAsync
  34757.      * Retrieves linked transactions (billable expenses)
  34758.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  34759.      * @param  int $page Up to 100 linked transactions will be returned in a single API call. Use the page parameter to specify the page to be returned e.g. page&#x3D;1. (optional)
  34760.      * @param  string $linked_transaction_id The Xero identifier for an Linked Transaction (optional)
  34761.      * @param  string $source_transaction_id Filter by the SourceTransactionID. Get the linked transactions created from a particular ACCPAY invoice (optional)
  34762.      * @param  string $contact_id Filter by the ContactID. Get all the linked transactions that have been assigned to a particular customer. (optional)
  34763.      * @param  string $status Filter by the combination of ContactID and Status. Get  the linked transactions associated to a  customer and with a status (optional)
  34764.      * @param  string $target_transaction_id Filter by the TargetTransactionID. Get all the linked transactions allocated to a particular ACCREC invoice (optional)
  34765.      * @throws \InvalidArgumentException
  34766.      * @return \GuzzleHttp\Promise\PromiseInterface
  34767.      */
  34768.     public function getLinkedTransactionsAsync($xero_tenant_id$page null$linked_transaction_id null$source_transaction_id null$contact_id null$status null$target_transaction_id null)
  34769.     {
  34770.         return $this->getLinkedTransactionsAsyncWithHttpInfo($xero_tenant_id$page$linked_transaction_id$source_transaction_id$contact_id$status$target_transaction_id)
  34771.             ->then(
  34772.                 function ($response) {
  34773.                     return $response[0];
  34774.                 }
  34775.             );
  34776.     }
  34777.     /**
  34778.      * Operation getLinkedTransactionsAsyncWithHttpInfo
  34779.      * Retrieves linked transactions (billable expenses)
  34780.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  34781.      * @param  int $page Up to 100 linked transactions will be returned in a single API call. Use the page parameter to specify the page to be returned e.g. page&#x3D;1. (optional)
  34782.      * @param  string $linked_transaction_id The Xero identifier for an Linked Transaction (optional)
  34783.      * @param  string $source_transaction_id Filter by the SourceTransactionID. Get the linked transactions created from a particular ACCPAY invoice (optional)
  34784.      * @param  string $contact_id Filter by the ContactID. Get all the linked transactions that have been assigned to a particular customer. (optional)
  34785.      * @param  string $status Filter by the combination of ContactID and Status. Get  the linked transactions associated to a  customer and with a status (optional)
  34786.      * @param  string $target_transaction_id Filter by the TargetTransactionID. Get all the linked transactions allocated to a particular ACCREC invoice (optional)
  34787.      * @throws \InvalidArgumentException
  34788.      * @return \GuzzleHttp\Promise\PromiseInterface */
  34789.     public function getLinkedTransactionsAsyncWithHttpInfo($xero_tenant_id$page null$linked_transaction_id null$source_transaction_id null$contact_id null$status null$target_transaction_id null)
  34790.     {
  34791.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\LinkedTransactions';
  34792.         $request $this->getLinkedTransactionsRequest($xero_tenant_id$page$linked_transaction_id$source_transaction_id$contact_id$status$target_transaction_id);
  34793.         return $this->client
  34794.             ->sendAsync($request$this->createHttpClientOption())
  34795.             ->then(
  34796.                 function ($response) use ($returnType) {
  34797.                     $responseBody $response->getBody();
  34798.                     if ($returnType === '\SplFileObject') {
  34799.                         $content $responseBody//stream goes to serializer
  34800.                     } else {
  34801.                         $content $responseBody->getContents();
  34802.                     }
  34803.                     return [
  34804.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  34805.                         $response->getStatusCode(),
  34806.                         $response->getHeaders()
  34807.                     ];
  34808.                 },
  34809.                 function ($exception) {
  34810.                     $response $exception->getResponse();
  34811.                     $statusCode $response->getStatusCode();
  34812.                     throw new ApiException(
  34813.                         sprintf(
  34814.                             '[%d] Error connecting to the API (%s)',
  34815.                             $statusCode,
  34816.                             $exception->getRequest()->getUri()
  34817.                         ),
  34818.                         $statusCode,
  34819.                         $response->getHeaders(),
  34820.                         $response->getBody()
  34821.                     );
  34822.                 }
  34823.             );
  34824.     }
  34825.     /**
  34826.      * Create request for operation 'getLinkedTransactions'
  34827.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  34828.      * @param  int $page Up to 100 linked transactions will be returned in a single API call. Use the page parameter to specify the page to be returned e.g. page&#x3D;1. (optional)
  34829.      * @param  string $linked_transaction_id The Xero identifier for an Linked Transaction (optional)
  34830.      * @param  string $source_transaction_id Filter by the SourceTransactionID. Get the linked transactions created from a particular ACCPAY invoice (optional)
  34831.      * @param  string $contact_id Filter by the ContactID. Get all the linked transactions that have been assigned to a particular customer. (optional)
  34832.      * @param  string $status Filter by the combination of ContactID and Status. Get  the linked transactions associated to a  customer and with a status (optional)
  34833.      * @param  string $target_transaction_id Filter by the TargetTransactionID. Get all the linked transactions allocated to a particular ACCREC invoice (optional)
  34834.      * @throws \InvalidArgumentException
  34835.      * @return \GuzzleHttp\Psr7\Request  */
  34836.     protected function getLinkedTransactionsRequest($xero_tenant_id$page null$linked_transaction_id null$source_transaction_id null$contact_id null$status null$target_transaction_id null)
  34837.     {
  34838.         // verify the required parameter 'xero_tenant_id' is set
  34839.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  34840.             throw new \InvalidArgumentException(
  34841.                 'Missing the required parameter $xero_tenant_id when calling getLinkedTransactions'
  34842.             );
  34843.         }
  34844.         $resourcePath '/LinkedTransactions';
  34845.         $formParams = [];
  34846.         $queryParams = [];
  34847.         $headerParams = [];
  34848.         $httpBody '';
  34849.         $multipart false;
  34850.         // query params
  34851.         if ($page !== null) {
  34852.             $queryParams['page'] = AccountingObjectSerializer::toQueryValue($page);
  34853.         }
  34854.         // query params
  34855.         if ($linked_transaction_id !== null) {
  34856.             $queryParams['LinkedTransactionID'] = AccountingObjectSerializer::toQueryValue($linked_transaction_id);
  34857.         }
  34858.         // query params
  34859.         if ($source_transaction_id !== null) {
  34860.             $queryParams['SourceTransactionID'] = AccountingObjectSerializer::toQueryValue($source_transaction_id);
  34861.         }
  34862.         // query params
  34863.         if ($contact_id !== null) {
  34864.             $queryParams['ContactID'] = AccountingObjectSerializer::toQueryValue($contact_id);
  34865.         }
  34866.         // query params
  34867.         if ($status !== null) {
  34868.             $queryParams['Status'] = AccountingObjectSerializer::toQueryValue($status);
  34869.         }
  34870.         // query params
  34871.         if ($target_transaction_id !== null) {
  34872.             $queryParams['TargetTransactionID'] = AccountingObjectSerializer::toQueryValue($target_transaction_id);
  34873.         }
  34874.         // header params
  34875.         if ($xero_tenant_id !== null) {
  34876.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  34877.         }
  34878.         // body params
  34879.         $_tempBody null;
  34880.         if ($multipart) {
  34881.             $headers $this->headerSelector->selectHeadersForMultipart(
  34882.                 ['application/json']
  34883.             );
  34884.         } else {
  34885.             $headers $this->headerSelector->selectHeaders(
  34886.                 ['application/json'],
  34887.                 []
  34888.             );
  34889.         }
  34890.         // for model (json/xml)
  34891.         if (isset($_tempBody)) {
  34892.             // $_tempBody is the method argument, if present
  34893.             if ($headers['Content-Type'] === 'application/json') {
  34894.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  34895.             } else {
  34896.                 $httpBody $_tempBody;
  34897.             }
  34898.         } elseif (count($formParams) > 0) {
  34899.             if ($multipart) {
  34900.                 $multipartContents = [
  34901.                     [
  34902.                         'Content-type' => 'multipart/form-data',
  34903.                     ]
  34904.                 ];
  34905.                 
  34906.                 // for HTTP post (form)
  34907.                 $httpBody = new MultipartStream($multipartContents);
  34908.             } elseif ($headers['Content-Type'] === 'application/json') {
  34909.                 $httpBody \GuzzleHttp\json_encode($formParams);
  34910.             } else {
  34911.                 // for HTTP post (form)
  34912.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  34913.             }
  34914.         }
  34915.         // this endpoint requires OAuth (access token)
  34916.         if ($this->config->getAccessToken() !== null) {
  34917.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  34918.         }
  34919.         $defaultHeaders = [];
  34920.         if ($this->config->getUserAgent()) {
  34921.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  34922.         }
  34923.         $headers array_merge(
  34924.             $defaultHeaders,
  34925.             $headerParams,
  34926.             $headers
  34927.         );
  34928.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  34929.         return new Request(
  34930.             'GET',
  34931.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  34932.             $headers,
  34933.             $httpBody
  34934.         );
  34935.     }
  34936.     /**
  34937.      * Operation getManualJournal
  34938.      * Retrieves a specific manual journal
  34939.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  34940.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  34941.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  34942.      * @throws \InvalidArgumentException
  34943.      * @return \XeroAPI\XeroPHP\Models\Accounting\ManualJournals
  34944.      */
  34945.     public function getManualJournal($xero_tenant_id$manual_journal_id)
  34946.     {
  34947.         list($response) = $this->getManualJournalWithHttpInfo($xero_tenant_id$manual_journal_id);
  34948.         return $response;
  34949.     }
  34950.     /**
  34951.      * Operation getManualJournalWithHttpInfo
  34952.      * Retrieves a specific manual journal
  34953.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  34954.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  34955.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  34956.      * @throws \InvalidArgumentException
  34957.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\ManualJournals, HTTP status code, HTTP response headers (array of strings)
  34958.      */
  34959.     public function getManualJournalWithHttpInfo($xero_tenant_id$manual_journal_id)
  34960.     {
  34961.         $request $this->getManualJournalRequest($xero_tenant_id$manual_journal_id);
  34962.         try {
  34963.             $options $this->createHttpClientOption();
  34964.             try {
  34965.                 $response $this->client->send($request$options);
  34966.             } catch (RequestException $e) {
  34967.                 throw new ApiException(
  34968.                     "[{$e->getCode()}{$e->getMessage()}",
  34969.                     $e->getCode(),
  34970.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  34971.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  34972.                 );
  34973.             }
  34974.             $statusCode $response->getStatusCode();
  34975.             if ($statusCode 200 || $statusCode 299) {
  34976.                 throw new ApiException(
  34977.                     sprintf(
  34978.                         '[%d] Error connecting to the API (%s)',
  34979.                         $statusCode,
  34980.                         $request->getUri()
  34981.                     ),
  34982.                     $statusCode,
  34983.                     $response->getHeaders(),
  34984.                     $response->getBody()
  34985.                 );
  34986.             }
  34987.             $responseBody $response->getBody();
  34988.             switch($statusCode) {
  34989.                 case 200:
  34990.                     if ('\XeroAPI\XeroPHP\Models\Accounting\ManualJournals' === '\SplFileObject') {
  34991.                         $content $responseBody//stream goes to serializer
  34992.                     } else {
  34993.                         $content $responseBody->getContents();
  34994.                     }
  34995.                     return [
  34996.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\ManualJournals', []),
  34997.                         $response->getStatusCode(),
  34998.                         $response->getHeaders()
  34999.                     ];
  35000.             }
  35001.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\ManualJournals';
  35002.             $responseBody $response->getBody();
  35003.             if ($returnType === '\SplFileObject') {
  35004.                 $content $responseBody//stream goes to serializer
  35005.             } else {
  35006.                 $content $responseBody->getContents();
  35007.             }
  35008.             return [
  35009.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  35010.                 $response->getStatusCode(),
  35011.                 $response->getHeaders()
  35012.             ];
  35013.         } catch (ApiException $e) {
  35014.             switch ($e->getCode()) {
  35015.                 case 200:
  35016.                     $data AccountingObjectSerializer::deserialize(
  35017.                         $e->getResponseBody(),
  35018.                         '\XeroAPI\XeroPHP\Models\Accounting\ManualJournals',
  35019.                         $e->getResponseHeaders()
  35020.                     );
  35021.                     $e->setResponseObject($data);
  35022.                     break;
  35023.             }
  35024.             throw $e;
  35025.         }
  35026.     }
  35027.     /**
  35028.      * Operation getManualJournalAsync
  35029.      * Retrieves a specific manual journal
  35030.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  35031.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  35032.      * @throws \InvalidArgumentException
  35033.      * @return \GuzzleHttp\Promise\PromiseInterface
  35034.      */
  35035.     public function getManualJournalAsync($xero_tenant_id$manual_journal_id)
  35036.     {
  35037.         return $this->getManualJournalAsyncWithHttpInfo($xero_tenant_id$manual_journal_id)
  35038.             ->then(
  35039.                 function ($response) {
  35040.                     return $response[0];
  35041.                 }
  35042.             );
  35043.     }
  35044.     /**
  35045.      * Operation getManualJournalAsyncWithHttpInfo
  35046.      * Retrieves a specific manual journal
  35047.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  35048.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  35049.      * @throws \InvalidArgumentException
  35050.      * @return \GuzzleHttp\Promise\PromiseInterface */
  35051.     public function getManualJournalAsyncWithHttpInfo($xero_tenant_id$manual_journal_id)
  35052.     {
  35053.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\ManualJournals';
  35054.         $request $this->getManualJournalRequest($xero_tenant_id$manual_journal_id);
  35055.         return $this->client
  35056.             ->sendAsync($request$this->createHttpClientOption())
  35057.             ->then(
  35058.                 function ($response) use ($returnType) {
  35059.                     $responseBody $response->getBody();
  35060.                     if ($returnType === '\SplFileObject') {
  35061.                         $content $responseBody//stream goes to serializer
  35062.                     } else {
  35063.                         $content $responseBody->getContents();
  35064.                     }
  35065.                     return [
  35066.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  35067.                         $response->getStatusCode(),
  35068.                         $response->getHeaders()
  35069.                     ];
  35070.                 },
  35071.                 function ($exception) {
  35072.                     $response $exception->getResponse();
  35073.                     $statusCode $response->getStatusCode();
  35074.                     throw new ApiException(
  35075.                         sprintf(
  35076.                             '[%d] Error connecting to the API (%s)',
  35077.                             $statusCode,
  35078.                             $exception->getRequest()->getUri()
  35079.                         ),
  35080.                         $statusCode,
  35081.                         $response->getHeaders(),
  35082.                         $response->getBody()
  35083.                     );
  35084.                 }
  35085.             );
  35086.     }
  35087.     /**
  35088.      * Create request for operation 'getManualJournal'
  35089.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  35090.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  35091.      * @throws \InvalidArgumentException
  35092.      * @return \GuzzleHttp\Psr7\Request  */
  35093.     protected function getManualJournalRequest($xero_tenant_id$manual_journal_id)
  35094.     {
  35095.         // verify the required parameter 'xero_tenant_id' is set
  35096.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  35097.             throw new \InvalidArgumentException(
  35098.                 'Missing the required parameter $xero_tenant_id when calling getManualJournal'
  35099.             );
  35100.         }
  35101.         // verify the required parameter 'manual_journal_id' is set
  35102.         if ($manual_journal_id === null || (is_array($manual_journal_id) && count($manual_journal_id) === 0)) {
  35103.             throw new \InvalidArgumentException(
  35104.                 'Missing the required parameter $manual_journal_id when calling getManualJournal'
  35105.             );
  35106.         }
  35107.         $resourcePath '/ManualJournals/{ManualJournalID}';
  35108.         $formParams = [];
  35109.         $queryParams = [];
  35110.         $headerParams = [];
  35111.         $httpBody '';
  35112.         $multipart false;
  35113.         // header params
  35114.         if ($xero_tenant_id !== null) {
  35115.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  35116.         }
  35117.         // path params
  35118.         if ($manual_journal_id !== null) {
  35119.             $resourcePath str_replace(
  35120.                 '{' 'ManualJournalID' '}',
  35121.                 AccountingObjectSerializer::toPathValue($manual_journal_id),
  35122.                 $resourcePath
  35123.             );
  35124.         }
  35125.         // body params
  35126.         $_tempBody null;
  35127.         if ($multipart) {
  35128.             $headers $this->headerSelector->selectHeadersForMultipart(
  35129.                 ['application/json']
  35130.             );
  35131.         } else {
  35132.             $headers $this->headerSelector->selectHeaders(
  35133.                 ['application/json'],
  35134.                 []
  35135.             );
  35136.         }
  35137.         // for model (json/xml)
  35138.         if (isset($_tempBody)) {
  35139.             // $_tempBody is the method argument, if present
  35140.             if ($headers['Content-Type'] === 'application/json') {
  35141.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  35142.             } else {
  35143.                 $httpBody $_tempBody;
  35144.             }
  35145.         } elseif (count($formParams) > 0) {
  35146.             if ($multipart) {
  35147.                 $multipartContents = [
  35148.                     [
  35149.                         'Content-type' => 'multipart/form-data',
  35150.                     ]
  35151.                 ];
  35152.                 
  35153.                 // for HTTP post (form)
  35154.                 $httpBody = new MultipartStream($multipartContents);
  35155.             } elseif ($headers['Content-Type'] === 'application/json') {
  35156.                 $httpBody \GuzzleHttp\json_encode($formParams);
  35157.             } else {
  35158.                 // for HTTP post (form)
  35159.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  35160.             }
  35161.         }
  35162.         // this endpoint requires OAuth (access token)
  35163.         if ($this->config->getAccessToken() !== null) {
  35164.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  35165.         }
  35166.         $defaultHeaders = [];
  35167.         if ($this->config->getUserAgent()) {
  35168.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  35169.         }
  35170.         $headers array_merge(
  35171.             $defaultHeaders,
  35172.             $headerParams,
  35173.             $headers
  35174.         );
  35175.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  35176.         return new Request(
  35177.             'GET',
  35178.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  35179.             $headers,
  35180.             $httpBody
  35181.         );
  35182.     }
  35183.     /**
  35184.      * Operation getManualJournalAttachmentByFileName
  35185.      * Retrieves a specific attachment from a specific manual journal by file name
  35186.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  35187.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  35188.      * @param  string $file_name Name of the attachment (required)
  35189.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  35190.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  35191.      * @throws \InvalidArgumentException
  35192.      * @return \SplFileObject
  35193.      */
  35194.     public function getManualJournalAttachmentByFileName($xero_tenant_id$manual_journal_id$file_name$content_type)
  35195.     {
  35196.         list($response) = $this->getManualJournalAttachmentByFileNameWithHttpInfo($xero_tenant_id$manual_journal_id$file_name$content_type);
  35197.         return $response;
  35198.     }
  35199.     /**
  35200.      * Operation getManualJournalAttachmentByFileNameWithHttpInfo
  35201.      * Retrieves a specific attachment from a specific manual journal by file name
  35202.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  35203.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  35204.      * @param  string $file_name Name of the attachment (required)
  35205.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  35206.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  35207.      * @throws \InvalidArgumentException
  35208.      * @return array of \SplFileObject, HTTP status code, HTTP response headers (array of strings)
  35209.      */
  35210.     public function getManualJournalAttachmentByFileNameWithHttpInfo($xero_tenant_id$manual_journal_id$file_name$content_type)
  35211.     {
  35212.         $request $this->getManualJournalAttachmentByFileNameRequest($xero_tenant_id$manual_journal_id$file_name$content_type);
  35213.         try {
  35214.             $options $this->createHttpClientOption();
  35215.             try {
  35216.                 $response $this->client->send($request$options);
  35217.             } catch (RequestException $e) {
  35218.                 throw new ApiException(
  35219.                     "[{$e->getCode()}{$e->getMessage()}",
  35220.                     $e->getCode(),
  35221.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  35222.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  35223.                 );
  35224.             }
  35225.             $statusCode $response->getStatusCode();
  35226.             if ($statusCode 200 || $statusCode 299) {
  35227.                 throw new ApiException(
  35228.                     sprintf(
  35229.                         '[%d] Error connecting to the API (%s)',
  35230.                         $statusCode,
  35231.                         $request->getUri()
  35232.                     ),
  35233.                     $statusCode,
  35234.                     $response->getHeaders(),
  35235.                     $response->getBody()
  35236.                 );
  35237.             }
  35238.             $responseBody $response->getBody();
  35239.             switch($statusCode) {
  35240.                 case 200:
  35241.                     if ('\SplFileObject' === '\SplFileObject') {
  35242.                         $content $responseBody//stream goes to serializer
  35243.                     } else {
  35244.                         $content $responseBody->getContents();
  35245.                     }
  35246.                     return [
  35247.                         AccountingObjectSerializer::deserialize($content'\SplFileObject', []),
  35248.                         $response->getStatusCode(),
  35249.                         $response->getHeaders()
  35250.                     ];
  35251.             }
  35252.             $returnType '\SplFileObject';
  35253.             $responseBody $response->getBody();
  35254.             if ($returnType === '\SplFileObject') {
  35255.                 $content $responseBody//stream goes to serializer
  35256.             } else {
  35257.                 $content $responseBody->getContents();
  35258.             }
  35259.             return [
  35260.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  35261.                 $response->getStatusCode(),
  35262.                 $response->getHeaders()
  35263.             ];
  35264.         } catch (ApiException $e) {
  35265.             switch ($e->getCode()) {
  35266.                 case 200:
  35267.                     $data AccountingObjectSerializer::deserialize(
  35268.                         $e->getResponseBody(),
  35269.                         '\SplFileObject',
  35270.                         $e->getResponseHeaders()
  35271.                     );
  35272.                     $e->setResponseObject($data);
  35273.                     break;
  35274.             }
  35275.             throw $e;
  35276.         }
  35277.     }
  35278.     /**
  35279.      * Operation getManualJournalAttachmentByFileNameAsync
  35280.      * Retrieves a specific attachment from a specific manual journal by file name
  35281.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  35282.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  35283.      * @param  string $file_name Name of the attachment (required)
  35284.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  35285.      * @throws \InvalidArgumentException
  35286.      * @return \GuzzleHttp\Promise\PromiseInterface
  35287.      */
  35288.     public function getManualJournalAttachmentByFileNameAsync($xero_tenant_id$manual_journal_id$file_name$content_type)
  35289.     {
  35290.         return $this->getManualJournalAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$manual_journal_id$file_name$content_type)
  35291.             ->then(
  35292.                 function ($response) {
  35293.                     return $response[0];
  35294.                 }
  35295.             );
  35296.     }
  35297.     /**
  35298.      * Operation getManualJournalAttachmentByFileNameAsyncWithHttpInfo
  35299.      * Retrieves a specific attachment from a specific manual journal by file name
  35300.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  35301.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  35302.      * @param  string $file_name Name of the attachment (required)
  35303.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  35304.      * @throws \InvalidArgumentException
  35305.      * @return \GuzzleHttp\Promise\PromiseInterface */
  35306.     public function getManualJournalAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$manual_journal_id$file_name$content_type)
  35307.     {
  35308.         $returnType '\SplFileObject';
  35309.         $request $this->getManualJournalAttachmentByFileNameRequest($xero_tenant_id$manual_journal_id$file_name$content_type);
  35310.         return $this->client
  35311.             ->sendAsync($request$this->createHttpClientOption())
  35312.             ->then(
  35313.                 function ($response) use ($returnType) {
  35314.                     $responseBody $response->getBody();
  35315.                     if ($returnType === '\SplFileObject') {
  35316.                         $content $responseBody//stream goes to serializer
  35317.                     } else {
  35318.                         $content $responseBody->getContents();
  35319.                     }
  35320.                     return [
  35321.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  35322.                         $response->getStatusCode(),
  35323.                         $response->getHeaders()
  35324.                     ];
  35325.                 },
  35326.                 function ($exception) {
  35327.                     $response $exception->getResponse();
  35328.                     $statusCode $response->getStatusCode();
  35329.                     throw new ApiException(
  35330.                         sprintf(
  35331.                             '[%d] Error connecting to the API (%s)',
  35332.                             $statusCode,
  35333.                             $exception->getRequest()->getUri()
  35334.                         ),
  35335.                         $statusCode,
  35336.                         $response->getHeaders(),
  35337.                         $response->getBody()
  35338.                     );
  35339.                 }
  35340.             );
  35341.     }
  35342.     /**
  35343.      * Create request for operation 'getManualJournalAttachmentByFileName'
  35344.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  35345.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  35346.      * @param  string $file_name Name of the attachment (required)
  35347.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  35348.      * @throws \InvalidArgumentException
  35349.      * @return \GuzzleHttp\Psr7\Request  */
  35350.     protected function getManualJournalAttachmentByFileNameRequest($xero_tenant_id$manual_journal_id$file_name$content_type)
  35351.     {
  35352.         // verify the required parameter 'xero_tenant_id' is set
  35353.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  35354.             throw new \InvalidArgumentException(
  35355.                 'Missing the required parameter $xero_tenant_id when calling getManualJournalAttachmentByFileName'
  35356.             );
  35357.         }
  35358.         // verify the required parameter 'manual_journal_id' is set
  35359.         if ($manual_journal_id === null || (is_array($manual_journal_id) && count($manual_journal_id) === 0)) {
  35360.             throw new \InvalidArgumentException(
  35361.                 'Missing the required parameter $manual_journal_id when calling getManualJournalAttachmentByFileName'
  35362.             );
  35363.         }
  35364.         // verify the required parameter 'file_name' is set
  35365.         if ($file_name === null || (is_array($file_name) && count($file_name) === 0)) {
  35366.             throw new \InvalidArgumentException(
  35367.                 'Missing the required parameter $file_name when calling getManualJournalAttachmentByFileName'
  35368.             );
  35369.         }
  35370.         // verify the required parameter 'content_type' is set
  35371.         if ($content_type === null || (is_array($content_type) && count($content_type) === 0)) {
  35372.             throw new \InvalidArgumentException(
  35373.                 'Missing the required parameter $content_type when calling getManualJournalAttachmentByFileName'
  35374.             );
  35375.         }
  35376.         $resourcePath '/ManualJournals/{ManualJournalID}/Attachments/{FileName}';
  35377.         $formParams = [];
  35378.         $queryParams = [];
  35379.         $headerParams = [];
  35380.         $httpBody '';
  35381.         $multipart false;
  35382.         // header params
  35383.         if ($xero_tenant_id !== null) {
  35384.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  35385.         }
  35386.         // header params
  35387.         if ($content_type !== null) {
  35388.             $headerParams['contentType'] = AccountingObjectSerializer::toHeaderValue($content_type);
  35389.         }
  35390.         // path params
  35391.         if ($manual_journal_id !== null) {
  35392.             $resourcePath str_replace(
  35393.                 '{' 'ManualJournalID' '}',
  35394.                 AccountingObjectSerializer::toPathValue($manual_journal_id),
  35395.                 $resourcePath
  35396.             );
  35397.         }
  35398.         // path params
  35399.         if ($file_name !== null) {
  35400.             $resourcePath str_replace(
  35401.                 '{' 'FileName' '}',
  35402.                 AccountingObjectSerializer::toPathValue($file_name),
  35403.                 $resourcePath
  35404.             );
  35405.         }
  35406.         // body params
  35407.         $_tempBody null;
  35408.         if ($multipart) {
  35409.             $headers $this->headerSelector->selectHeadersForMultipart(
  35410.                 ['application/octet-stream']
  35411.             );
  35412.         } else {
  35413.             $headers $this->headerSelector->selectHeaders(
  35414.                 ['application/octet-stream'],
  35415.                 []
  35416.             );
  35417.         }
  35418.         // for model (json/xml)
  35419.         if (isset($_tempBody)) {
  35420.             // $_tempBody is the method argument, if present
  35421.             if ($headers['Content-Type'] === 'application/json') {
  35422.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  35423.             } else {
  35424.                 $httpBody $_tempBody;
  35425.             }
  35426.         } elseif (count($formParams) > 0) {
  35427.             if ($multipart) {
  35428.                 $multipartContents = [
  35429.                     [
  35430.                         'Content-type' => 'multipart/form-data',
  35431.                     ]
  35432.                 ];
  35433.                 
  35434.                 // for HTTP post (form)
  35435.                 $httpBody = new MultipartStream($multipartContents);
  35436.             } elseif ($headers['Content-Type'] === 'application/json') {
  35437.                 $httpBody \GuzzleHttp\json_encode($formParams);
  35438.             } else {
  35439.                 // for HTTP post (form)
  35440.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  35441.             }
  35442.         }
  35443.         // this endpoint requires OAuth (access token)
  35444.         if ($this->config->getAccessToken() !== null) {
  35445.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  35446.         }
  35447.         $defaultHeaders = [];
  35448.         if ($this->config->getUserAgent()) {
  35449.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  35450.         }
  35451.         $headers array_merge(
  35452.             $defaultHeaders,
  35453.             $headerParams,
  35454.             $headers
  35455.         );
  35456.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  35457.         return new Request(
  35458.             'GET',
  35459.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  35460.             $headers,
  35461.             $httpBody
  35462.         );
  35463.     }
  35464.     /**
  35465.      * Operation getManualJournalAttachmentById
  35466.      * Allows you to retrieve a specific attachment from a specific manual journal using a unique attachment Id
  35467.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  35468.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  35469.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  35470.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  35471.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  35472.      * @throws \InvalidArgumentException
  35473.      * @return \SplFileObject
  35474.      */
  35475.     public function getManualJournalAttachmentById($xero_tenant_id$manual_journal_id$attachment_id$content_type)
  35476.     {
  35477.         list($response) = $this->getManualJournalAttachmentByIdWithHttpInfo($xero_tenant_id$manual_journal_id$attachment_id$content_type);
  35478.         return $response;
  35479.     }
  35480.     /**
  35481.      * Operation getManualJournalAttachmentByIdWithHttpInfo
  35482.      * Allows you to retrieve a specific attachment from a specific manual journal using a unique attachment Id
  35483.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  35484.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  35485.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  35486.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  35487.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  35488.      * @throws \InvalidArgumentException
  35489.      * @return array of \SplFileObject, HTTP status code, HTTP response headers (array of strings)
  35490.      */
  35491.     public function getManualJournalAttachmentByIdWithHttpInfo($xero_tenant_id$manual_journal_id$attachment_id$content_type)
  35492.     {
  35493.         $request $this->getManualJournalAttachmentByIdRequest($xero_tenant_id$manual_journal_id$attachment_id$content_type);
  35494.         try {
  35495.             $options $this->createHttpClientOption();
  35496.             try {
  35497.                 $response $this->client->send($request$options);
  35498.             } catch (RequestException $e) {
  35499.                 throw new ApiException(
  35500.                     "[{$e->getCode()}{$e->getMessage()}",
  35501.                     $e->getCode(),
  35502.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  35503.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  35504.                 );
  35505.             }
  35506.             $statusCode $response->getStatusCode();
  35507.             if ($statusCode 200 || $statusCode 299) {
  35508.                 throw new ApiException(
  35509.                     sprintf(
  35510.                         '[%d] Error connecting to the API (%s)',
  35511.                         $statusCode,
  35512.                         $request->getUri()
  35513.                     ),
  35514.                     $statusCode,
  35515.                     $response->getHeaders(),
  35516.                     $response->getBody()
  35517.                 );
  35518.             }
  35519.             $responseBody $response->getBody();
  35520.             switch($statusCode) {
  35521.                 case 200:
  35522.                     if ('\SplFileObject' === '\SplFileObject') {
  35523.                         $content $responseBody//stream goes to serializer
  35524.                     } else {
  35525.                         $content $responseBody->getContents();
  35526.                     }
  35527.                     return [
  35528.                         AccountingObjectSerializer::deserialize($content'\SplFileObject', []),
  35529.                         $response->getStatusCode(),
  35530.                         $response->getHeaders()
  35531.                     ];
  35532.             }
  35533.             $returnType '\SplFileObject';
  35534.             $responseBody $response->getBody();
  35535.             if ($returnType === '\SplFileObject') {
  35536.                 $content $responseBody//stream goes to serializer
  35537.             } else {
  35538.                 $content $responseBody->getContents();
  35539.             }
  35540.             return [
  35541.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  35542.                 $response->getStatusCode(),
  35543.                 $response->getHeaders()
  35544.             ];
  35545.         } catch (ApiException $e) {
  35546.             switch ($e->getCode()) {
  35547.                 case 200:
  35548.                     $data AccountingObjectSerializer::deserialize(
  35549.                         $e->getResponseBody(),
  35550.                         '\SplFileObject',
  35551.                         $e->getResponseHeaders()
  35552.                     );
  35553.                     $e->setResponseObject($data);
  35554.                     break;
  35555.             }
  35556.             throw $e;
  35557.         }
  35558.     }
  35559.     /**
  35560.      * Operation getManualJournalAttachmentByIdAsync
  35561.      * Allows you to retrieve a specific attachment from a specific manual journal using a unique attachment Id
  35562.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  35563.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  35564.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  35565.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  35566.      * @throws \InvalidArgumentException
  35567.      * @return \GuzzleHttp\Promise\PromiseInterface
  35568.      */
  35569.     public function getManualJournalAttachmentByIdAsync($xero_tenant_id$manual_journal_id$attachment_id$content_type)
  35570.     {
  35571.         return $this->getManualJournalAttachmentByIdAsyncWithHttpInfo($xero_tenant_id$manual_journal_id$attachment_id$content_type)
  35572.             ->then(
  35573.                 function ($response) {
  35574.                     return $response[0];
  35575.                 }
  35576.             );
  35577.     }
  35578.     /**
  35579.      * Operation getManualJournalAttachmentByIdAsyncWithHttpInfo
  35580.      * Allows you to retrieve a specific attachment from a specific manual journal using a unique attachment Id
  35581.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  35582.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  35583.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  35584.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  35585.      * @throws \InvalidArgumentException
  35586.      * @return \GuzzleHttp\Promise\PromiseInterface */
  35587.     public function getManualJournalAttachmentByIdAsyncWithHttpInfo($xero_tenant_id$manual_journal_id$attachment_id$content_type)
  35588.     {
  35589.         $returnType '\SplFileObject';
  35590.         $request $this->getManualJournalAttachmentByIdRequest($xero_tenant_id$manual_journal_id$attachment_id$content_type);
  35591.         return $this->client
  35592.             ->sendAsync($request$this->createHttpClientOption())
  35593.             ->then(
  35594.                 function ($response) use ($returnType) {
  35595.                     $responseBody $response->getBody();
  35596.                     if ($returnType === '\SplFileObject') {
  35597.                         $content $responseBody//stream goes to serializer
  35598.                     } else {
  35599.                         $content $responseBody->getContents();
  35600.                     }
  35601.                     return [
  35602.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  35603.                         $response->getStatusCode(),
  35604.                         $response->getHeaders()
  35605.                     ];
  35606.                 },
  35607.                 function ($exception) {
  35608.                     $response $exception->getResponse();
  35609.                     $statusCode $response->getStatusCode();
  35610.                     throw new ApiException(
  35611.                         sprintf(
  35612.                             '[%d] Error connecting to the API (%s)',
  35613.                             $statusCode,
  35614.                             $exception->getRequest()->getUri()
  35615.                         ),
  35616.                         $statusCode,
  35617.                         $response->getHeaders(),
  35618.                         $response->getBody()
  35619.                     );
  35620.                 }
  35621.             );
  35622.     }
  35623.     /**
  35624.      * Create request for operation 'getManualJournalAttachmentById'
  35625.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  35626.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  35627.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  35628.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  35629.      * @throws \InvalidArgumentException
  35630.      * @return \GuzzleHttp\Psr7\Request  */
  35631.     protected function getManualJournalAttachmentByIdRequest($xero_tenant_id$manual_journal_id$attachment_id$content_type)
  35632.     {
  35633.         // verify the required parameter 'xero_tenant_id' is set
  35634.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  35635.             throw new \InvalidArgumentException(
  35636.                 'Missing the required parameter $xero_tenant_id when calling getManualJournalAttachmentById'
  35637.             );
  35638.         }
  35639.         // verify the required parameter 'manual_journal_id' is set
  35640.         if ($manual_journal_id === null || (is_array($manual_journal_id) && count($manual_journal_id) === 0)) {
  35641.             throw new \InvalidArgumentException(
  35642.                 'Missing the required parameter $manual_journal_id when calling getManualJournalAttachmentById'
  35643.             );
  35644.         }
  35645.         // verify the required parameter 'attachment_id' is set
  35646.         if ($attachment_id === null || (is_array($attachment_id) && count($attachment_id) === 0)) {
  35647.             throw new \InvalidArgumentException(
  35648.                 'Missing the required parameter $attachment_id when calling getManualJournalAttachmentById'
  35649.             );
  35650.         }
  35651.         // verify the required parameter 'content_type' is set
  35652.         if ($content_type === null || (is_array($content_type) && count($content_type) === 0)) {
  35653.             throw new \InvalidArgumentException(
  35654.                 'Missing the required parameter $content_type when calling getManualJournalAttachmentById'
  35655.             );
  35656.         }
  35657.         $resourcePath '/ManualJournals/{ManualJournalID}/Attachments/{AttachmentID}';
  35658.         $formParams = [];
  35659.         $queryParams = [];
  35660.         $headerParams = [];
  35661.         $httpBody '';
  35662.         $multipart false;
  35663.         // header params
  35664.         if ($xero_tenant_id !== null) {
  35665.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  35666.         }
  35667.         // header params
  35668.         if ($content_type !== null) {
  35669.             $headerParams['contentType'] = AccountingObjectSerializer::toHeaderValue($content_type);
  35670.         }
  35671.         // path params
  35672.         if ($manual_journal_id !== null) {
  35673.             $resourcePath str_replace(
  35674.                 '{' 'ManualJournalID' '}',
  35675.                 AccountingObjectSerializer::toPathValue($manual_journal_id),
  35676.                 $resourcePath
  35677.             );
  35678.         }
  35679.         // path params
  35680.         if ($attachment_id !== null) {
  35681.             $resourcePath str_replace(
  35682.                 '{' 'AttachmentID' '}',
  35683.                 AccountingObjectSerializer::toPathValue($attachment_id),
  35684.                 $resourcePath
  35685.             );
  35686.         }
  35687.         // body params
  35688.         $_tempBody null;
  35689.         if ($multipart) {
  35690.             $headers $this->headerSelector->selectHeadersForMultipart(
  35691.                 ['application/octet-stream']
  35692.             );
  35693.         } else {
  35694.             $headers $this->headerSelector->selectHeaders(
  35695.                 ['application/octet-stream'],
  35696.                 []
  35697.             );
  35698.         }
  35699.         // for model (json/xml)
  35700.         if (isset($_tempBody)) {
  35701.             // $_tempBody is the method argument, if present
  35702.             if ($headers['Content-Type'] === 'application/json') {
  35703.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  35704.             } else {
  35705.                 $httpBody $_tempBody;
  35706.             }
  35707.         } elseif (count($formParams) > 0) {
  35708.             if ($multipart) {
  35709.                 $multipartContents = [
  35710.                     [
  35711.                         'Content-type' => 'multipart/form-data',
  35712.                     ]
  35713.                 ];
  35714.                 
  35715.                 // for HTTP post (form)
  35716.                 $httpBody = new MultipartStream($multipartContents);
  35717.             } elseif ($headers['Content-Type'] === 'application/json') {
  35718.                 $httpBody \GuzzleHttp\json_encode($formParams);
  35719.             } else {
  35720.                 // for HTTP post (form)
  35721.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  35722.             }
  35723.         }
  35724.         // this endpoint requires OAuth (access token)
  35725.         if ($this->config->getAccessToken() !== null) {
  35726.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  35727.         }
  35728.         $defaultHeaders = [];
  35729.         if ($this->config->getUserAgent()) {
  35730.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  35731.         }
  35732.         $headers array_merge(
  35733.             $defaultHeaders,
  35734.             $headerParams,
  35735.             $headers
  35736.         );
  35737.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  35738.         return new Request(
  35739.             'GET',
  35740.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  35741.             $headers,
  35742.             $httpBody
  35743.         );
  35744.     }
  35745.     /**
  35746.      * Operation getManualJournalAttachments
  35747.      * Retrieves attachment for a specific manual journal
  35748.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  35749.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  35750.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  35751.      * @throws \InvalidArgumentException
  35752.      * @return \XeroAPI\XeroPHP\Models\Accounting\Attachments
  35753.      */
  35754.     public function getManualJournalAttachments($xero_tenant_id$manual_journal_id)
  35755.     {
  35756.         list($response) = $this->getManualJournalAttachmentsWithHttpInfo($xero_tenant_id$manual_journal_id);
  35757.         return $response;
  35758.     }
  35759.     /**
  35760.      * Operation getManualJournalAttachmentsWithHttpInfo
  35761.      * Retrieves attachment for a specific manual journal
  35762.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  35763.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  35764.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  35765.      * @throws \InvalidArgumentException
  35766.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Attachments, HTTP status code, HTTP response headers (array of strings)
  35767.      */
  35768.     public function getManualJournalAttachmentsWithHttpInfo($xero_tenant_id$manual_journal_id)
  35769.     {
  35770.         $request $this->getManualJournalAttachmentsRequest($xero_tenant_id$manual_journal_id);
  35771.         try {
  35772.             $options $this->createHttpClientOption();
  35773.             try {
  35774.                 $response $this->client->send($request$options);
  35775.             } catch (RequestException $e) {
  35776.                 throw new ApiException(
  35777.                     "[{$e->getCode()}{$e->getMessage()}",
  35778.                     $e->getCode(),
  35779.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  35780.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  35781.                 );
  35782.             }
  35783.             $statusCode $response->getStatusCode();
  35784.             if ($statusCode 200 || $statusCode 299) {
  35785.                 throw new ApiException(
  35786.                     sprintf(
  35787.                         '[%d] Error connecting to the API (%s)',
  35788.                         $statusCode,
  35789.                         $request->getUri()
  35790.                     ),
  35791.                     $statusCode,
  35792.                     $response->getHeaders(),
  35793.                     $response->getBody()
  35794.                 );
  35795.             }
  35796.             $responseBody $response->getBody();
  35797.             switch($statusCode) {
  35798.                 case 200:
  35799.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Attachments' === '\SplFileObject') {
  35800.                         $content $responseBody//stream goes to serializer
  35801.                     } else {
  35802.                         $content $responseBody->getContents();
  35803.                     }
  35804.                     return [
  35805.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Attachments', []),
  35806.                         $response->getStatusCode(),
  35807.                         $response->getHeaders()
  35808.                     ];
  35809.             }
  35810.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  35811.             $responseBody $response->getBody();
  35812.             if ($returnType === '\SplFileObject') {
  35813.                 $content $responseBody//stream goes to serializer
  35814.             } else {
  35815.                 $content $responseBody->getContents();
  35816.             }
  35817.             return [
  35818.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  35819.                 $response->getStatusCode(),
  35820.                 $response->getHeaders()
  35821.             ];
  35822.         } catch (ApiException $e) {
  35823.             switch ($e->getCode()) {
  35824.                 case 200:
  35825.                     $data AccountingObjectSerializer::deserialize(
  35826.                         $e->getResponseBody(),
  35827.                         '\XeroAPI\XeroPHP\Models\Accounting\Attachments',
  35828.                         $e->getResponseHeaders()
  35829.                     );
  35830.                     $e->setResponseObject($data);
  35831.                     break;
  35832.             }
  35833.             throw $e;
  35834.         }
  35835.     }
  35836.     /**
  35837.      * Operation getManualJournalAttachmentsAsync
  35838.      * Retrieves attachment for a specific manual journal
  35839.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  35840.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  35841.      * @throws \InvalidArgumentException
  35842.      * @return \GuzzleHttp\Promise\PromiseInterface
  35843.      */
  35844.     public function getManualJournalAttachmentsAsync($xero_tenant_id$manual_journal_id)
  35845.     {
  35846.         return $this->getManualJournalAttachmentsAsyncWithHttpInfo($xero_tenant_id$manual_journal_id)
  35847.             ->then(
  35848.                 function ($response) {
  35849.                     return $response[0];
  35850.                 }
  35851.             );
  35852.     }
  35853.     /**
  35854.      * Operation getManualJournalAttachmentsAsyncWithHttpInfo
  35855.      * Retrieves attachment for a specific manual journal
  35856.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  35857.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  35858.      * @throws \InvalidArgumentException
  35859.      * @return \GuzzleHttp\Promise\PromiseInterface */
  35860.     public function getManualJournalAttachmentsAsyncWithHttpInfo($xero_tenant_id$manual_journal_id)
  35861.     {
  35862.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  35863.         $request $this->getManualJournalAttachmentsRequest($xero_tenant_id$manual_journal_id);
  35864.         return $this->client
  35865.             ->sendAsync($request$this->createHttpClientOption())
  35866.             ->then(
  35867.                 function ($response) use ($returnType) {
  35868.                     $responseBody $response->getBody();
  35869.                     if ($returnType === '\SplFileObject') {
  35870.                         $content $responseBody//stream goes to serializer
  35871.                     } else {
  35872.                         $content $responseBody->getContents();
  35873.                     }
  35874.                     return [
  35875.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  35876.                         $response->getStatusCode(),
  35877.                         $response->getHeaders()
  35878.                     ];
  35879.                 },
  35880.                 function ($exception) {
  35881.                     $response $exception->getResponse();
  35882.                     $statusCode $response->getStatusCode();
  35883.                     throw new ApiException(
  35884.                         sprintf(
  35885.                             '[%d] Error connecting to the API (%s)',
  35886.                             $statusCode,
  35887.                             $exception->getRequest()->getUri()
  35888.                         ),
  35889.                         $statusCode,
  35890.                         $response->getHeaders(),
  35891.                         $response->getBody()
  35892.                     );
  35893.                 }
  35894.             );
  35895.     }
  35896.     /**
  35897.      * Create request for operation 'getManualJournalAttachments'
  35898.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  35899.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  35900.      * @throws \InvalidArgumentException
  35901.      * @return \GuzzleHttp\Psr7\Request  */
  35902.     protected function getManualJournalAttachmentsRequest($xero_tenant_id$manual_journal_id)
  35903.     {
  35904.         // verify the required parameter 'xero_tenant_id' is set
  35905.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  35906.             throw new \InvalidArgumentException(
  35907.                 'Missing the required parameter $xero_tenant_id when calling getManualJournalAttachments'
  35908.             );
  35909.         }
  35910.         // verify the required parameter 'manual_journal_id' is set
  35911.         if ($manual_journal_id === null || (is_array($manual_journal_id) && count($manual_journal_id) === 0)) {
  35912.             throw new \InvalidArgumentException(
  35913.                 'Missing the required parameter $manual_journal_id when calling getManualJournalAttachments'
  35914.             );
  35915.         }
  35916.         $resourcePath '/ManualJournals/{ManualJournalID}/Attachments';
  35917.         $formParams = [];
  35918.         $queryParams = [];
  35919.         $headerParams = [];
  35920.         $httpBody '';
  35921.         $multipart false;
  35922.         // header params
  35923.         if ($xero_tenant_id !== null) {
  35924.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  35925.         }
  35926.         // path params
  35927.         if ($manual_journal_id !== null) {
  35928.             $resourcePath str_replace(
  35929.                 '{' 'ManualJournalID' '}',
  35930.                 AccountingObjectSerializer::toPathValue($manual_journal_id),
  35931.                 $resourcePath
  35932.             );
  35933.         }
  35934.         // body params
  35935.         $_tempBody null;
  35936.         if ($multipart) {
  35937.             $headers $this->headerSelector->selectHeadersForMultipart(
  35938.                 ['application/json']
  35939.             );
  35940.         } else {
  35941.             $headers $this->headerSelector->selectHeaders(
  35942.                 ['application/json'],
  35943.                 []
  35944.             );
  35945.         }
  35946.         // for model (json/xml)
  35947.         if (isset($_tempBody)) {
  35948.             // $_tempBody is the method argument, if present
  35949.             if ($headers['Content-Type'] === 'application/json') {
  35950.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  35951.             } else {
  35952.                 $httpBody $_tempBody;
  35953.             }
  35954.         } elseif (count($formParams) > 0) {
  35955.             if ($multipart) {
  35956.                 $multipartContents = [
  35957.                     [
  35958.                         'Content-type' => 'multipart/form-data',
  35959.                     ]
  35960.                 ];
  35961.                 
  35962.                 // for HTTP post (form)
  35963.                 $httpBody = new MultipartStream($multipartContents);
  35964.             } elseif ($headers['Content-Type'] === 'application/json') {
  35965.                 $httpBody \GuzzleHttp\json_encode($formParams);
  35966.             } else {
  35967.                 // for HTTP post (form)
  35968.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  35969.             }
  35970.         }
  35971.         // this endpoint requires OAuth (access token)
  35972.         if ($this->config->getAccessToken() !== null) {
  35973.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  35974.         }
  35975.         $defaultHeaders = [];
  35976.         if ($this->config->getUserAgent()) {
  35977.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  35978.         }
  35979.         $headers array_merge(
  35980.             $defaultHeaders,
  35981.             $headerParams,
  35982.             $headers
  35983.         );
  35984.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  35985.         return new Request(
  35986.             'GET',
  35987.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  35988.             $headers,
  35989.             $httpBody
  35990.         );
  35991.     }
  35992.     /**
  35993.      * Operation getManualJournals
  35994.      * Retrieves manual journals
  35995.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  35996.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  35997.      * @param  string $where Filter by an any element (optional)
  35998.      * @param  string $order Order by an any element (optional)
  35999.      * @param  int $page e.g. page&#x3D;1 â€“ Up to 100 manual journals will be returned in a single API call with line items shown for each overpayment (optional)
  36000.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  36001.      * @throws \InvalidArgumentException
  36002.      * @return \XeroAPI\XeroPHP\Models\Accounting\ManualJournals
  36003.      */
  36004.     public function getManualJournals($xero_tenant_id$if_modified_since null$where null$order null$page null)
  36005.     {
  36006.         list($response) = $this->getManualJournalsWithHttpInfo($xero_tenant_id$if_modified_since$where$order$page);
  36007.         return $response;
  36008.     }
  36009.     /**
  36010.      * Operation getManualJournalsWithHttpInfo
  36011.      * Retrieves manual journals
  36012.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  36013.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  36014.      * @param  string $where Filter by an any element (optional)
  36015.      * @param  string $order Order by an any element (optional)
  36016.      * @param  int $page e.g. page&#x3D;1 â€“ Up to 100 manual journals will be returned in a single API call with line items shown for each overpayment (optional)
  36017.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  36018.      * @throws \InvalidArgumentException
  36019.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\ManualJournals, HTTP status code, HTTP response headers (array of strings)
  36020.      */
  36021.     public function getManualJournalsWithHttpInfo($xero_tenant_id$if_modified_since null$where null$order null$page null)
  36022.     {
  36023.         $request $this->getManualJournalsRequest($xero_tenant_id$if_modified_since$where$order$page);
  36024.         try {
  36025.             $options $this->createHttpClientOption();
  36026.             try {
  36027.                 $response $this->client->send($request$options);
  36028.             } catch (RequestException $e) {
  36029.                 throw new ApiException(
  36030.                     "[{$e->getCode()}{$e->getMessage()}",
  36031.                     $e->getCode(),
  36032.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  36033.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  36034.                 );
  36035.             }
  36036.             $statusCode $response->getStatusCode();
  36037.             if ($statusCode 200 || $statusCode 299) {
  36038.                 throw new ApiException(
  36039.                     sprintf(
  36040.                         '[%d] Error connecting to the API (%s)',
  36041.                         $statusCode,
  36042.                         $request->getUri()
  36043.                     ),
  36044.                     $statusCode,
  36045.                     $response->getHeaders(),
  36046.                     $response->getBody()
  36047.                 );
  36048.             }
  36049.             $responseBody $response->getBody();
  36050.             switch($statusCode) {
  36051.                 case 200:
  36052.                     if ('\XeroAPI\XeroPHP\Models\Accounting\ManualJournals' === '\SplFileObject') {
  36053.                         $content $responseBody//stream goes to serializer
  36054.                     } else {
  36055.                         $content $responseBody->getContents();
  36056.                     }
  36057.                     return [
  36058.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\ManualJournals', []),
  36059.                         $response->getStatusCode(),
  36060.                         $response->getHeaders()
  36061.                     ];
  36062.             }
  36063.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\ManualJournals';
  36064.             $responseBody $response->getBody();
  36065.             if ($returnType === '\SplFileObject') {
  36066.                 $content $responseBody//stream goes to serializer
  36067.             } else {
  36068.                 $content $responseBody->getContents();
  36069.             }
  36070.             return [
  36071.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  36072.                 $response->getStatusCode(),
  36073.                 $response->getHeaders()
  36074.             ];
  36075.         } catch (ApiException $e) {
  36076.             switch ($e->getCode()) {
  36077.                 case 200:
  36078.                     $data AccountingObjectSerializer::deserialize(
  36079.                         $e->getResponseBody(),
  36080.                         '\XeroAPI\XeroPHP\Models\Accounting\ManualJournals',
  36081.                         $e->getResponseHeaders()
  36082.                     );
  36083.                     $e->setResponseObject($data);
  36084.                     break;
  36085.             }
  36086.             throw $e;
  36087.         }
  36088.     }
  36089.     /**
  36090.      * Operation getManualJournalsAsync
  36091.      * Retrieves manual journals
  36092.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  36093.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  36094.      * @param  string $where Filter by an any element (optional)
  36095.      * @param  string $order Order by an any element (optional)
  36096.      * @param  int $page e.g. page&#x3D;1 â€“ Up to 100 manual journals will be returned in a single API call with line items shown for each overpayment (optional)
  36097.      * @throws \InvalidArgumentException
  36098.      * @return \GuzzleHttp\Promise\PromiseInterface
  36099.      */
  36100.     public function getManualJournalsAsync($xero_tenant_id$if_modified_since null$where null$order null$page null)
  36101.     {
  36102.         return $this->getManualJournalsAsyncWithHttpInfo($xero_tenant_id$if_modified_since$where$order$page)
  36103.             ->then(
  36104.                 function ($response) {
  36105.                     return $response[0];
  36106.                 }
  36107.             );
  36108.     }
  36109.     /**
  36110.      * Operation getManualJournalsAsyncWithHttpInfo
  36111.      * Retrieves manual journals
  36112.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  36113.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  36114.      * @param  string $where Filter by an any element (optional)
  36115.      * @param  string $order Order by an any element (optional)
  36116.      * @param  int $page e.g. page&#x3D;1 â€“ Up to 100 manual journals will be returned in a single API call with line items shown for each overpayment (optional)
  36117.      * @throws \InvalidArgumentException
  36118.      * @return \GuzzleHttp\Promise\PromiseInterface */
  36119.     public function getManualJournalsAsyncWithHttpInfo($xero_tenant_id$if_modified_since null$where null$order null$page null)
  36120.     {
  36121.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\ManualJournals';
  36122.         $request $this->getManualJournalsRequest($xero_tenant_id$if_modified_since$where$order$page);
  36123.         return $this->client
  36124.             ->sendAsync($request$this->createHttpClientOption())
  36125.             ->then(
  36126.                 function ($response) use ($returnType) {
  36127.                     $responseBody $response->getBody();
  36128.                     if ($returnType === '\SplFileObject') {
  36129.                         $content $responseBody//stream goes to serializer
  36130.                     } else {
  36131.                         $content $responseBody->getContents();
  36132.                     }
  36133.                     return [
  36134.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  36135.                         $response->getStatusCode(),
  36136.                         $response->getHeaders()
  36137.                     ];
  36138.                 },
  36139.                 function ($exception) {
  36140.                     $response $exception->getResponse();
  36141.                     $statusCode $response->getStatusCode();
  36142.                     throw new ApiException(
  36143.                         sprintf(
  36144.                             '[%d] Error connecting to the API (%s)',
  36145.                             $statusCode,
  36146.                             $exception->getRequest()->getUri()
  36147.                         ),
  36148.                         $statusCode,
  36149.                         $response->getHeaders(),
  36150.                         $response->getBody()
  36151.                     );
  36152.                 }
  36153.             );
  36154.     }
  36155.     /**
  36156.      * Create request for operation 'getManualJournals'
  36157.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  36158.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  36159.      * @param  string $where Filter by an any element (optional)
  36160.      * @param  string $order Order by an any element (optional)
  36161.      * @param  int $page e.g. page&#x3D;1 â€“ Up to 100 manual journals will be returned in a single API call with line items shown for each overpayment (optional)
  36162.      * @throws \InvalidArgumentException
  36163.      * @return \GuzzleHttp\Psr7\Request  */
  36164.     protected function getManualJournalsRequest($xero_tenant_id$if_modified_since null$where null$order null$page null)
  36165.     {
  36166.         // verify the required parameter 'xero_tenant_id' is set
  36167.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  36168.             throw new \InvalidArgumentException(
  36169.                 'Missing the required parameter $xero_tenant_id when calling getManualJournals'
  36170.             );
  36171.         }
  36172.         $resourcePath '/ManualJournals';
  36173.         $formParams = [];
  36174.         $queryParams = [];
  36175.         $headerParams = [];
  36176.         $httpBody '';
  36177.         $multipart false;
  36178.         // query params
  36179.         if ($where !== null) {
  36180.             $queryParams['where'] = AccountingObjectSerializer::toQueryValue($where);
  36181.         }
  36182.         // query params
  36183.         if ($order !== null) {
  36184.             $queryParams['order'] = AccountingObjectSerializer::toQueryValue($order);
  36185.         }
  36186.         // query params
  36187.         if ($page !== null) {
  36188.             $queryParams['page'] = AccountingObjectSerializer::toQueryValue($page);
  36189.         }
  36190.         // header params
  36191.         if ($xero_tenant_id !== null) {
  36192.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  36193.         }
  36194.         // header params
  36195.         if ($if_modified_since !== null) {
  36196.             $headerParams['If-Modified-Since'] = AccountingObjectSerializer::toHeaderValue($if_modified_since);
  36197.         }
  36198.         // body params
  36199.         $_tempBody null;
  36200.         if ($multipart) {
  36201.             $headers $this->headerSelector->selectHeadersForMultipart(
  36202.                 ['application/json']
  36203.             );
  36204.         } else {
  36205.             $headers $this->headerSelector->selectHeaders(
  36206.                 ['application/json'],
  36207.                 []
  36208.             );
  36209.         }
  36210.         // for model (json/xml)
  36211.         if (isset($_tempBody)) {
  36212.             // $_tempBody is the method argument, if present
  36213.             if ($headers['Content-Type'] === 'application/json') {
  36214.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  36215.             } else {
  36216.                 $httpBody $_tempBody;
  36217.             }
  36218.         } elseif (count($formParams) > 0) {
  36219.             if ($multipart) {
  36220.                 $multipartContents = [
  36221.                     [
  36222.                         'Content-type' => 'multipart/form-data',
  36223.                     ]
  36224.                 ];
  36225.                 
  36226.                 // for HTTP post (form)
  36227.                 $httpBody = new MultipartStream($multipartContents);
  36228.             } elseif ($headers['Content-Type'] === 'application/json') {
  36229.                 $httpBody \GuzzleHttp\json_encode($formParams);
  36230.             } else {
  36231.                 // for HTTP post (form)
  36232.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  36233.             }
  36234.         }
  36235.         // this endpoint requires OAuth (access token)
  36236.         if ($this->config->getAccessToken() !== null) {
  36237.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  36238.         }
  36239.         $defaultHeaders = [];
  36240.         if ($this->config->getUserAgent()) {
  36241.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  36242.         }
  36243.         $headers array_merge(
  36244.             $defaultHeaders,
  36245.             $headerParams,
  36246.             $headers
  36247.         );
  36248.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  36249.         return new Request(
  36250.             'GET',
  36251.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  36252.             $headers,
  36253.             $httpBody
  36254.         );
  36255.     }
  36256.     /**
  36257.      * Operation getManualJournalsHistory
  36258.      * Retrieves history for a specific manual journal
  36259.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  36260.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  36261.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  36262.      * @throws \InvalidArgumentException
  36263.      * @return \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords
  36264.      */
  36265.     public function getManualJournalsHistory($xero_tenant_id$manual_journal_id)
  36266.     {
  36267.         list($response) = $this->getManualJournalsHistoryWithHttpInfo($xero_tenant_id$manual_journal_id);
  36268.         return $response;
  36269.     }
  36270.     /**
  36271.      * Operation getManualJournalsHistoryWithHttpInfo
  36272.      * Retrieves history for a specific manual journal
  36273.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  36274.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  36275.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  36276.      * @throws \InvalidArgumentException
  36277.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords, HTTP status code, HTTP response headers (array of strings)
  36278.      */
  36279.     public function getManualJournalsHistoryWithHttpInfo($xero_tenant_id$manual_journal_id)
  36280.     {
  36281.         $request $this->getManualJournalsHistoryRequest($xero_tenant_id$manual_journal_id);
  36282.         try {
  36283.             $options $this->createHttpClientOption();
  36284.             try {
  36285.                 $response $this->client->send($request$options);
  36286.             } catch (RequestException $e) {
  36287.                 throw new ApiException(
  36288.                     "[{$e->getCode()}{$e->getMessage()}",
  36289.                     $e->getCode(),
  36290.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  36291.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  36292.                 );
  36293.             }
  36294.             $statusCode $response->getStatusCode();
  36295.             if ($statusCode 200 || $statusCode 299) {
  36296.                 throw new ApiException(
  36297.                     sprintf(
  36298.                         '[%d] Error connecting to the API (%s)',
  36299.                         $statusCode,
  36300.                         $request->getUri()
  36301.                     ),
  36302.                     $statusCode,
  36303.                     $response->getHeaders(),
  36304.                     $response->getBody()
  36305.                 );
  36306.             }
  36307.             $responseBody $response->getBody();
  36308.             switch($statusCode) {
  36309.                 case 200:
  36310.                     if ('\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords' === '\SplFileObject') {
  36311.                         $content $responseBody//stream goes to serializer
  36312.                     } else {
  36313.                         $content $responseBody->getContents();
  36314.                     }
  36315.                     return [
  36316.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords', []),
  36317.                         $response->getStatusCode(),
  36318.                         $response->getHeaders()
  36319.                     ];
  36320.             }
  36321.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  36322.             $responseBody $response->getBody();
  36323.             if ($returnType === '\SplFileObject') {
  36324.                 $content $responseBody//stream goes to serializer
  36325.             } else {
  36326.                 $content $responseBody->getContents();
  36327.             }
  36328.             return [
  36329.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  36330.                 $response->getStatusCode(),
  36331.                 $response->getHeaders()
  36332.             ];
  36333.         } catch (ApiException $e) {
  36334.             switch ($e->getCode()) {
  36335.                 case 200:
  36336.                     $data AccountingObjectSerializer::deserialize(
  36337.                         $e->getResponseBody(),
  36338.                         '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords',
  36339.                         $e->getResponseHeaders()
  36340.                     );
  36341.                     $e->setResponseObject($data);
  36342.                     break;
  36343.             }
  36344.             throw $e;
  36345.         }
  36346.     }
  36347.     /**
  36348.      * Operation getManualJournalsHistoryAsync
  36349.      * Retrieves history for a specific manual journal
  36350.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  36351.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  36352.      * @throws \InvalidArgumentException
  36353.      * @return \GuzzleHttp\Promise\PromiseInterface
  36354.      */
  36355.     public function getManualJournalsHistoryAsync($xero_tenant_id$manual_journal_id)
  36356.     {
  36357.         return $this->getManualJournalsHistoryAsyncWithHttpInfo($xero_tenant_id$manual_journal_id)
  36358.             ->then(
  36359.                 function ($response) {
  36360.                     return $response[0];
  36361.                 }
  36362.             );
  36363.     }
  36364.     /**
  36365.      * Operation getManualJournalsHistoryAsyncWithHttpInfo
  36366.      * Retrieves history for a specific manual journal
  36367.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  36368.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  36369.      * @throws \InvalidArgumentException
  36370.      * @return \GuzzleHttp\Promise\PromiseInterface */
  36371.     public function getManualJournalsHistoryAsyncWithHttpInfo($xero_tenant_id$manual_journal_id)
  36372.     {
  36373.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  36374.         $request $this->getManualJournalsHistoryRequest($xero_tenant_id$manual_journal_id);
  36375.         return $this->client
  36376.             ->sendAsync($request$this->createHttpClientOption())
  36377.             ->then(
  36378.                 function ($response) use ($returnType) {
  36379.                     $responseBody $response->getBody();
  36380.                     if ($returnType === '\SplFileObject') {
  36381.                         $content $responseBody//stream goes to serializer
  36382.                     } else {
  36383.                         $content $responseBody->getContents();
  36384.                     }
  36385.                     return [
  36386.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  36387.                         $response->getStatusCode(),
  36388.                         $response->getHeaders()
  36389.                     ];
  36390.                 },
  36391.                 function ($exception) {
  36392.                     $response $exception->getResponse();
  36393.                     $statusCode $response->getStatusCode();
  36394.                     throw new ApiException(
  36395.                         sprintf(
  36396.                             '[%d] Error connecting to the API (%s)',
  36397.                             $statusCode,
  36398.                             $exception->getRequest()->getUri()
  36399.                         ),
  36400.                         $statusCode,
  36401.                         $response->getHeaders(),
  36402.                         $response->getBody()
  36403.                     );
  36404.                 }
  36405.             );
  36406.     }
  36407.     /**
  36408.      * Create request for operation 'getManualJournalsHistory'
  36409.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  36410.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  36411.      * @throws \InvalidArgumentException
  36412.      * @return \GuzzleHttp\Psr7\Request  */
  36413.     protected function getManualJournalsHistoryRequest($xero_tenant_id$manual_journal_id)
  36414.     {
  36415.         // verify the required parameter 'xero_tenant_id' is set
  36416.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  36417.             throw new \InvalidArgumentException(
  36418.                 'Missing the required parameter $xero_tenant_id when calling getManualJournalsHistory'
  36419.             );
  36420.         }
  36421.         // verify the required parameter 'manual_journal_id' is set
  36422.         if ($manual_journal_id === null || (is_array($manual_journal_id) && count($manual_journal_id) === 0)) {
  36423.             throw new \InvalidArgumentException(
  36424.                 'Missing the required parameter $manual_journal_id when calling getManualJournalsHistory'
  36425.             );
  36426.         }
  36427.         $resourcePath '/ManualJournals/{ManualJournalID}/History';
  36428.         $formParams = [];
  36429.         $queryParams = [];
  36430.         $headerParams = [];
  36431.         $httpBody '';
  36432.         $multipart false;
  36433.         // header params
  36434.         if ($xero_tenant_id !== null) {
  36435.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  36436.         }
  36437.         // path params
  36438.         if ($manual_journal_id !== null) {
  36439.             $resourcePath str_replace(
  36440.                 '{' 'ManualJournalID' '}',
  36441.                 AccountingObjectSerializer::toPathValue($manual_journal_id),
  36442.                 $resourcePath
  36443.             );
  36444.         }
  36445.         // body params
  36446.         $_tempBody null;
  36447.         if ($multipart) {
  36448.             $headers $this->headerSelector->selectHeadersForMultipart(
  36449.                 ['application/json']
  36450.             );
  36451.         } else {
  36452.             $headers $this->headerSelector->selectHeaders(
  36453.                 ['application/json'],
  36454.                 []
  36455.             );
  36456.         }
  36457.         // for model (json/xml)
  36458.         if (isset($_tempBody)) {
  36459.             // $_tempBody is the method argument, if present
  36460.             if ($headers['Content-Type'] === 'application/json') {
  36461.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  36462.             } else {
  36463.                 $httpBody $_tempBody;
  36464.             }
  36465.         } elseif (count($formParams) > 0) {
  36466.             if ($multipart) {
  36467.                 $multipartContents = [
  36468.                     [
  36469.                         'Content-type' => 'multipart/form-data',
  36470.                     ]
  36471.                 ];
  36472.                 
  36473.                 // for HTTP post (form)
  36474.                 $httpBody = new MultipartStream($multipartContents);
  36475.             } elseif ($headers['Content-Type'] === 'application/json') {
  36476.                 $httpBody \GuzzleHttp\json_encode($formParams);
  36477.             } else {
  36478.                 // for HTTP post (form)
  36479.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  36480.             }
  36481.         }
  36482.         // this endpoint requires OAuth (access token)
  36483.         if ($this->config->getAccessToken() !== null) {
  36484.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  36485.         }
  36486.         $defaultHeaders = [];
  36487.         if ($this->config->getUserAgent()) {
  36488.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  36489.         }
  36490.         $headers array_merge(
  36491.             $defaultHeaders,
  36492.             $headerParams,
  36493.             $headers
  36494.         );
  36495.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  36496.         return new Request(
  36497.             'GET',
  36498.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  36499.             $headers,
  36500.             $httpBody
  36501.         );
  36502.     }
  36503.     /**
  36504.      * Operation getOnlineInvoice
  36505.      * Retrieves a URL to an online invoice
  36506.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  36507.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  36508.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  36509.      * @throws \InvalidArgumentException
  36510.      * @return \XeroAPI\XeroPHP\Models\Accounting\OnlineInvoices
  36511.      */
  36512.     public function getOnlineInvoice($xero_tenant_id$invoice_id)
  36513.     {
  36514.         list($response) = $this->getOnlineInvoiceWithHttpInfo($xero_tenant_id$invoice_id);
  36515.         return $response;
  36516.     }
  36517.     /**
  36518.      * Operation getOnlineInvoiceWithHttpInfo
  36519.      * Retrieves a URL to an online invoice
  36520.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  36521.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  36522.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  36523.      * @throws \InvalidArgumentException
  36524.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\OnlineInvoices, HTTP status code, HTTP response headers (array of strings)
  36525.      */
  36526.     public function getOnlineInvoiceWithHttpInfo($xero_tenant_id$invoice_id)
  36527.     {
  36528.         $request $this->getOnlineInvoiceRequest($xero_tenant_id$invoice_id);
  36529.         try {
  36530.             $options $this->createHttpClientOption();
  36531.             try {
  36532.                 $response $this->client->send($request$options);
  36533.             } catch (RequestException $e) {
  36534.                 throw new ApiException(
  36535.                     "[{$e->getCode()}{$e->getMessage()}",
  36536.                     $e->getCode(),
  36537.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  36538.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  36539.                 );
  36540.             }
  36541.             $statusCode $response->getStatusCode();
  36542.             if ($statusCode 200 || $statusCode 299) {
  36543.                 throw new ApiException(
  36544.                     sprintf(
  36545.                         '[%d] Error connecting to the API (%s)',
  36546.                         $statusCode,
  36547.                         $request->getUri()
  36548.                     ),
  36549.                     $statusCode,
  36550.                     $response->getHeaders(),
  36551.                     $response->getBody()
  36552.                 );
  36553.             }
  36554.             $responseBody $response->getBody();
  36555.             switch($statusCode) {
  36556.                 case 200:
  36557.                     if ('\XeroAPI\XeroPHP\Models\Accounting\OnlineInvoices' === '\SplFileObject') {
  36558.                         $content $responseBody//stream goes to serializer
  36559.                     } else {
  36560.                         $content $responseBody->getContents();
  36561.                     }
  36562.                     return [
  36563.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\OnlineInvoices', []),
  36564.                         $response->getStatusCode(),
  36565.                         $response->getHeaders()
  36566.                     ];
  36567.             }
  36568.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\OnlineInvoices';
  36569.             $responseBody $response->getBody();
  36570.             if ($returnType === '\SplFileObject') {
  36571.                 $content $responseBody//stream goes to serializer
  36572.             } else {
  36573.                 $content $responseBody->getContents();
  36574.             }
  36575.             return [
  36576.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  36577.                 $response->getStatusCode(),
  36578.                 $response->getHeaders()
  36579.             ];
  36580.         } catch (ApiException $e) {
  36581.             switch ($e->getCode()) {
  36582.                 case 200:
  36583.                     $data AccountingObjectSerializer::deserialize(
  36584.                         $e->getResponseBody(),
  36585.                         '\XeroAPI\XeroPHP\Models\Accounting\OnlineInvoices',
  36586.                         $e->getResponseHeaders()
  36587.                     );
  36588.                     $e->setResponseObject($data);
  36589.                     break;
  36590.             }
  36591.             throw $e;
  36592.         }
  36593.     }
  36594.     /**
  36595.      * Operation getOnlineInvoiceAsync
  36596.      * Retrieves a URL to an online invoice
  36597.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  36598.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  36599.      * @throws \InvalidArgumentException
  36600.      * @return \GuzzleHttp\Promise\PromiseInterface
  36601.      */
  36602.     public function getOnlineInvoiceAsync($xero_tenant_id$invoice_id)
  36603.     {
  36604.         return $this->getOnlineInvoiceAsyncWithHttpInfo($xero_tenant_id$invoice_id)
  36605.             ->then(
  36606.                 function ($response) {
  36607.                     return $response[0];
  36608.                 }
  36609.             );
  36610.     }
  36611.     /**
  36612.      * Operation getOnlineInvoiceAsyncWithHttpInfo
  36613.      * Retrieves a URL to an online invoice
  36614.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  36615.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  36616.      * @throws \InvalidArgumentException
  36617.      * @return \GuzzleHttp\Promise\PromiseInterface */
  36618.     public function getOnlineInvoiceAsyncWithHttpInfo($xero_tenant_id$invoice_id)
  36619.     {
  36620.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\OnlineInvoices';
  36621.         $request $this->getOnlineInvoiceRequest($xero_tenant_id$invoice_id);
  36622.         return $this->client
  36623.             ->sendAsync($request$this->createHttpClientOption())
  36624.             ->then(
  36625.                 function ($response) use ($returnType) {
  36626.                     $responseBody $response->getBody();
  36627.                     if ($returnType === '\SplFileObject') {
  36628.                         $content $responseBody//stream goes to serializer
  36629.                     } else {
  36630.                         $content $responseBody->getContents();
  36631.                     }
  36632.                     return [
  36633.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  36634.                         $response->getStatusCode(),
  36635.                         $response->getHeaders()
  36636.                     ];
  36637.                 },
  36638.                 function ($exception) {
  36639.                     $response $exception->getResponse();
  36640.                     $statusCode $response->getStatusCode();
  36641.                     throw new ApiException(
  36642.                         sprintf(
  36643.                             '[%d] Error connecting to the API (%s)',
  36644.                             $statusCode,
  36645.                             $exception->getRequest()->getUri()
  36646.                         ),
  36647.                         $statusCode,
  36648.                         $response->getHeaders(),
  36649.                         $response->getBody()
  36650.                     );
  36651.                 }
  36652.             );
  36653.     }
  36654.     /**
  36655.      * Create request for operation 'getOnlineInvoice'
  36656.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  36657.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  36658.      * @throws \InvalidArgumentException
  36659.      * @return \GuzzleHttp\Psr7\Request  */
  36660.     protected function getOnlineInvoiceRequest($xero_tenant_id$invoice_id)
  36661.     {
  36662.         // verify the required parameter 'xero_tenant_id' is set
  36663.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  36664.             throw new \InvalidArgumentException(
  36665.                 'Missing the required parameter $xero_tenant_id when calling getOnlineInvoice'
  36666.             );
  36667.         }
  36668.         // verify the required parameter 'invoice_id' is set
  36669.         if ($invoice_id === null || (is_array($invoice_id) && count($invoice_id) === 0)) {
  36670.             throw new \InvalidArgumentException(
  36671.                 'Missing the required parameter $invoice_id when calling getOnlineInvoice'
  36672.             );
  36673.         }
  36674.         $resourcePath '/Invoices/{InvoiceID}/OnlineInvoice';
  36675.         $formParams = [];
  36676.         $queryParams = [];
  36677.         $headerParams = [];
  36678.         $httpBody '';
  36679.         $multipart false;
  36680.         // header params
  36681.         if ($xero_tenant_id !== null) {
  36682.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  36683.         }
  36684.         // path params
  36685.         if ($invoice_id !== null) {
  36686.             $resourcePath str_replace(
  36687.                 '{' 'InvoiceID' '}',
  36688.                 AccountingObjectSerializer::toPathValue($invoice_id),
  36689.                 $resourcePath
  36690.             );
  36691.         }
  36692.         // body params
  36693.         $_tempBody null;
  36694.         if ($multipart) {
  36695.             $headers $this->headerSelector->selectHeadersForMultipart(
  36696.                 ['application/json']
  36697.             );
  36698.         } else {
  36699.             $headers $this->headerSelector->selectHeaders(
  36700.                 ['application/json'],
  36701.                 []
  36702.             );
  36703.         }
  36704.         // for model (json/xml)
  36705.         if (isset($_tempBody)) {
  36706.             // $_tempBody is the method argument, if present
  36707.             if ($headers['Content-Type'] === 'application/json') {
  36708.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  36709.             } else {
  36710.                 $httpBody $_tempBody;
  36711.             }
  36712.         } elseif (count($formParams) > 0) {
  36713.             if ($multipart) {
  36714.                 $multipartContents = [
  36715.                     [
  36716.                         'Content-type' => 'multipart/form-data',
  36717.                     ]
  36718.                 ];
  36719.                 
  36720.                 // for HTTP post (form)
  36721.                 $httpBody = new MultipartStream($multipartContents);
  36722.             } elseif ($headers['Content-Type'] === 'application/json') {
  36723.                 $httpBody \GuzzleHttp\json_encode($formParams);
  36724.             } else {
  36725.                 // for HTTP post (form)
  36726.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  36727.             }
  36728.         }
  36729.         // this endpoint requires OAuth (access token)
  36730.         if ($this->config->getAccessToken() !== null) {
  36731.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  36732.         }
  36733.         $defaultHeaders = [];
  36734.         if ($this->config->getUserAgent()) {
  36735.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  36736.         }
  36737.         $headers array_merge(
  36738.             $defaultHeaders,
  36739.             $headerParams,
  36740.             $headers
  36741.         );
  36742.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  36743.         return new Request(
  36744.             'GET',
  36745.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  36746.             $headers,
  36747.             $httpBody
  36748.         );
  36749.     }
  36750.     /**
  36751.      * Operation getOrganisationActions
  36752.      * Retrieves a list of the key actions your app has permission to perform in the connected Xero organisation.
  36753.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  36754.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  36755.      * @throws \InvalidArgumentException
  36756.      * @return \XeroAPI\XeroPHP\Models\Accounting\Actions
  36757.      */
  36758.     public function getOrganisationActions($xero_tenant_id)
  36759.     {
  36760.         list($response) = $this->getOrganisationActionsWithHttpInfo($xero_tenant_id);
  36761.         return $response;
  36762.     }
  36763.     /**
  36764.      * Operation getOrganisationActionsWithHttpInfo
  36765.      * Retrieves a list of the key actions your app has permission to perform in the connected Xero organisation.
  36766.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  36767.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  36768.      * @throws \InvalidArgumentException
  36769.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Actions, HTTP status code, HTTP response headers (array of strings)
  36770.      */
  36771.     public function getOrganisationActionsWithHttpInfo($xero_tenant_id)
  36772.     {
  36773.         $request $this->getOrganisationActionsRequest($xero_tenant_id);
  36774.         try {
  36775.             $options $this->createHttpClientOption();
  36776.             try {
  36777.                 $response $this->client->send($request$options);
  36778.             } catch (RequestException $e) {
  36779.                 throw new ApiException(
  36780.                     "[{$e->getCode()}{$e->getMessage()}",
  36781.                     $e->getCode(),
  36782.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  36783.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  36784.                 );
  36785.             }
  36786.             $statusCode $response->getStatusCode();
  36787.             if ($statusCode 200 || $statusCode 299) {
  36788.                 throw new ApiException(
  36789.                     sprintf(
  36790.                         '[%d] Error connecting to the API (%s)',
  36791.                         $statusCode,
  36792.                         $request->getUri()
  36793.                     ),
  36794.                     $statusCode,
  36795.                     $response->getHeaders(),
  36796.                     $response->getBody()
  36797.                 );
  36798.             }
  36799.             $responseBody $response->getBody();
  36800.             switch($statusCode) {
  36801.                 case 200:
  36802.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Actions' === '\SplFileObject') {
  36803.                         $content $responseBody//stream goes to serializer
  36804.                     } else {
  36805.                         $content $responseBody->getContents();
  36806.                     }
  36807.                     return [
  36808.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Actions', []),
  36809.                         $response->getStatusCode(),
  36810.                         $response->getHeaders()
  36811.                     ];
  36812.             }
  36813.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Actions';
  36814.             $responseBody $response->getBody();
  36815.             if ($returnType === '\SplFileObject') {
  36816.                 $content $responseBody//stream goes to serializer
  36817.             } else {
  36818.                 $content $responseBody->getContents();
  36819.             }
  36820.             return [
  36821.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  36822.                 $response->getStatusCode(),
  36823.                 $response->getHeaders()
  36824.             ];
  36825.         } catch (ApiException $e) {
  36826.             switch ($e->getCode()) {
  36827.                 case 200:
  36828.                     $data AccountingObjectSerializer::deserialize(
  36829.                         $e->getResponseBody(),
  36830.                         '\XeroAPI\XeroPHP\Models\Accounting\Actions',
  36831.                         $e->getResponseHeaders()
  36832.                     );
  36833.                     $e->setResponseObject($data);
  36834.                     break;
  36835.             }
  36836.             throw $e;
  36837.         }
  36838.     }
  36839.     /**
  36840.      * Operation getOrganisationActionsAsync
  36841.      * Retrieves a list of the key actions your app has permission to perform in the connected Xero organisation.
  36842.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  36843.      * @throws \InvalidArgumentException
  36844.      * @return \GuzzleHttp\Promise\PromiseInterface
  36845.      */
  36846.     public function getOrganisationActionsAsync($xero_tenant_id)
  36847.     {
  36848.         return $this->getOrganisationActionsAsyncWithHttpInfo($xero_tenant_id)
  36849.             ->then(
  36850.                 function ($response) {
  36851.                     return $response[0];
  36852.                 }
  36853.             );
  36854.     }
  36855.     /**
  36856.      * Operation getOrganisationActionsAsyncWithHttpInfo
  36857.      * Retrieves a list of the key actions your app has permission to perform in the connected Xero organisation.
  36858.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  36859.      * @throws \InvalidArgumentException
  36860.      * @return \GuzzleHttp\Promise\PromiseInterface */
  36861.     public function getOrganisationActionsAsyncWithHttpInfo($xero_tenant_id)
  36862.     {
  36863.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Actions';
  36864.         $request $this->getOrganisationActionsRequest($xero_tenant_id);
  36865.         return $this->client
  36866.             ->sendAsync($request$this->createHttpClientOption())
  36867.             ->then(
  36868.                 function ($response) use ($returnType) {
  36869.                     $responseBody $response->getBody();
  36870.                     if ($returnType === '\SplFileObject') {
  36871.                         $content $responseBody//stream goes to serializer
  36872.                     } else {
  36873.                         $content $responseBody->getContents();
  36874.                     }
  36875.                     return [
  36876.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  36877.                         $response->getStatusCode(),
  36878.                         $response->getHeaders()
  36879.                     ];
  36880.                 },
  36881.                 function ($exception) {
  36882.                     $response $exception->getResponse();
  36883.                     $statusCode $response->getStatusCode();
  36884.                     throw new ApiException(
  36885.                         sprintf(
  36886.                             '[%d] Error connecting to the API (%s)',
  36887.                             $statusCode,
  36888.                             $exception->getRequest()->getUri()
  36889.                         ),
  36890.                         $statusCode,
  36891.                         $response->getHeaders(),
  36892.                         $response->getBody()
  36893.                     );
  36894.                 }
  36895.             );
  36896.     }
  36897.     /**
  36898.      * Create request for operation 'getOrganisationActions'
  36899.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  36900.      * @throws \InvalidArgumentException
  36901.      * @return \GuzzleHttp\Psr7\Request  */
  36902.     protected function getOrganisationActionsRequest($xero_tenant_id)
  36903.     {
  36904.         // verify the required parameter 'xero_tenant_id' is set
  36905.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  36906.             throw new \InvalidArgumentException(
  36907.                 'Missing the required parameter $xero_tenant_id when calling getOrganisationActions'
  36908.             );
  36909.         }
  36910.         $resourcePath '/Organisation/Actions';
  36911.         $formParams = [];
  36912.         $queryParams = [];
  36913.         $headerParams = [];
  36914.         $httpBody '';
  36915.         $multipart false;
  36916.         // header params
  36917.         if ($xero_tenant_id !== null) {
  36918.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  36919.         }
  36920.         // body params
  36921.         $_tempBody null;
  36922.         if ($multipart) {
  36923.             $headers $this->headerSelector->selectHeadersForMultipart(
  36924.                 ['application/json']
  36925.             );
  36926.         } else {
  36927.             $headers $this->headerSelector->selectHeaders(
  36928.                 ['application/json'],
  36929.                 []
  36930.             );
  36931.         }
  36932.         // for model (json/xml)
  36933.         if (isset($_tempBody)) {
  36934.             // $_tempBody is the method argument, if present
  36935.             if ($headers['Content-Type'] === 'application/json') {
  36936.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  36937.             } else {
  36938.                 $httpBody $_tempBody;
  36939.             }
  36940.         } elseif (count($formParams) > 0) {
  36941.             if ($multipart) {
  36942.                 $multipartContents = [
  36943.                     [
  36944.                         'Content-type' => 'multipart/form-data',
  36945.                     ]
  36946.                 ];
  36947.                 
  36948.                 // for HTTP post (form)
  36949.                 $httpBody = new MultipartStream($multipartContents);
  36950.             } elseif ($headers['Content-Type'] === 'application/json') {
  36951.                 $httpBody \GuzzleHttp\json_encode($formParams);
  36952.             } else {
  36953.                 // for HTTP post (form)
  36954.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  36955.             }
  36956.         }
  36957.         // this endpoint requires OAuth (access token)
  36958.         if ($this->config->getAccessToken() !== null) {
  36959.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  36960.         }
  36961.         $defaultHeaders = [];
  36962.         if ($this->config->getUserAgent()) {
  36963.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  36964.         }
  36965.         $headers array_merge(
  36966.             $defaultHeaders,
  36967.             $headerParams,
  36968.             $headers
  36969.         );
  36970.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  36971.         return new Request(
  36972.             'GET',
  36973.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  36974.             $headers,
  36975.             $httpBody
  36976.         );
  36977.     }
  36978.     /**
  36979.      * Operation getOrganisationCISSettings
  36980.      * Retrieves the CIS settings for the Xero organistaion.
  36981.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  36982.      * @param  string $organisation_id The unique Xero identifier for an organisation (required)
  36983.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  36984.      * @throws \InvalidArgumentException
  36985.      * @return \XeroAPI\XeroPHP\Models\Accounting\CISOrgSettings
  36986.      */
  36987.     public function getOrganisationCISSettings($xero_tenant_id$organisation_id)
  36988.     {
  36989.         list($response) = $this->getOrganisationCISSettingsWithHttpInfo($xero_tenant_id$organisation_id);
  36990.         return $response;
  36991.     }
  36992.     /**
  36993.      * Operation getOrganisationCISSettingsWithHttpInfo
  36994.      * Retrieves the CIS settings for the Xero organistaion.
  36995.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  36996.      * @param  string $organisation_id The unique Xero identifier for an organisation (required)
  36997.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  36998.      * @throws \InvalidArgumentException
  36999.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\CISOrgSettings, HTTP status code, HTTP response headers (array of strings)
  37000.      */
  37001.     public function getOrganisationCISSettingsWithHttpInfo($xero_tenant_id$organisation_id)
  37002.     {
  37003.         $request $this->getOrganisationCISSettingsRequest($xero_tenant_id$organisation_id);
  37004.         try {
  37005.             $options $this->createHttpClientOption();
  37006.             try {
  37007.                 $response $this->client->send($request$options);
  37008.             } catch (RequestException $e) {
  37009.                 throw new ApiException(
  37010.                     "[{$e->getCode()}{$e->getMessage()}",
  37011.                     $e->getCode(),
  37012.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  37013.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  37014.                 );
  37015.             }
  37016.             $statusCode $response->getStatusCode();
  37017.             if ($statusCode 200 || $statusCode 299) {
  37018.                 throw new ApiException(
  37019.                     sprintf(
  37020.                         '[%d] Error connecting to the API (%s)',
  37021.                         $statusCode,
  37022.                         $request->getUri()
  37023.                     ),
  37024.                     $statusCode,
  37025.                     $response->getHeaders(),
  37026.                     $response->getBody()
  37027.                 );
  37028.             }
  37029.             $responseBody $response->getBody();
  37030.             switch($statusCode) {
  37031.                 case 200:
  37032.                     if ('\XeroAPI\XeroPHP\Models\Accounting\CISOrgSettings' === '\SplFileObject') {
  37033.                         $content $responseBody//stream goes to serializer
  37034.                     } else {
  37035.                         $content $responseBody->getContents();
  37036.                     }
  37037.                     return [
  37038.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\CISOrgSettings', []),
  37039.                         $response->getStatusCode(),
  37040.                         $response->getHeaders()
  37041.                     ];
  37042.             }
  37043.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\CISOrgSettings';
  37044.             $responseBody $response->getBody();
  37045.             if ($returnType === '\SplFileObject') {
  37046.                 $content $responseBody//stream goes to serializer
  37047.             } else {
  37048.                 $content $responseBody->getContents();
  37049.             }
  37050.             return [
  37051.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  37052.                 $response->getStatusCode(),
  37053.                 $response->getHeaders()
  37054.             ];
  37055.         } catch (ApiException $e) {
  37056.             switch ($e->getCode()) {
  37057.                 case 200:
  37058.                     $data AccountingObjectSerializer::deserialize(
  37059.                         $e->getResponseBody(),
  37060.                         '\XeroAPI\XeroPHP\Models\Accounting\CISOrgSettings',
  37061.                         $e->getResponseHeaders()
  37062.                     );
  37063.                     $e->setResponseObject($data);
  37064.                     break;
  37065.             }
  37066.             throw $e;
  37067.         }
  37068.     }
  37069.     /**
  37070.      * Operation getOrganisationCISSettingsAsync
  37071.      * Retrieves the CIS settings for the Xero organistaion.
  37072.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  37073.      * @param  string $organisation_id The unique Xero identifier for an organisation (required)
  37074.      * @throws \InvalidArgumentException
  37075.      * @return \GuzzleHttp\Promise\PromiseInterface
  37076.      */
  37077.     public function getOrganisationCISSettingsAsync($xero_tenant_id$organisation_id)
  37078.     {
  37079.         return $this->getOrganisationCISSettingsAsyncWithHttpInfo($xero_tenant_id$organisation_id)
  37080.             ->then(
  37081.                 function ($response) {
  37082.                     return $response[0];
  37083.                 }
  37084.             );
  37085.     }
  37086.     /**
  37087.      * Operation getOrganisationCISSettingsAsyncWithHttpInfo
  37088.      * Retrieves the CIS settings for the Xero organistaion.
  37089.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  37090.      * @param  string $organisation_id The unique Xero identifier for an organisation (required)
  37091.      * @throws \InvalidArgumentException
  37092.      * @return \GuzzleHttp\Promise\PromiseInterface */
  37093.     public function getOrganisationCISSettingsAsyncWithHttpInfo($xero_tenant_id$organisation_id)
  37094.     {
  37095.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\CISOrgSettings';
  37096.         $request $this->getOrganisationCISSettingsRequest($xero_tenant_id$organisation_id);
  37097.         return $this->client
  37098.             ->sendAsync($request$this->createHttpClientOption())
  37099.             ->then(
  37100.                 function ($response) use ($returnType) {
  37101.                     $responseBody $response->getBody();
  37102.                     if ($returnType === '\SplFileObject') {
  37103.                         $content $responseBody//stream goes to serializer
  37104.                     } else {
  37105.                         $content $responseBody->getContents();
  37106.                     }
  37107.                     return [
  37108.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  37109.                         $response->getStatusCode(),
  37110.                         $response->getHeaders()
  37111.                     ];
  37112.                 },
  37113.                 function ($exception) {
  37114.                     $response $exception->getResponse();
  37115.                     $statusCode $response->getStatusCode();
  37116.                     throw new ApiException(
  37117.                         sprintf(
  37118.                             '[%d] Error connecting to the API (%s)',
  37119.                             $statusCode,
  37120.                             $exception->getRequest()->getUri()
  37121.                         ),
  37122.                         $statusCode,
  37123.                         $response->getHeaders(),
  37124.                         $response->getBody()
  37125.                     );
  37126.                 }
  37127.             );
  37128.     }
  37129.     /**
  37130.      * Create request for operation 'getOrganisationCISSettings'
  37131.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  37132.      * @param  string $organisation_id The unique Xero identifier for an organisation (required)
  37133.      * @throws \InvalidArgumentException
  37134.      * @return \GuzzleHttp\Psr7\Request  */
  37135.     protected function getOrganisationCISSettingsRequest($xero_tenant_id$organisation_id)
  37136.     {
  37137.         // verify the required parameter 'xero_tenant_id' is set
  37138.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  37139.             throw new \InvalidArgumentException(
  37140.                 'Missing the required parameter $xero_tenant_id when calling getOrganisationCISSettings'
  37141.             );
  37142.         }
  37143.         // verify the required parameter 'organisation_id' is set
  37144.         if ($organisation_id === null || (is_array($organisation_id) && count($organisation_id) === 0)) {
  37145.             throw new \InvalidArgumentException(
  37146.                 'Missing the required parameter $organisation_id when calling getOrganisationCISSettings'
  37147.             );
  37148.         }
  37149.         $resourcePath '/Organisation/{OrganisationID}/CISSettings';
  37150.         $formParams = [];
  37151.         $queryParams = [];
  37152.         $headerParams = [];
  37153.         $httpBody '';
  37154.         $multipart false;
  37155.         // header params
  37156.         if ($xero_tenant_id !== null) {
  37157.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  37158.         }
  37159.         // path params
  37160.         if ($organisation_id !== null) {
  37161.             $resourcePath str_replace(
  37162.                 '{' 'OrganisationID' '}',
  37163.                 AccountingObjectSerializer::toPathValue($organisation_id),
  37164.                 $resourcePath
  37165.             );
  37166.         }
  37167.         // body params
  37168.         $_tempBody null;
  37169.         if ($multipart) {
  37170.             $headers $this->headerSelector->selectHeadersForMultipart(
  37171.                 ['application/json']
  37172.             );
  37173.         } else {
  37174.             $headers $this->headerSelector->selectHeaders(
  37175.                 ['application/json'],
  37176.                 []
  37177.             );
  37178.         }
  37179.         // for model (json/xml)
  37180.         if (isset($_tempBody)) {
  37181.             // $_tempBody is the method argument, if present
  37182.             if ($headers['Content-Type'] === 'application/json') {
  37183.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  37184.             } else {
  37185.                 $httpBody $_tempBody;
  37186.             }
  37187.         } elseif (count($formParams) > 0) {
  37188.             if ($multipart) {
  37189.                 $multipartContents = [
  37190.                     [
  37191.                         'Content-type' => 'multipart/form-data',
  37192.                     ]
  37193.                 ];
  37194.                 
  37195.                 // for HTTP post (form)
  37196.                 $httpBody = new MultipartStream($multipartContents);
  37197.             } elseif ($headers['Content-Type'] === 'application/json') {
  37198.                 $httpBody \GuzzleHttp\json_encode($formParams);
  37199.             } else {
  37200.                 // for HTTP post (form)
  37201.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  37202.             }
  37203.         }
  37204.         // this endpoint requires OAuth (access token)
  37205.         if ($this->config->getAccessToken() !== null) {
  37206.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  37207.         }
  37208.         $defaultHeaders = [];
  37209.         if ($this->config->getUserAgent()) {
  37210.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  37211.         }
  37212.         $headers array_merge(
  37213.             $defaultHeaders,
  37214.             $headerParams,
  37215.             $headers
  37216.         );
  37217.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  37218.         return new Request(
  37219.             'GET',
  37220.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  37221.             $headers,
  37222.             $httpBody
  37223.         );
  37224.     }
  37225.     /**
  37226.      * Operation getOrganisations
  37227.      * Retrieves Xero organisation details
  37228.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  37229.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  37230.      * @throws \InvalidArgumentException
  37231.      * @return \XeroAPI\XeroPHP\Models\Accounting\Organisations
  37232.      */
  37233.     public function getOrganisations($xero_tenant_id)
  37234.     {
  37235.         list($response) = $this->getOrganisationsWithHttpInfo($xero_tenant_id);
  37236.         return $response;
  37237.     }
  37238.     /**
  37239.      * Operation getOrganisationsWithHttpInfo
  37240.      * Retrieves Xero organisation details
  37241.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  37242.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  37243.      * @throws \InvalidArgumentException
  37244.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Organisations, HTTP status code, HTTP response headers (array of strings)
  37245.      */
  37246.     public function getOrganisationsWithHttpInfo($xero_tenant_id)
  37247.     {
  37248.         $request $this->getOrganisationsRequest($xero_tenant_id);
  37249.         try {
  37250.             $options $this->createHttpClientOption();
  37251.             try {
  37252.                 $response $this->client->send($request$options);
  37253.             } catch (RequestException $e) {
  37254.                 throw new ApiException(
  37255.                     "[{$e->getCode()}{$e->getMessage()}",
  37256.                     $e->getCode(),
  37257.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  37258.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  37259.                 );
  37260.             }
  37261.             $statusCode $response->getStatusCode();
  37262.             if ($statusCode 200 || $statusCode 299) {
  37263.                 throw new ApiException(
  37264.                     sprintf(
  37265.                         '[%d] Error connecting to the API (%s)',
  37266.                         $statusCode,
  37267.                         $request->getUri()
  37268.                     ),
  37269.                     $statusCode,
  37270.                     $response->getHeaders(),
  37271.                     $response->getBody()
  37272.                 );
  37273.             }
  37274.             $responseBody $response->getBody();
  37275.             switch($statusCode) {
  37276.                 case 200:
  37277.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Organisations' === '\SplFileObject') {
  37278.                         $content $responseBody//stream goes to serializer
  37279.                     } else {
  37280.                         $content $responseBody->getContents();
  37281.                     }
  37282.                     return [
  37283.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Organisations', []),
  37284.                         $response->getStatusCode(),
  37285.                         $response->getHeaders()
  37286.                     ];
  37287.             }
  37288.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Organisations';
  37289.             $responseBody $response->getBody();
  37290.             if ($returnType === '\SplFileObject') {
  37291.                 $content $responseBody//stream goes to serializer
  37292.             } else {
  37293.                 $content $responseBody->getContents();
  37294.             }
  37295.             return [
  37296.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  37297.                 $response->getStatusCode(),
  37298.                 $response->getHeaders()
  37299.             ];
  37300.         } catch (ApiException $e) {
  37301.             switch ($e->getCode()) {
  37302.                 case 200:
  37303.                     $data AccountingObjectSerializer::deserialize(
  37304.                         $e->getResponseBody(),
  37305.                         '\XeroAPI\XeroPHP\Models\Accounting\Organisations',
  37306.                         $e->getResponseHeaders()
  37307.                     );
  37308.                     $e->setResponseObject($data);
  37309.                     break;
  37310.             }
  37311.             throw $e;
  37312.         }
  37313.     }
  37314.     /**
  37315.      * Operation getOrganisationsAsync
  37316.      * Retrieves Xero organisation details
  37317.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  37318.      * @throws \InvalidArgumentException
  37319.      * @return \GuzzleHttp\Promise\PromiseInterface
  37320.      */
  37321.     public function getOrganisationsAsync($xero_tenant_id)
  37322.     {
  37323.         return $this->getOrganisationsAsyncWithHttpInfo($xero_tenant_id)
  37324.             ->then(
  37325.                 function ($response) {
  37326.                     return $response[0];
  37327.                 }
  37328.             );
  37329.     }
  37330.     /**
  37331.      * Operation getOrganisationsAsyncWithHttpInfo
  37332.      * Retrieves Xero organisation details
  37333.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  37334.      * @throws \InvalidArgumentException
  37335.      * @return \GuzzleHttp\Promise\PromiseInterface */
  37336.     public function getOrganisationsAsyncWithHttpInfo($xero_tenant_id)
  37337.     {
  37338.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Organisations';
  37339.         $request $this->getOrganisationsRequest($xero_tenant_id);
  37340.         return $this->client
  37341.             ->sendAsync($request$this->createHttpClientOption())
  37342.             ->then(
  37343.                 function ($response) use ($returnType) {
  37344.                     $responseBody $response->getBody();
  37345.                     if ($returnType === '\SplFileObject') {
  37346.                         $content $responseBody//stream goes to serializer
  37347.                     } else {
  37348.                         $content $responseBody->getContents();
  37349.                     }
  37350.                     return [
  37351.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  37352.                         $response->getStatusCode(),
  37353.                         $response->getHeaders()
  37354.                     ];
  37355.                 },
  37356.                 function ($exception) {
  37357.                     $response $exception->getResponse();
  37358.                     $statusCode $response->getStatusCode();
  37359.                     throw new ApiException(
  37360.                         sprintf(
  37361.                             '[%d] Error connecting to the API (%s)',
  37362.                             $statusCode,
  37363.                             $exception->getRequest()->getUri()
  37364.                         ),
  37365.                         $statusCode,
  37366.                         $response->getHeaders(),
  37367.                         $response->getBody()
  37368.                     );
  37369.                 }
  37370.             );
  37371.     }
  37372.     /**
  37373.      * Create request for operation 'getOrganisations'
  37374.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  37375.      * @throws \InvalidArgumentException
  37376.      * @return \GuzzleHttp\Psr7\Request  */
  37377.     protected function getOrganisationsRequest($xero_tenant_id)
  37378.     {
  37379.         // verify the required parameter 'xero_tenant_id' is set
  37380.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  37381.             throw new \InvalidArgumentException(
  37382.                 'Missing the required parameter $xero_tenant_id when calling getOrganisations'
  37383.             );
  37384.         }
  37385.         $resourcePath '/Organisation';
  37386.         $formParams = [];
  37387.         $queryParams = [];
  37388.         $headerParams = [];
  37389.         $httpBody '';
  37390.         $multipart false;
  37391.         // header params
  37392.         if ($xero_tenant_id !== null) {
  37393.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  37394.         }
  37395.         // body params
  37396.         $_tempBody null;
  37397.         if ($multipart) {
  37398.             $headers $this->headerSelector->selectHeadersForMultipart(
  37399.                 ['application/json']
  37400.             );
  37401.         } else {
  37402.             $headers $this->headerSelector->selectHeaders(
  37403.                 ['application/json'],
  37404.                 []
  37405.             );
  37406.         }
  37407.         // for model (json/xml)
  37408.         if (isset($_tempBody)) {
  37409.             // $_tempBody is the method argument, if present
  37410.             if ($headers['Content-Type'] === 'application/json') {
  37411.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  37412.             } else {
  37413.                 $httpBody $_tempBody;
  37414.             }
  37415.         } elseif (count($formParams) > 0) {
  37416.             if ($multipart) {
  37417.                 $multipartContents = [
  37418.                     [
  37419.                         'Content-type' => 'multipart/form-data',
  37420.                     ]
  37421.                 ];
  37422.                 
  37423.                 // for HTTP post (form)
  37424.                 $httpBody = new MultipartStream($multipartContents);
  37425.             } elseif ($headers['Content-Type'] === 'application/json') {
  37426.                 $httpBody \GuzzleHttp\json_encode($formParams);
  37427.             } else {
  37428.                 // for HTTP post (form)
  37429.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  37430.             }
  37431.         }
  37432.         // this endpoint requires OAuth (access token)
  37433.         if ($this->config->getAccessToken() !== null) {
  37434.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  37435.         }
  37436.         $defaultHeaders = [];
  37437.         if ($this->config->getUserAgent()) {
  37438.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  37439.         }
  37440.         $headers array_merge(
  37441.             $defaultHeaders,
  37442.             $headerParams,
  37443.             $headers
  37444.         );
  37445.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  37446.         return new Request(
  37447.             'GET',
  37448.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  37449.             $headers,
  37450.             $httpBody
  37451.         );
  37452.     }
  37453.     /**
  37454.      * Operation getOverpayment
  37455.      * Retrieves a specific overpayment using a unique overpayment Id
  37456.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  37457.      * @param  string $overpayment_id Unique identifier for a Overpayment (required)
  37458.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  37459.      * @throws \InvalidArgumentException
  37460.      * @return \XeroAPI\XeroPHP\Models\Accounting\Overpayments
  37461.      */
  37462.     public function getOverpayment($xero_tenant_id$overpayment_id)
  37463.     {
  37464.         list($response) = $this->getOverpaymentWithHttpInfo($xero_tenant_id$overpayment_id);
  37465.         return $response;
  37466.     }
  37467.     /**
  37468.      * Operation getOverpaymentWithHttpInfo
  37469.      * Retrieves a specific overpayment using a unique overpayment Id
  37470.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  37471.      * @param  string $overpayment_id Unique identifier for a Overpayment (required)
  37472.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  37473.      * @throws \InvalidArgumentException
  37474.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Overpayments, HTTP status code, HTTP response headers (array of strings)
  37475.      */
  37476.     public function getOverpaymentWithHttpInfo($xero_tenant_id$overpayment_id)
  37477.     {
  37478.         $request $this->getOverpaymentRequest($xero_tenant_id$overpayment_id);
  37479.         try {
  37480.             $options $this->createHttpClientOption();
  37481.             try {
  37482.                 $response $this->client->send($request$options);
  37483.             } catch (RequestException $e) {
  37484.                 throw new ApiException(
  37485.                     "[{$e->getCode()}{$e->getMessage()}",
  37486.                     $e->getCode(),
  37487.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  37488.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  37489.                 );
  37490.             }
  37491.             $statusCode $response->getStatusCode();
  37492.             if ($statusCode 200 || $statusCode 299) {
  37493.                 throw new ApiException(
  37494.                     sprintf(
  37495.                         '[%d] Error connecting to the API (%s)',
  37496.                         $statusCode,
  37497.                         $request->getUri()
  37498.                     ),
  37499.                     $statusCode,
  37500.                     $response->getHeaders(),
  37501.                     $response->getBody()
  37502.                 );
  37503.             }
  37504.             $responseBody $response->getBody();
  37505.             switch($statusCode) {
  37506.                 case 200:
  37507.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Overpayments' === '\SplFileObject') {
  37508.                         $content $responseBody//stream goes to serializer
  37509.                     } else {
  37510.                         $content $responseBody->getContents();
  37511.                     }
  37512.                     return [
  37513.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Overpayments', []),
  37514.                         $response->getStatusCode(),
  37515.                         $response->getHeaders()
  37516.                     ];
  37517.             }
  37518.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Overpayments';
  37519.             $responseBody $response->getBody();
  37520.             if ($returnType === '\SplFileObject') {
  37521.                 $content $responseBody//stream goes to serializer
  37522.             } else {
  37523.                 $content $responseBody->getContents();
  37524.             }
  37525.             return [
  37526.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  37527.                 $response->getStatusCode(),
  37528.                 $response->getHeaders()
  37529.             ];
  37530.         } catch (ApiException $e) {
  37531.             switch ($e->getCode()) {
  37532.                 case 200:
  37533.                     $data AccountingObjectSerializer::deserialize(
  37534.                         $e->getResponseBody(),
  37535.                         '\XeroAPI\XeroPHP\Models\Accounting\Overpayments',
  37536.                         $e->getResponseHeaders()
  37537.                     );
  37538.                     $e->setResponseObject($data);
  37539.                     break;
  37540.             }
  37541.             throw $e;
  37542.         }
  37543.     }
  37544.     /**
  37545.      * Operation getOverpaymentAsync
  37546.      * Retrieves a specific overpayment using a unique overpayment Id
  37547.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  37548.      * @param  string $overpayment_id Unique identifier for a Overpayment (required)
  37549.      * @throws \InvalidArgumentException
  37550.      * @return \GuzzleHttp\Promise\PromiseInterface
  37551.      */
  37552.     public function getOverpaymentAsync($xero_tenant_id$overpayment_id)
  37553.     {
  37554.         return $this->getOverpaymentAsyncWithHttpInfo($xero_tenant_id$overpayment_id)
  37555.             ->then(
  37556.                 function ($response) {
  37557.                     return $response[0];
  37558.                 }
  37559.             );
  37560.     }
  37561.     /**
  37562.      * Operation getOverpaymentAsyncWithHttpInfo
  37563.      * Retrieves a specific overpayment using a unique overpayment Id
  37564.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  37565.      * @param  string $overpayment_id Unique identifier for a Overpayment (required)
  37566.      * @throws \InvalidArgumentException
  37567.      * @return \GuzzleHttp\Promise\PromiseInterface */
  37568.     public function getOverpaymentAsyncWithHttpInfo($xero_tenant_id$overpayment_id)
  37569.     {
  37570.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Overpayments';
  37571.         $request $this->getOverpaymentRequest($xero_tenant_id$overpayment_id);
  37572.         return $this->client
  37573.             ->sendAsync($request$this->createHttpClientOption())
  37574.             ->then(
  37575.                 function ($response) use ($returnType) {
  37576.                     $responseBody $response->getBody();
  37577.                     if ($returnType === '\SplFileObject') {
  37578.                         $content $responseBody//stream goes to serializer
  37579.                     } else {
  37580.                         $content $responseBody->getContents();
  37581.                     }
  37582.                     return [
  37583.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  37584.                         $response->getStatusCode(),
  37585.                         $response->getHeaders()
  37586.                     ];
  37587.                 },
  37588.                 function ($exception) {
  37589.                     $response $exception->getResponse();
  37590.                     $statusCode $response->getStatusCode();
  37591.                     throw new ApiException(
  37592.                         sprintf(
  37593.                             '[%d] Error connecting to the API (%s)',
  37594.                             $statusCode,
  37595.                             $exception->getRequest()->getUri()
  37596.                         ),
  37597.                         $statusCode,
  37598.                         $response->getHeaders(),
  37599.                         $response->getBody()
  37600.                     );
  37601.                 }
  37602.             );
  37603.     }
  37604.     /**
  37605.      * Create request for operation 'getOverpayment'
  37606.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  37607.      * @param  string $overpayment_id Unique identifier for a Overpayment (required)
  37608.      * @throws \InvalidArgumentException
  37609.      * @return \GuzzleHttp\Psr7\Request  */
  37610.     protected function getOverpaymentRequest($xero_tenant_id$overpayment_id)
  37611.     {
  37612.         // verify the required parameter 'xero_tenant_id' is set
  37613.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  37614.             throw new \InvalidArgumentException(
  37615.                 'Missing the required parameter $xero_tenant_id when calling getOverpayment'
  37616.             );
  37617.         }
  37618.         // verify the required parameter 'overpayment_id' is set
  37619.         if ($overpayment_id === null || (is_array($overpayment_id) && count($overpayment_id) === 0)) {
  37620.             throw new \InvalidArgumentException(
  37621.                 'Missing the required parameter $overpayment_id when calling getOverpayment'
  37622.             );
  37623.         }
  37624.         $resourcePath '/Overpayments/{OverpaymentID}';
  37625.         $formParams = [];
  37626.         $queryParams = [];
  37627.         $headerParams = [];
  37628.         $httpBody '';
  37629.         $multipart false;
  37630.         // header params
  37631.         if ($xero_tenant_id !== null) {
  37632.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  37633.         }
  37634.         // path params
  37635.         if ($overpayment_id !== null) {
  37636.             $resourcePath str_replace(
  37637.                 '{' 'OverpaymentID' '}',
  37638.                 AccountingObjectSerializer::toPathValue($overpayment_id),
  37639.                 $resourcePath
  37640.             );
  37641.         }
  37642.         // body params
  37643.         $_tempBody null;
  37644.         if ($multipart) {
  37645.             $headers $this->headerSelector->selectHeadersForMultipart(
  37646.                 ['application/json']
  37647.             );
  37648.         } else {
  37649.             $headers $this->headerSelector->selectHeaders(
  37650.                 ['application/json'],
  37651.                 []
  37652.             );
  37653.         }
  37654.         // for model (json/xml)
  37655.         if (isset($_tempBody)) {
  37656.             // $_tempBody is the method argument, if present
  37657.             if ($headers['Content-Type'] === 'application/json') {
  37658.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  37659.             } else {
  37660.                 $httpBody $_tempBody;
  37661.             }
  37662.         } elseif (count($formParams) > 0) {
  37663.             if ($multipart) {
  37664.                 $multipartContents = [
  37665.                     [
  37666.                         'Content-type' => 'multipart/form-data',
  37667.                     ]
  37668.                 ];
  37669.                 
  37670.                 // for HTTP post (form)
  37671.                 $httpBody = new MultipartStream($multipartContents);
  37672.             } elseif ($headers['Content-Type'] === 'application/json') {
  37673.                 $httpBody \GuzzleHttp\json_encode($formParams);
  37674.             } else {
  37675.                 // for HTTP post (form)
  37676.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  37677.             }
  37678.         }
  37679.         // this endpoint requires OAuth (access token)
  37680.         if ($this->config->getAccessToken() !== null) {
  37681.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  37682.         }
  37683.         $defaultHeaders = [];
  37684.         if ($this->config->getUserAgent()) {
  37685.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  37686.         }
  37687.         $headers array_merge(
  37688.             $defaultHeaders,
  37689.             $headerParams,
  37690.             $headers
  37691.         );
  37692.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  37693.         return new Request(
  37694.             'GET',
  37695.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  37696.             $headers,
  37697.             $httpBody
  37698.         );
  37699.     }
  37700.     /**
  37701.      * Operation getOverpaymentHistory
  37702.      * Retrieves history records of a specific overpayment
  37703.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  37704.      * @param  string $overpayment_id Unique identifier for a Overpayment (required)
  37705.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  37706.      * @throws \InvalidArgumentException
  37707.      * @return \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords
  37708.      */
  37709.     public function getOverpaymentHistory($xero_tenant_id$overpayment_id)
  37710.     {
  37711.         list($response) = $this->getOverpaymentHistoryWithHttpInfo($xero_tenant_id$overpayment_id);
  37712.         return $response;
  37713.     }
  37714.     /**
  37715.      * Operation getOverpaymentHistoryWithHttpInfo
  37716.      * Retrieves history records of a specific overpayment
  37717.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  37718.      * @param  string $overpayment_id Unique identifier for a Overpayment (required)
  37719.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  37720.      * @throws \InvalidArgumentException
  37721.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords, HTTP status code, HTTP response headers (array of strings)
  37722.      */
  37723.     public function getOverpaymentHistoryWithHttpInfo($xero_tenant_id$overpayment_id)
  37724.     {
  37725.         $request $this->getOverpaymentHistoryRequest($xero_tenant_id$overpayment_id);
  37726.         try {
  37727.             $options $this->createHttpClientOption();
  37728.             try {
  37729.                 $response $this->client->send($request$options);
  37730.             } catch (RequestException $e) {
  37731.                 throw new ApiException(
  37732.                     "[{$e->getCode()}{$e->getMessage()}",
  37733.                     $e->getCode(),
  37734.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  37735.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  37736.                 );
  37737.             }
  37738.             $statusCode $response->getStatusCode();
  37739.             if ($statusCode 200 || $statusCode 299) {
  37740.                 throw new ApiException(
  37741.                     sprintf(
  37742.                         '[%d] Error connecting to the API (%s)',
  37743.                         $statusCode,
  37744.                         $request->getUri()
  37745.                     ),
  37746.                     $statusCode,
  37747.                     $response->getHeaders(),
  37748.                     $response->getBody()
  37749.                 );
  37750.             }
  37751.             $responseBody $response->getBody();
  37752.             switch($statusCode) {
  37753.                 case 200:
  37754.                     if ('\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords' === '\SplFileObject') {
  37755.                         $content $responseBody//stream goes to serializer
  37756.                     } else {
  37757.                         $content $responseBody->getContents();
  37758.                     }
  37759.                     return [
  37760.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords', []),
  37761.                         $response->getStatusCode(),
  37762.                         $response->getHeaders()
  37763.                     ];
  37764.             }
  37765.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  37766.             $responseBody $response->getBody();
  37767.             if ($returnType === '\SplFileObject') {
  37768.                 $content $responseBody//stream goes to serializer
  37769.             } else {
  37770.                 $content $responseBody->getContents();
  37771.             }
  37772.             return [
  37773.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  37774.                 $response->getStatusCode(),
  37775.                 $response->getHeaders()
  37776.             ];
  37777.         } catch (ApiException $e) {
  37778.             switch ($e->getCode()) {
  37779.                 case 200:
  37780.                     $data AccountingObjectSerializer::deserialize(
  37781.                         $e->getResponseBody(),
  37782.                         '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords',
  37783.                         $e->getResponseHeaders()
  37784.                     );
  37785.                     $e->setResponseObject($data);
  37786.                     break;
  37787.             }
  37788.             throw $e;
  37789.         }
  37790.     }
  37791.     /**
  37792.      * Operation getOverpaymentHistoryAsync
  37793.      * Retrieves history records of a specific overpayment
  37794.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  37795.      * @param  string $overpayment_id Unique identifier for a Overpayment (required)
  37796.      * @throws \InvalidArgumentException
  37797.      * @return \GuzzleHttp\Promise\PromiseInterface
  37798.      */
  37799.     public function getOverpaymentHistoryAsync($xero_tenant_id$overpayment_id)
  37800.     {
  37801.         return $this->getOverpaymentHistoryAsyncWithHttpInfo($xero_tenant_id$overpayment_id)
  37802.             ->then(
  37803.                 function ($response) {
  37804.                     return $response[0];
  37805.                 }
  37806.             );
  37807.     }
  37808.     /**
  37809.      * Operation getOverpaymentHistoryAsyncWithHttpInfo
  37810.      * Retrieves history records of a specific overpayment
  37811.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  37812.      * @param  string $overpayment_id Unique identifier for a Overpayment (required)
  37813.      * @throws \InvalidArgumentException
  37814.      * @return \GuzzleHttp\Promise\PromiseInterface */
  37815.     public function getOverpaymentHistoryAsyncWithHttpInfo($xero_tenant_id$overpayment_id)
  37816.     {
  37817.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  37818.         $request $this->getOverpaymentHistoryRequest($xero_tenant_id$overpayment_id);
  37819.         return $this->client
  37820.             ->sendAsync($request$this->createHttpClientOption())
  37821.             ->then(
  37822.                 function ($response) use ($returnType) {
  37823.                     $responseBody $response->getBody();
  37824.                     if ($returnType === '\SplFileObject') {
  37825.                         $content $responseBody//stream goes to serializer
  37826.                     } else {
  37827.                         $content $responseBody->getContents();
  37828.                     }
  37829.                     return [
  37830.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  37831.                         $response->getStatusCode(),
  37832.                         $response->getHeaders()
  37833.                     ];
  37834.                 },
  37835.                 function ($exception) {
  37836.                     $response $exception->getResponse();
  37837.                     $statusCode $response->getStatusCode();
  37838.                     throw new ApiException(
  37839.                         sprintf(
  37840.                             '[%d] Error connecting to the API (%s)',
  37841.                             $statusCode,
  37842.                             $exception->getRequest()->getUri()
  37843.                         ),
  37844.                         $statusCode,
  37845.                         $response->getHeaders(),
  37846.                         $response->getBody()
  37847.                     );
  37848.                 }
  37849.             );
  37850.     }
  37851.     /**
  37852.      * Create request for operation 'getOverpaymentHistory'
  37853.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  37854.      * @param  string $overpayment_id Unique identifier for a Overpayment (required)
  37855.      * @throws \InvalidArgumentException
  37856.      * @return \GuzzleHttp\Psr7\Request  */
  37857.     protected function getOverpaymentHistoryRequest($xero_tenant_id$overpayment_id)
  37858.     {
  37859.         // verify the required parameter 'xero_tenant_id' is set
  37860.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  37861.             throw new \InvalidArgumentException(
  37862.                 'Missing the required parameter $xero_tenant_id when calling getOverpaymentHistory'
  37863.             );
  37864.         }
  37865.         // verify the required parameter 'overpayment_id' is set
  37866.         if ($overpayment_id === null || (is_array($overpayment_id) && count($overpayment_id) === 0)) {
  37867.             throw new \InvalidArgumentException(
  37868.                 'Missing the required parameter $overpayment_id when calling getOverpaymentHistory'
  37869.             );
  37870.         }
  37871.         $resourcePath '/Overpayments/{OverpaymentID}/History';
  37872.         $formParams = [];
  37873.         $queryParams = [];
  37874.         $headerParams = [];
  37875.         $httpBody '';
  37876.         $multipart false;
  37877.         // header params
  37878.         if ($xero_tenant_id !== null) {
  37879.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  37880.         }
  37881.         // path params
  37882.         if ($overpayment_id !== null) {
  37883.             $resourcePath str_replace(
  37884.                 '{' 'OverpaymentID' '}',
  37885.                 AccountingObjectSerializer::toPathValue($overpayment_id),
  37886.                 $resourcePath
  37887.             );
  37888.         }
  37889.         // body params
  37890.         $_tempBody null;
  37891.         if ($multipart) {
  37892.             $headers $this->headerSelector->selectHeadersForMultipart(
  37893.                 ['application/json']
  37894.             );
  37895.         } else {
  37896.             $headers $this->headerSelector->selectHeaders(
  37897.                 ['application/json'],
  37898.                 []
  37899.             );
  37900.         }
  37901.         // for model (json/xml)
  37902.         if (isset($_tempBody)) {
  37903.             // $_tempBody is the method argument, if present
  37904.             if ($headers['Content-Type'] === 'application/json') {
  37905.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  37906.             } else {
  37907.                 $httpBody $_tempBody;
  37908.             }
  37909.         } elseif (count($formParams) > 0) {
  37910.             if ($multipart) {
  37911.                 $multipartContents = [
  37912.                     [
  37913.                         'Content-type' => 'multipart/form-data',
  37914.                     ]
  37915.                 ];
  37916.                 
  37917.                 // for HTTP post (form)
  37918.                 $httpBody = new MultipartStream($multipartContents);
  37919.             } elseif ($headers['Content-Type'] === 'application/json') {
  37920.                 $httpBody \GuzzleHttp\json_encode($formParams);
  37921.             } else {
  37922.                 // for HTTP post (form)
  37923.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  37924.             }
  37925.         }
  37926.         // this endpoint requires OAuth (access token)
  37927.         if ($this->config->getAccessToken() !== null) {
  37928.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  37929.         }
  37930.         $defaultHeaders = [];
  37931.         if ($this->config->getUserAgent()) {
  37932.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  37933.         }
  37934.         $headers array_merge(
  37935.             $defaultHeaders,
  37936.             $headerParams,
  37937.             $headers
  37938.         );
  37939.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  37940.         return new Request(
  37941.             'GET',
  37942.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  37943.             $headers,
  37944.             $httpBody
  37945.         );
  37946.     }
  37947.     /**
  37948.      * Operation getOverpayments
  37949.      * Retrieves overpayments
  37950.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  37951.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  37952.      * @param  string $where Filter by an any element (optional)
  37953.      * @param  string $order Order by an any element (optional)
  37954.      * @param  int $page e.g. page&#x3D;1 â€“ Up to 100 overpayments will be returned in a single API call with line items shown for each overpayment (optional)
  37955.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  37956.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  37957.      * @throws \InvalidArgumentException
  37958.      * @return \XeroAPI\XeroPHP\Models\Accounting\Overpayments
  37959.      */
  37960.     public function getOverpayments($xero_tenant_id$if_modified_since null$where null$order null$page null$unitdp null)
  37961.     {
  37962.         list($response) = $this->getOverpaymentsWithHttpInfo($xero_tenant_id$if_modified_since$where$order$page$unitdp);
  37963.         return $response;
  37964.     }
  37965.     /**
  37966.      * Operation getOverpaymentsWithHttpInfo
  37967.      * Retrieves overpayments
  37968.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  37969.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  37970.      * @param  string $where Filter by an any element (optional)
  37971.      * @param  string $order Order by an any element (optional)
  37972.      * @param  int $page e.g. page&#x3D;1 â€“ Up to 100 overpayments will be returned in a single API call with line items shown for each overpayment (optional)
  37973.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  37974.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  37975.      * @throws \InvalidArgumentException
  37976.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Overpayments, HTTP status code, HTTP response headers (array of strings)
  37977.      */
  37978.     public function getOverpaymentsWithHttpInfo($xero_tenant_id$if_modified_since null$where null$order null$page null$unitdp null)
  37979.     {
  37980.         $request $this->getOverpaymentsRequest($xero_tenant_id$if_modified_since$where$order$page$unitdp);
  37981.         try {
  37982.             $options $this->createHttpClientOption();
  37983.             try {
  37984.                 $response $this->client->send($request$options);
  37985.             } catch (RequestException $e) {
  37986.                 throw new ApiException(
  37987.                     "[{$e->getCode()}{$e->getMessage()}",
  37988.                     $e->getCode(),
  37989.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  37990.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  37991.                 );
  37992.             }
  37993.             $statusCode $response->getStatusCode();
  37994.             if ($statusCode 200 || $statusCode 299) {
  37995.                 throw new ApiException(
  37996.                     sprintf(
  37997.                         '[%d] Error connecting to the API (%s)',
  37998.                         $statusCode,
  37999.                         $request->getUri()
  38000.                     ),
  38001.                     $statusCode,
  38002.                     $response->getHeaders(),
  38003.                     $response->getBody()
  38004.                 );
  38005.             }
  38006.             $responseBody $response->getBody();
  38007.             switch($statusCode) {
  38008.                 case 200:
  38009.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Overpayments' === '\SplFileObject') {
  38010.                         $content $responseBody//stream goes to serializer
  38011.                     } else {
  38012.                         $content $responseBody->getContents();
  38013.                     }
  38014.                     return [
  38015.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Overpayments', []),
  38016.                         $response->getStatusCode(),
  38017.                         $response->getHeaders()
  38018.                     ];
  38019.             }
  38020.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Overpayments';
  38021.             $responseBody $response->getBody();
  38022.             if ($returnType === '\SplFileObject') {
  38023.                 $content $responseBody//stream goes to serializer
  38024.             } else {
  38025.                 $content $responseBody->getContents();
  38026.             }
  38027.             return [
  38028.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  38029.                 $response->getStatusCode(),
  38030.                 $response->getHeaders()
  38031.             ];
  38032.         } catch (ApiException $e) {
  38033.             switch ($e->getCode()) {
  38034.                 case 200:
  38035.                     $data AccountingObjectSerializer::deserialize(
  38036.                         $e->getResponseBody(),
  38037.                         '\XeroAPI\XeroPHP\Models\Accounting\Overpayments',
  38038.                         $e->getResponseHeaders()
  38039.                     );
  38040.                     $e->setResponseObject($data);
  38041.                     break;
  38042.             }
  38043.             throw $e;
  38044.         }
  38045.     }
  38046.     /**
  38047.      * Operation getOverpaymentsAsync
  38048.      * Retrieves overpayments
  38049.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  38050.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  38051.      * @param  string $where Filter by an any element (optional)
  38052.      * @param  string $order Order by an any element (optional)
  38053.      * @param  int $page e.g. page&#x3D;1 â€“ Up to 100 overpayments will be returned in a single API call with line items shown for each overpayment (optional)
  38054.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  38055.      * @throws \InvalidArgumentException
  38056.      * @return \GuzzleHttp\Promise\PromiseInterface
  38057.      */
  38058.     public function getOverpaymentsAsync($xero_tenant_id$if_modified_since null$where null$order null$page null$unitdp null)
  38059.     {
  38060.         return $this->getOverpaymentsAsyncWithHttpInfo($xero_tenant_id$if_modified_since$where$order$page$unitdp)
  38061.             ->then(
  38062.                 function ($response) {
  38063.                     return $response[0];
  38064.                 }
  38065.             );
  38066.     }
  38067.     /**
  38068.      * Operation getOverpaymentsAsyncWithHttpInfo
  38069.      * Retrieves overpayments
  38070.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  38071.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  38072.      * @param  string $where Filter by an any element (optional)
  38073.      * @param  string $order Order by an any element (optional)
  38074.      * @param  int $page e.g. page&#x3D;1 â€“ Up to 100 overpayments will be returned in a single API call with line items shown for each overpayment (optional)
  38075.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  38076.      * @throws \InvalidArgumentException
  38077.      * @return \GuzzleHttp\Promise\PromiseInterface */
  38078.     public function getOverpaymentsAsyncWithHttpInfo($xero_tenant_id$if_modified_since null$where null$order null$page null$unitdp null)
  38079.     {
  38080.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Overpayments';
  38081.         $request $this->getOverpaymentsRequest($xero_tenant_id$if_modified_since$where$order$page$unitdp);
  38082.         return $this->client
  38083.             ->sendAsync($request$this->createHttpClientOption())
  38084.             ->then(
  38085.                 function ($response) use ($returnType) {
  38086.                     $responseBody $response->getBody();
  38087.                     if ($returnType === '\SplFileObject') {
  38088.                         $content $responseBody//stream goes to serializer
  38089.                     } else {
  38090.                         $content $responseBody->getContents();
  38091.                     }
  38092.                     return [
  38093.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  38094.                         $response->getStatusCode(),
  38095.                         $response->getHeaders()
  38096.                     ];
  38097.                 },
  38098.                 function ($exception) {
  38099.                     $response $exception->getResponse();
  38100.                     $statusCode $response->getStatusCode();
  38101.                     throw new ApiException(
  38102.                         sprintf(
  38103.                             '[%d] Error connecting to the API (%s)',
  38104.                             $statusCode,
  38105.                             $exception->getRequest()->getUri()
  38106.                         ),
  38107.                         $statusCode,
  38108.                         $response->getHeaders(),
  38109.                         $response->getBody()
  38110.                     );
  38111.                 }
  38112.             );
  38113.     }
  38114.     /**
  38115.      * Create request for operation 'getOverpayments'
  38116.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  38117.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  38118.      * @param  string $where Filter by an any element (optional)
  38119.      * @param  string $order Order by an any element (optional)
  38120.      * @param  int $page e.g. page&#x3D;1 â€“ Up to 100 overpayments will be returned in a single API call with line items shown for each overpayment (optional)
  38121.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  38122.      * @throws \InvalidArgumentException
  38123.      * @return \GuzzleHttp\Psr7\Request  */
  38124.     protected function getOverpaymentsRequest($xero_tenant_id$if_modified_since null$where null$order null$page null$unitdp null)
  38125.     {
  38126.         // verify the required parameter 'xero_tenant_id' is set
  38127.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  38128.             throw new \InvalidArgumentException(
  38129.                 'Missing the required parameter $xero_tenant_id when calling getOverpayments'
  38130.             );
  38131.         }
  38132.         $resourcePath '/Overpayments';
  38133.         $formParams = [];
  38134.         $queryParams = [];
  38135.         $headerParams = [];
  38136.         $httpBody '';
  38137.         $multipart false;
  38138.         // query params
  38139.         if ($where !== null) {
  38140.             $queryParams['where'] = AccountingObjectSerializer::toQueryValue($where);
  38141.         }
  38142.         // query params
  38143.         if ($order !== null) {
  38144.             $queryParams['order'] = AccountingObjectSerializer::toQueryValue($order);
  38145.         }
  38146.         // query params
  38147.         if ($page !== null) {
  38148.             $queryParams['page'] = AccountingObjectSerializer::toQueryValue($page);
  38149.         }
  38150.         // query params
  38151.         if ($unitdp !== null) {
  38152.             $queryParams['unitdp'] = AccountingObjectSerializer::toQueryValue($unitdp);
  38153.         }
  38154.         // header params
  38155.         if ($xero_tenant_id !== null) {
  38156.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  38157.         }
  38158.         // header params
  38159.         if ($if_modified_since !== null) {
  38160.             $headerParams['If-Modified-Since'] = AccountingObjectSerializer::toHeaderValue($if_modified_since);
  38161.         }
  38162.         // body params
  38163.         $_tempBody null;
  38164.         if ($multipart) {
  38165.             $headers $this->headerSelector->selectHeadersForMultipart(
  38166.                 ['application/json']
  38167.             );
  38168.         } else {
  38169.             $headers $this->headerSelector->selectHeaders(
  38170.                 ['application/json'],
  38171.                 []
  38172.             );
  38173.         }
  38174.         // for model (json/xml)
  38175.         if (isset($_tempBody)) {
  38176.             // $_tempBody is the method argument, if present
  38177.             if ($headers['Content-Type'] === 'application/json') {
  38178.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  38179.             } else {
  38180.                 $httpBody $_tempBody;
  38181.             }
  38182.         } elseif (count($formParams) > 0) {
  38183.             if ($multipart) {
  38184.                 $multipartContents = [
  38185.                     [
  38186.                         'Content-type' => 'multipart/form-data',
  38187.                     ]
  38188.                 ];
  38189.                 
  38190.                 // for HTTP post (form)
  38191.                 $httpBody = new MultipartStream($multipartContents);
  38192.             } elseif ($headers['Content-Type'] === 'application/json') {
  38193.                 $httpBody \GuzzleHttp\json_encode($formParams);
  38194.             } else {
  38195.                 // for HTTP post (form)
  38196.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  38197.             }
  38198.         }
  38199.         // this endpoint requires OAuth (access token)
  38200.         if ($this->config->getAccessToken() !== null) {
  38201.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  38202.         }
  38203.         $defaultHeaders = [];
  38204.         if ($this->config->getUserAgent()) {
  38205.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  38206.         }
  38207.         $headers array_merge(
  38208.             $defaultHeaders,
  38209.             $headerParams,
  38210.             $headers
  38211.         );
  38212.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  38213.         return new Request(
  38214.             'GET',
  38215.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  38216.             $headers,
  38217.             $httpBody
  38218.         );
  38219.     }
  38220.     /**
  38221.      * Operation getPayment
  38222.      * Retrieves a specific payment for invoices and credit notes using a unique payment Id
  38223.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  38224.      * @param  string $payment_id Unique identifier for a Payment (required)
  38225.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  38226.      * @throws \InvalidArgumentException
  38227.      * @return \XeroAPI\XeroPHP\Models\Accounting\Payments
  38228.      */
  38229.     public function getPayment($xero_tenant_id$payment_id)
  38230.     {
  38231.         list($response) = $this->getPaymentWithHttpInfo($xero_tenant_id$payment_id);
  38232.         return $response;
  38233.     }
  38234.     /**
  38235.      * Operation getPaymentWithHttpInfo
  38236.      * Retrieves a specific payment for invoices and credit notes using a unique payment Id
  38237.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  38238.      * @param  string $payment_id Unique identifier for a Payment (required)
  38239.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  38240.      * @throws \InvalidArgumentException
  38241.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Payments, HTTP status code, HTTP response headers (array of strings)
  38242.      */
  38243.     public function getPaymentWithHttpInfo($xero_tenant_id$payment_id)
  38244.     {
  38245.         $request $this->getPaymentRequest($xero_tenant_id$payment_id);
  38246.         try {
  38247.             $options $this->createHttpClientOption();
  38248.             try {
  38249.                 $response $this->client->send($request$options);
  38250.             } catch (RequestException $e) {
  38251.                 throw new ApiException(
  38252.                     "[{$e->getCode()}{$e->getMessage()}",
  38253.                     $e->getCode(),
  38254.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  38255.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  38256.                 );
  38257.             }
  38258.             $statusCode $response->getStatusCode();
  38259.             if ($statusCode 200 || $statusCode 299) {
  38260.                 throw new ApiException(
  38261.                     sprintf(
  38262.                         '[%d] Error connecting to the API (%s)',
  38263.                         $statusCode,
  38264.                         $request->getUri()
  38265.                     ),
  38266.                     $statusCode,
  38267.                     $response->getHeaders(),
  38268.                     $response->getBody()
  38269.                 );
  38270.             }
  38271.             $responseBody $response->getBody();
  38272.             switch($statusCode) {
  38273.                 case 200:
  38274.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Payments' === '\SplFileObject') {
  38275.                         $content $responseBody//stream goes to serializer
  38276.                     } else {
  38277.                         $content $responseBody->getContents();
  38278.                     }
  38279.                     return [
  38280.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Payments', []),
  38281.                         $response->getStatusCode(),
  38282.                         $response->getHeaders()
  38283.                     ];
  38284.             }
  38285.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Payments';
  38286.             $responseBody $response->getBody();
  38287.             if ($returnType === '\SplFileObject') {
  38288.                 $content $responseBody//stream goes to serializer
  38289.             } else {
  38290.                 $content $responseBody->getContents();
  38291.             }
  38292.             return [
  38293.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  38294.                 $response->getStatusCode(),
  38295.                 $response->getHeaders()
  38296.             ];
  38297.         } catch (ApiException $e) {
  38298.             switch ($e->getCode()) {
  38299.                 case 200:
  38300.                     $data AccountingObjectSerializer::deserialize(
  38301.                         $e->getResponseBody(),
  38302.                         '\XeroAPI\XeroPHP\Models\Accounting\Payments',
  38303.                         $e->getResponseHeaders()
  38304.                     );
  38305.                     $e->setResponseObject($data);
  38306.                     break;
  38307.             }
  38308.             throw $e;
  38309.         }
  38310.     }
  38311.     /**
  38312.      * Operation getPaymentAsync
  38313.      * Retrieves a specific payment for invoices and credit notes using a unique payment Id
  38314.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  38315.      * @param  string $payment_id Unique identifier for a Payment (required)
  38316.      * @throws \InvalidArgumentException
  38317.      * @return \GuzzleHttp\Promise\PromiseInterface
  38318.      */
  38319.     public function getPaymentAsync($xero_tenant_id$payment_id)
  38320.     {
  38321.         return $this->getPaymentAsyncWithHttpInfo($xero_tenant_id$payment_id)
  38322.             ->then(
  38323.                 function ($response) {
  38324.                     return $response[0];
  38325.                 }
  38326.             );
  38327.     }
  38328.     /**
  38329.      * Operation getPaymentAsyncWithHttpInfo
  38330.      * Retrieves a specific payment for invoices and credit notes using a unique payment Id
  38331.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  38332.      * @param  string $payment_id Unique identifier for a Payment (required)
  38333.      * @throws \InvalidArgumentException
  38334.      * @return \GuzzleHttp\Promise\PromiseInterface */
  38335.     public function getPaymentAsyncWithHttpInfo($xero_tenant_id$payment_id)
  38336.     {
  38337.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Payments';
  38338.         $request $this->getPaymentRequest($xero_tenant_id$payment_id);
  38339.         return $this->client
  38340.             ->sendAsync($request$this->createHttpClientOption())
  38341.             ->then(
  38342.                 function ($response) use ($returnType) {
  38343.                     $responseBody $response->getBody();
  38344.                     if ($returnType === '\SplFileObject') {
  38345.                         $content $responseBody//stream goes to serializer
  38346.                     } else {
  38347.                         $content $responseBody->getContents();
  38348.                     }
  38349.                     return [
  38350.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  38351.                         $response->getStatusCode(),
  38352.                         $response->getHeaders()
  38353.                     ];
  38354.                 },
  38355.                 function ($exception) {
  38356.                     $response $exception->getResponse();
  38357.                     $statusCode $response->getStatusCode();
  38358.                     throw new ApiException(
  38359.                         sprintf(
  38360.                             '[%d] Error connecting to the API (%s)',
  38361.                             $statusCode,
  38362.                             $exception->getRequest()->getUri()
  38363.                         ),
  38364.                         $statusCode,
  38365.                         $response->getHeaders(),
  38366.                         $response->getBody()
  38367.                     );
  38368.                 }
  38369.             );
  38370.     }
  38371.     /**
  38372.      * Create request for operation 'getPayment'
  38373.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  38374.      * @param  string $payment_id Unique identifier for a Payment (required)
  38375.      * @throws \InvalidArgumentException
  38376.      * @return \GuzzleHttp\Psr7\Request  */
  38377.     protected function getPaymentRequest($xero_tenant_id$payment_id)
  38378.     {
  38379.         // verify the required parameter 'xero_tenant_id' is set
  38380.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  38381.             throw new \InvalidArgumentException(
  38382.                 'Missing the required parameter $xero_tenant_id when calling getPayment'
  38383.             );
  38384.         }
  38385.         // verify the required parameter 'payment_id' is set
  38386.         if ($payment_id === null || (is_array($payment_id) && count($payment_id) === 0)) {
  38387.             throw new \InvalidArgumentException(
  38388.                 'Missing the required parameter $payment_id when calling getPayment'
  38389.             );
  38390.         }
  38391.         $resourcePath '/Payments/{PaymentID}';
  38392.         $formParams = [];
  38393.         $queryParams = [];
  38394.         $headerParams = [];
  38395.         $httpBody '';
  38396.         $multipart false;
  38397.         // header params
  38398.         if ($xero_tenant_id !== null) {
  38399.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  38400.         }
  38401.         // path params
  38402.         if ($payment_id !== null) {
  38403.             $resourcePath str_replace(
  38404.                 '{' 'PaymentID' '}',
  38405.                 AccountingObjectSerializer::toPathValue($payment_id),
  38406.                 $resourcePath
  38407.             );
  38408.         }
  38409.         // body params
  38410.         $_tempBody null;
  38411.         if ($multipart) {
  38412.             $headers $this->headerSelector->selectHeadersForMultipart(
  38413.                 ['application/json']
  38414.             );
  38415.         } else {
  38416.             $headers $this->headerSelector->selectHeaders(
  38417.                 ['application/json'],
  38418.                 []
  38419.             );
  38420.         }
  38421.         // for model (json/xml)
  38422.         if (isset($_tempBody)) {
  38423.             // $_tempBody is the method argument, if present
  38424.             if ($headers['Content-Type'] === 'application/json') {
  38425.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  38426.             } else {
  38427.                 $httpBody $_tempBody;
  38428.             }
  38429.         } elseif (count($formParams) > 0) {
  38430.             if ($multipart) {
  38431.                 $multipartContents = [
  38432.                     [
  38433.                         'Content-type' => 'multipart/form-data',
  38434.                     ]
  38435.                 ];
  38436.                 
  38437.                 // for HTTP post (form)
  38438.                 $httpBody = new MultipartStream($multipartContents);
  38439.             } elseif ($headers['Content-Type'] === 'application/json') {
  38440.                 $httpBody \GuzzleHttp\json_encode($formParams);
  38441.             } else {
  38442.                 // for HTTP post (form)
  38443.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  38444.             }
  38445.         }
  38446.         // this endpoint requires OAuth (access token)
  38447.         if ($this->config->getAccessToken() !== null) {
  38448.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  38449.         }
  38450.         $defaultHeaders = [];
  38451.         if ($this->config->getUserAgent()) {
  38452.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  38453.         }
  38454.         $headers array_merge(
  38455.             $defaultHeaders,
  38456.             $headerParams,
  38457.             $headers
  38458.         );
  38459.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  38460.         return new Request(
  38461.             'GET',
  38462.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  38463.             $headers,
  38464.             $httpBody
  38465.         );
  38466.     }
  38467.     /**
  38468.      * Operation getPaymentHistory
  38469.      * Retrieves history records of a specific payment
  38470.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  38471.      * @param  string $payment_id Unique identifier for a Payment (required)
  38472.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  38473.      * @throws \InvalidArgumentException
  38474.      * @return \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords
  38475.      */
  38476.     public function getPaymentHistory($xero_tenant_id$payment_id)
  38477.     {
  38478.         list($response) = $this->getPaymentHistoryWithHttpInfo($xero_tenant_id$payment_id);
  38479.         return $response;
  38480.     }
  38481.     /**
  38482.      * Operation getPaymentHistoryWithHttpInfo
  38483.      * Retrieves history records of a specific payment
  38484.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  38485.      * @param  string $payment_id Unique identifier for a Payment (required)
  38486.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  38487.      * @throws \InvalidArgumentException
  38488.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords, HTTP status code, HTTP response headers (array of strings)
  38489.      */
  38490.     public function getPaymentHistoryWithHttpInfo($xero_tenant_id$payment_id)
  38491.     {
  38492.         $request $this->getPaymentHistoryRequest($xero_tenant_id$payment_id);
  38493.         try {
  38494.             $options $this->createHttpClientOption();
  38495.             try {
  38496.                 $response $this->client->send($request$options);
  38497.             } catch (RequestException $e) {
  38498.                 throw new ApiException(
  38499.                     "[{$e->getCode()}{$e->getMessage()}",
  38500.                     $e->getCode(),
  38501.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  38502.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  38503.                 );
  38504.             }
  38505.             $statusCode $response->getStatusCode();
  38506.             if ($statusCode 200 || $statusCode 299) {
  38507.                 throw new ApiException(
  38508.                     sprintf(
  38509.                         '[%d] Error connecting to the API (%s)',
  38510.                         $statusCode,
  38511.                         $request->getUri()
  38512.                     ),
  38513.                     $statusCode,
  38514.                     $response->getHeaders(),
  38515.                     $response->getBody()
  38516.                 );
  38517.             }
  38518.             $responseBody $response->getBody();
  38519.             switch($statusCode) {
  38520.                 case 200:
  38521.                     if ('\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords' === '\SplFileObject') {
  38522.                         $content $responseBody//stream goes to serializer
  38523.                     } else {
  38524.                         $content $responseBody->getContents();
  38525.                     }
  38526.                     return [
  38527.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords', []),
  38528.                         $response->getStatusCode(),
  38529.                         $response->getHeaders()
  38530.                     ];
  38531.             }
  38532.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  38533.             $responseBody $response->getBody();
  38534.             if ($returnType === '\SplFileObject') {
  38535.                 $content $responseBody//stream goes to serializer
  38536.             } else {
  38537.                 $content $responseBody->getContents();
  38538.             }
  38539.             return [
  38540.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  38541.                 $response->getStatusCode(),
  38542.                 $response->getHeaders()
  38543.             ];
  38544.         } catch (ApiException $e) {
  38545.             switch ($e->getCode()) {
  38546.                 case 200:
  38547.                     $data AccountingObjectSerializer::deserialize(
  38548.                         $e->getResponseBody(),
  38549.                         '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords',
  38550.                         $e->getResponseHeaders()
  38551.                     );
  38552.                     $e->setResponseObject($data);
  38553.                     break;
  38554.             }
  38555.             throw $e;
  38556.         }
  38557.     }
  38558.     /**
  38559.      * Operation getPaymentHistoryAsync
  38560.      * Retrieves history records of a specific payment
  38561.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  38562.      * @param  string $payment_id Unique identifier for a Payment (required)
  38563.      * @throws \InvalidArgumentException
  38564.      * @return \GuzzleHttp\Promise\PromiseInterface
  38565.      */
  38566.     public function getPaymentHistoryAsync($xero_tenant_id$payment_id)
  38567.     {
  38568.         return $this->getPaymentHistoryAsyncWithHttpInfo($xero_tenant_id$payment_id)
  38569.             ->then(
  38570.                 function ($response) {
  38571.                     return $response[0];
  38572.                 }
  38573.             );
  38574.     }
  38575.     /**
  38576.      * Operation getPaymentHistoryAsyncWithHttpInfo
  38577.      * Retrieves history records of a specific payment
  38578.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  38579.      * @param  string $payment_id Unique identifier for a Payment (required)
  38580.      * @throws \InvalidArgumentException
  38581.      * @return \GuzzleHttp\Promise\PromiseInterface */
  38582.     public function getPaymentHistoryAsyncWithHttpInfo($xero_tenant_id$payment_id)
  38583.     {
  38584.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  38585.         $request $this->getPaymentHistoryRequest($xero_tenant_id$payment_id);
  38586.         return $this->client
  38587.             ->sendAsync($request$this->createHttpClientOption())
  38588.             ->then(
  38589.                 function ($response) use ($returnType) {
  38590.                     $responseBody $response->getBody();
  38591.                     if ($returnType === '\SplFileObject') {
  38592.                         $content $responseBody//stream goes to serializer
  38593.                     } else {
  38594.                         $content $responseBody->getContents();
  38595.                     }
  38596.                     return [
  38597.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  38598.                         $response->getStatusCode(),
  38599.                         $response->getHeaders()
  38600.                     ];
  38601.                 },
  38602.                 function ($exception) {
  38603.                     $response $exception->getResponse();
  38604.                     $statusCode $response->getStatusCode();
  38605.                     throw new ApiException(
  38606.                         sprintf(
  38607.                             '[%d] Error connecting to the API (%s)',
  38608.                             $statusCode,
  38609.                             $exception->getRequest()->getUri()
  38610.                         ),
  38611.                         $statusCode,
  38612.                         $response->getHeaders(),
  38613.                         $response->getBody()
  38614.                     );
  38615.                 }
  38616.             );
  38617.     }
  38618.     /**
  38619.      * Create request for operation 'getPaymentHistory'
  38620.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  38621.      * @param  string $payment_id Unique identifier for a Payment (required)
  38622.      * @throws \InvalidArgumentException
  38623.      * @return \GuzzleHttp\Psr7\Request  */
  38624.     protected function getPaymentHistoryRequest($xero_tenant_id$payment_id)
  38625.     {
  38626.         // verify the required parameter 'xero_tenant_id' is set
  38627.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  38628.             throw new \InvalidArgumentException(
  38629.                 'Missing the required parameter $xero_tenant_id when calling getPaymentHistory'
  38630.             );
  38631.         }
  38632.         // verify the required parameter 'payment_id' is set
  38633.         if ($payment_id === null || (is_array($payment_id) && count($payment_id) === 0)) {
  38634.             throw new \InvalidArgumentException(
  38635.                 'Missing the required parameter $payment_id when calling getPaymentHistory'
  38636.             );
  38637.         }
  38638.         $resourcePath '/Payments/{PaymentID}/History';
  38639.         $formParams = [];
  38640.         $queryParams = [];
  38641.         $headerParams = [];
  38642.         $httpBody '';
  38643.         $multipart false;
  38644.         // header params
  38645.         if ($xero_tenant_id !== null) {
  38646.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  38647.         }
  38648.         // path params
  38649.         if ($payment_id !== null) {
  38650.             $resourcePath str_replace(
  38651.                 '{' 'PaymentID' '}',
  38652.                 AccountingObjectSerializer::toPathValue($payment_id),
  38653.                 $resourcePath
  38654.             );
  38655.         }
  38656.         // body params
  38657.         $_tempBody null;
  38658.         if ($multipart) {
  38659.             $headers $this->headerSelector->selectHeadersForMultipart(
  38660.                 ['application/json']
  38661.             );
  38662.         } else {
  38663.             $headers $this->headerSelector->selectHeaders(
  38664.                 ['application/json'],
  38665.                 []
  38666.             );
  38667.         }
  38668.         // for model (json/xml)
  38669.         if (isset($_tempBody)) {
  38670.             // $_tempBody is the method argument, if present
  38671.             if ($headers['Content-Type'] === 'application/json') {
  38672.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  38673.             } else {
  38674.                 $httpBody $_tempBody;
  38675.             }
  38676.         } elseif (count($formParams) > 0) {
  38677.             if ($multipart) {
  38678.                 $multipartContents = [
  38679.                     [
  38680.                         'Content-type' => 'multipart/form-data',
  38681.                     ]
  38682.                 ];
  38683.                 
  38684.                 // for HTTP post (form)
  38685.                 $httpBody = new MultipartStream($multipartContents);
  38686.             } elseif ($headers['Content-Type'] === 'application/json') {
  38687.                 $httpBody \GuzzleHttp\json_encode($formParams);
  38688.             } else {
  38689.                 // for HTTP post (form)
  38690.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  38691.             }
  38692.         }
  38693.         // this endpoint requires OAuth (access token)
  38694.         if ($this->config->getAccessToken() !== null) {
  38695.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  38696.         }
  38697.         $defaultHeaders = [];
  38698.         if ($this->config->getUserAgent()) {
  38699.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  38700.         }
  38701.         $headers array_merge(
  38702.             $defaultHeaders,
  38703.             $headerParams,
  38704.             $headers
  38705.         );
  38706.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  38707.         return new Request(
  38708.             'GET',
  38709.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  38710.             $headers,
  38711.             $httpBody
  38712.         );
  38713.     }
  38714.     /**
  38715.      * Operation getPaymentServices
  38716.      * Retrieves payment services
  38717.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  38718.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  38719.      * @throws \InvalidArgumentException
  38720.      * @return \XeroAPI\XeroPHP\Models\Accounting\PaymentServices
  38721.      */
  38722.     public function getPaymentServices($xero_tenant_id)
  38723.     {
  38724.         list($response) = $this->getPaymentServicesWithHttpInfo($xero_tenant_id);
  38725.         return $response;
  38726.     }
  38727.     /**
  38728.      * Operation getPaymentServicesWithHttpInfo
  38729.      * Retrieves payment services
  38730.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  38731.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  38732.      * @throws \InvalidArgumentException
  38733.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\PaymentServices, HTTP status code, HTTP response headers (array of strings)
  38734.      */
  38735.     public function getPaymentServicesWithHttpInfo($xero_tenant_id)
  38736.     {
  38737.         $request $this->getPaymentServicesRequest($xero_tenant_id);
  38738.         try {
  38739.             $options $this->createHttpClientOption();
  38740.             try {
  38741.                 $response $this->client->send($request$options);
  38742.             } catch (RequestException $e) {
  38743.                 throw new ApiException(
  38744.                     "[{$e->getCode()}{$e->getMessage()}",
  38745.                     $e->getCode(),
  38746.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  38747.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  38748.                 );
  38749.             }
  38750.             $statusCode $response->getStatusCode();
  38751.             if ($statusCode 200 || $statusCode 299) {
  38752.                 throw new ApiException(
  38753.                     sprintf(
  38754.                         '[%d] Error connecting to the API (%s)',
  38755.                         $statusCode,
  38756.                         $request->getUri()
  38757.                     ),
  38758.                     $statusCode,
  38759.                     $response->getHeaders(),
  38760.                     $response->getBody()
  38761.                 );
  38762.             }
  38763.             $responseBody $response->getBody();
  38764.             switch($statusCode) {
  38765.                 case 200:
  38766.                     if ('\XeroAPI\XeroPHP\Models\Accounting\PaymentServices' === '\SplFileObject') {
  38767.                         $content $responseBody//stream goes to serializer
  38768.                     } else {
  38769.                         $content $responseBody->getContents();
  38770.                     }
  38771.                     return [
  38772.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\PaymentServices', []),
  38773.                         $response->getStatusCode(),
  38774.                         $response->getHeaders()
  38775.                     ];
  38776.             }
  38777.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\PaymentServices';
  38778.             $responseBody $response->getBody();
  38779.             if ($returnType === '\SplFileObject') {
  38780.                 $content $responseBody//stream goes to serializer
  38781.             } else {
  38782.                 $content $responseBody->getContents();
  38783.             }
  38784.             return [
  38785.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  38786.                 $response->getStatusCode(),
  38787.                 $response->getHeaders()
  38788.             ];
  38789.         } catch (ApiException $e) {
  38790.             switch ($e->getCode()) {
  38791.                 case 200:
  38792.                     $data AccountingObjectSerializer::deserialize(
  38793.                         $e->getResponseBody(),
  38794.                         '\XeroAPI\XeroPHP\Models\Accounting\PaymentServices',
  38795.                         $e->getResponseHeaders()
  38796.                     );
  38797.                     $e->setResponseObject($data);
  38798.                     break;
  38799.             }
  38800.             throw $e;
  38801.         }
  38802.     }
  38803.     /**
  38804.      * Operation getPaymentServicesAsync
  38805.      * Retrieves payment services
  38806.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  38807.      * @throws \InvalidArgumentException
  38808.      * @return \GuzzleHttp\Promise\PromiseInterface
  38809.      */
  38810.     public function getPaymentServicesAsync($xero_tenant_id)
  38811.     {
  38812.         return $this->getPaymentServicesAsyncWithHttpInfo($xero_tenant_id)
  38813.             ->then(
  38814.                 function ($response) {
  38815.                     return $response[0];
  38816.                 }
  38817.             );
  38818.     }
  38819.     /**
  38820.      * Operation getPaymentServicesAsyncWithHttpInfo
  38821.      * Retrieves payment services
  38822.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  38823.      * @throws \InvalidArgumentException
  38824.      * @return \GuzzleHttp\Promise\PromiseInterface */
  38825.     public function getPaymentServicesAsyncWithHttpInfo($xero_tenant_id)
  38826.     {
  38827.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\PaymentServices';
  38828.         $request $this->getPaymentServicesRequest($xero_tenant_id);
  38829.         return $this->client
  38830.             ->sendAsync($request$this->createHttpClientOption())
  38831.             ->then(
  38832.                 function ($response) use ($returnType) {
  38833.                     $responseBody $response->getBody();
  38834.                     if ($returnType === '\SplFileObject') {
  38835.                         $content $responseBody//stream goes to serializer
  38836.                     } else {
  38837.                         $content $responseBody->getContents();
  38838.                     }
  38839.                     return [
  38840.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  38841.                         $response->getStatusCode(),
  38842.                         $response->getHeaders()
  38843.                     ];
  38844.                 },
  38845.                 function ($exception) {
  38846.                     $response $exception->getResponse();
  38847.                     $statusCode $response->getStatusCode();
  38848.                     throw new ApiException(
  38849.                         sprintf(
  38850.                             '[%d] Error connecting to the API (%s)',
  38851.                             $statusCode,
  38852.                             $exception->getRequest()->getUri()
  38853.                         ),
  38854.                         $statusCode,
  38855.                         $response->getHeaders(),
  38856.                         $response->getBody()
  38857.                     );
  38858.                 }
  38859.             );
  38860.     }
  38861.     /**
  38862.      * Create request for operation 'getPaymentServices'
  38863.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  38864.      * @throws \InvalidArgumentException
  38865.      * @return \GuzzleHttp\Psr7\Request  */
  38866.     protected function getPaymentServicesRequest($xero_tenant_id)
  38867.     {
  38868.         // verify the required parameter 'xero_tenant_id' is set
  38869.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  38870.             throw new \InvalidArgumentException(
  38871.                 'Missing the required parameter $xero_tenant_id when calling getPaymentServices'
  38872.             );
  38873.         }
  38874.         $resourcePath '/PaymentServices';
  38875.         $formParams = [];
  38876.         $queryParams = [];
  38877.         $headerParams = [];
  38878.         $httpBody '';
  38879.         $multipart false;
  38880.         // header params
  38881.         if ($xero_tenant_id !== null) {
  38882.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  38883.         }
  38884.         // body params
  38885.         $_tempBody null;
  38886.         if ($multipart) {
  38887.             $headers $this->headerSelector->selectHeadersForMultipart(
  38888.                 ['application/json']
  38889.             );
  38890.         } else {
  38891.             $headers $this->headerSelector->selectHeaders(
  38892.                 ['application/json'],
  38893.                 []
  38894.             );
  38895.         }
  38896.         // for model (json/xml)
  38897.         if (isset($_tempBody)) {
  38898.             // $_tempBody is the method argument, if present
  38899.             if ($headers['Content-Type'] === 'application/json') {
  38900.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  38901.             } else {
  38902.                 $httpBody $_tempBody;
  38903.             }
  38904.         } elseif (count($formParams) > 0) {
  38905.             if ($multipart) {
  38906.                 $multipartContents = [
  38907.                     [
  38908.                         'Content-type' => 'multipart/form-data',
  38909.                     ]
  38910.                 ];
  38911.                 
  38912.                 // for HTTP post (form)
  38913.                 $httpBody = new MultipartStream($multipartContents);
  38914.             } elseif ($headers['Content-Type'] === 'application/json') {
  38915.                 $httpBody \GuzzleHttp\json_encode($formParams);
  38916.             } else {
  38917.                 // for HTTP post (form)
  38918.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  38919.             }
  38920.         }
  38921.         // this endpoint requires OAuth (access token)
  38922.         if ($this->config->getAccessToken() !== null) {
  38923.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  38924.         }
  38925.         $defaultHeaders = [];
  38926.         if ($this->config->getUserAgent()) {
  38927.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  38928.         }
  38929.         $headers array_merge(
  38930.             $defaultHeaders,
  38931.             $headerParams,
  38932.             $headers
  38933.         );
  38934.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  38935.         return new Request(
  38936.             'GET',
  38937.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  38938.             $headers,
  38939.             $httpBody
  38940.         );
  38941.     }
  38942.     /**
  38943.      * Operation getPayments
  38944.      * Retrieves payments for invoices and credit notes
  38945.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  38946.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  38947.      * @param  string $where Filter by an any element (optional)
  38948.      * @param  string $order Order by an any element (optional)
  38949.      * @param  int $page Up to 100 payments will be returned in a single API call (optional)
  38950.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  38951.      * @throws \InvalidArgumentException
  38952.      * @return \XeroAPI\XeroPHP\Models\Accounting\Payments
  38953.      */
  38954.     public function getPayments($xero_tenant_id$if_modified_since null$where null$order null$page null)
  38955.     {
  38956.         list($response) = $this->getPaymentsWithHttpInfo($xero_tenant_id$if_modified_since$where$order$page);
  38957.         return $response;
  38958.     }
  38959.     /**
  38960.      * Operation getPaymentsWithHttpInfo
  38961.      * Retrieves payments for invoices and credit notes
  38962.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  38963.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  38964.      * @param  string $where Filter by an any element (optional)
  38965.      * @param  string $order Order by an any element (optional)
  38966.      * @param  int $page Up to 100 payments will be returned in a single API call (optional)
  38967.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  38968.      * @throws \InvalidArgumentException
  38969.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Payments, HTTP status code, HTTP response headers (array of strings)
  38970.      */
  38971.     public function getPaymentsWithHttpInfo($xero_tenant_id$if_modified_since null$where null$order null$page null)
  38972.     {
  38973.         $request $this->getPaymentsRequest($xero_tenant_id$if_modified_since$where$order$page);
  38974.         try {
  38975.             $options $this->createHttpClientOption();
  38976.             try {
  38977.                 $response $this->client->send($request$options);
  38978.             } catch (RequestException $e) {
  38979.                 throw new ApiException(
  38980.                     "[{$e->getCode()}{$e->getMessage()}",
  38981.                     $e->getCode(),
  38982.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  38983.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  38984.                 );
  38985.             }
  38986.             $statusCode $response->getStatusCode();
  38987.             if ($statusCode 200 || $statusCode 299) {
  38988.                 throw new ApiException(
  38989.                     sprintf(
  38990.                         '[%d] Error connecting to the API (%s)',
  38991.                         $statusCode,
  38992.                         $request->getUri()
  38993.                     ),
  38994.                     $statusCode,
  38995.                     $response->getHeaders(),
  38996.                     $response->getBody()
  38997.                 );
  38998.             }
  38999.             $responseBody $response->getBody();
  39000.             switch($statusCode) {
  39001.                 case 200:
  39002.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Payments' === '\SplFileObject') {
  39003.                         $content $responseBody//stream goes to serializer
  39004.                     } else {
  39005.                         $content $responseBody->getContents();
  39006.                     }
  39007.                     return [
  39008.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Payments', []),
  39009.                         $response->getStatusCode(),
  39010.                         $response->getHeaders()
  39011.                     ];
  39012.             }
  39013.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Payments';
  39014.             $responseBody $response->getBody();
  39015.             if ($returnType === '\SplFileObject') {
  39016.                 $content $responseBody//stream goes to serializer
  39017.             } else {
  39018.                 $content $responseBody->getContents();
  39019.             }
  39020.             return [
  39021.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  39022.                 $response->getStatusCode(),
  39023.                 $response->getHeaders()
  39024.             ];
  39025.         } catch (ApiException $e) {
  39026.             switch ($e->getCode()) {
  39027.                 case 200:
  39028.                     $data AccountingObjectSerializer::deserialize(
  39029.                         $e->getResponseBody(),
  39030.                         '\XeroAPI\XeroPHP\Models\Accounting\Payments',
  39031.                         $e->getResponseHeaders()
  39032.                     );
  39033.                     $e->setResponseObject($data);
  39034.                     break;
  39035.             }
  39036.             throw $e;
  39037.         }
  39038.     }
  39039.     /**
  39040.      * Operation getPaymentsAsync
  39041.      * Retrieves payments for invoices and credit notes
  39042.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  39043.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  39044.      * @param  string $where Filter by an any element (optional)
  39045.      * @param  string $order Order by an any element (optional)
  39046.      * @param  int $page Up to 100 payments will be returned in a single API call (optional)
  39047.      * @throws \InvalidArgumentException
  39048.      * @return \GuzzleHttp\Promise\PromiseInterface
  39049.      */
  39050.     public function getPaymentsAsync($xero_tenant_id$if_modified_since null$where null$order null$page null)
  39051.     {
  39052.         return $this->getPaymentsAsyncWithHttpInfo($xero_tenant_id$if_modified_since$where$order$page)
  39053.             ->then(
  39054.                 function ($response) {
  39055.                     return $response[0];
  39056.                 }
  39057.             );
  39058.     }
  39059.     /**
  39060.      * Operation getPaymentsAsyncWithHttpInfo
  39061.      * Retrieves payments for invoices and credit notes
  39062.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  39063.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  39064.      * @param  string $where Filter by an any element (optional)
  39065.      * @param  string $order Order by an any element (optional)
  39066.      * @param  int $page Up to 100 payments will be returned in a single API call (optional)
  39067.      * @throws \InvalidArgumentException
  39068.      * @return \GuzzleHttp\Promise\PromiseInterface */
  39069.     public function getPaymentsAsyncWithHttpInfo($xero_tenant_id$if_modified_since null$where null$order null$page null)
  39070.     {
  39071.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Payments';
  39072.         $request $this->getPaymentsRequest($xero_tenant_id$if_modified_since$where$order$page);
  39073.         return $this->client
  39074.             ->sendAsync($request$this->createHttpClientOption())
  39075.             ->then(
  39076.                 function ($response) use ($returnType) {
  39077.                     $responseBody $response->getBody();
  39078.                     if ($returnType === '\SplFileObject') {
  39079.                         $content $responseBody//stream goes to serializer
  39080.                     } else {
  39081.                         $content $responseBody->getContents();
  39082.                     }
  39083.                     return [
  39084.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  39085.                         $response->getStatusCode(),
  39086.                         $response->getHeaders()
  39087.                     ];
  39088.                 },
  39089.                 function ($exception) {
  39090.                     $response $exception->getResponse();
  39091.                     $statusCode $response->getStatusCode();
  39092.                     throw new ApiException(
  39093.                         sprintf(
  39094.                             '[%d] Error connecting to the API (%s)',
  39095.                             $statusCode,
  39096.                             $exception->getRequest()->getUri()
  39097.                         ),
  39098.                         $statusCode,
  39099.                         $response->getHeaders(),
  39100.                         $response->getBody()
  39101.                     );
  39102.                 }
  39103.             );
  39104.     }
  39105.     /**
  39106.      * Create request for operation 'getPayments'
  39107.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  39108.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  39109.      * @param  string $where Filter by an any element (optional)
  39110.      * @param  string $order Order by an any element (optional)
  39111.      * @param  int $page Up to 100 payments will be returned in a single API call (optional)
  39112.      * @throws \InvalidArgumentException
  39113.      * @return \GuzzleHttp\Psr7\Request  */
  39114.     protected function getPaymentsRequest($xero_tenant_id$if_modified_since null$where null$order null$page null)
  39115.     {
  39116.         // verify the required parameter 'xero_tenant_id' is set
  39117.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  39118.             throw new \InvalidArgumentException(
  39119.                 'Missing the required parameter $xero_tenant_id when calling getPayments'
  39120.             );
  39121.         }
  39122.         $resourcePath '/Payments';
  39123.         $formParams = [];
  39124.         $queryParams = [];
  39125.         $headerParams = [];
  39126.         $httpBody '';
  39127.         $multipart false;
  39128.         // query params
  39129.         if ($where !== null) {
  39130.             $queryParams['where'] = AccountingObjectSerializer::toQueryValue($where);
  39131.         }
  39132.         // query params
  39133.         if ($order !== null) {
  39134.             $queryParams['order'] = AccountingObjectSerializer::toQueryValue($order);
  39135.         }
  39136.         // query params
  39137.         if ($page !== null) {
  39138.             $queryParams['page'] = AccountingObjectSerializer::toQueryValue($page);
  39139.         }
  39140.         // header params
  39141.         if ($xero_tenant_id !== null) {
  39142.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  39143.         }
  39144.         // header params
  39145.         if ($if_modified_since !== null) {
  39146.             $headerParams['If-Modified-Since'] = AccountingObjectSerializer::toHeaderValue($if_modified_since);
  39147.         }
  39148.         // body params
  39149.         $_tempBody null;
  39150.         if ($multipart) {
  39151.             $headers $this->headerSelector->selectHeadersForMultipart(
  39152.                 ['application/json']
  39153.             );
  39154.         } else {
  39155.             $headers $this->headerSelector->selectHeaders(
  39156.                 ['application/json'],
  39157.                 []
  39158.             );
  39159.         }
  39160.         // for model (json/xml)
  39161.         if (isset($_tempBody)) {
  39162.             // $_tempBody is the method argument, if present
  39163.             if ($headers['Content-Type'] === 'application/json') {
  39164.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  39165.             } else {
  39166.                 $httpBody $_tempBody;
  39167.             }
  39168.         } elseif (count($formParams) > 0) {
  39169.             if ($multipart) {
  39170.                 $multipartContents = [
  39171.                     [
  39172.                         'Content-type' => 'multipart/form-data',
  39173.                     ]
  39174.                 ];
  39175.                 
  39176.                 // for HTTP post (form)
  39177.                 $httpBody = new MultipartStream($multipartContents);
  39178.             } elseif ($headers['Content-Type'] === 'application/json') {
  39179.                 $httpBody \GuzzleHttp\json_encode($formParams);
  39180.             } else {
  39181.                 // for HTTP post (form)
  39182.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  39183.             }
  39184.         }
  39185.         // this endpoint requires OAuth (access token)
  39186.         if ($this->config->getAccessToken() !== null) {
  39187.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  39188.         }
  39189.         $defaultHeaders = [];
  39190.         if ($this->config->getUserAgent()) {
  39191.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  39192.         }
  39193.         $headers array_merge(
  39194.             $defaultHeaders,
  39195.             $headerParams,
  39196.             $headers
  39197.         );
  39198.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  39199.         return new Request(
  39200.             'GET',
  39201.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  39202.             $headers,
  39203.             $httpBody
  39204.         );
  39205.     }
  39206.     /**
  39207.      * Operation getPrepayment
  39208.      * Allows you to retrieve a specified prepayments
  39209.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  39210.      * @param  string $prepayment_id Unique identifier for a PrePayment (required)
  39211.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  39212.      * @throws \InvalidArgumentException
  39213.      * @return \XeroAPI\XeroPHP\Models\Accounting\Prepayments
  39214.      */
  39215.     public function getPrepayment($xero_tenant_id$prepayment_id)
  39216.     {
  39217.         list($response) = $this->getPrepaymentWithHttpInfo($xero_tenant_id$prepayment_id);
  39218.         return $response;
  39219.     }
  39220.     /**
  39221.      * Operation getPrepaymentWithHttpInfo
  39222.      * Allows you to retrieve a specified prepayments
  39223.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  39224.      * @param  string $prepayment_id Unique identifier for a PrePayment (required)
  39225.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  39226.      * @throws \InvalidArgumentException
  39227.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Prepayments, HTTP status code, HTTP response headers (array of strings)
  39228.      */
  39229.     public function getPrepaymentWithHttpInfo($xero_tenant_id$prepayment_id)
  39230.     {
  39231.         $request $this->getPrepaymentRequest($xero_tenant_id$prepayment_id);
  39232.         try {
  39233.             $options $this->createHttpClientOption();
  39234.             try {
  39235.                 $response $this->client->send($request$options);
  39236.             } catch (RequestException $e) {
  39237.                 throw new ApiException(
  39238.                     "[{$e->getCode()}{$e->getMessage()}",
  39239.                     $e->getCode(),
  39240.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  39241.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  39242.                 );
  39243.             }
  39244.             $statusCode $response->getStatusCode();
  39245.             if ($statusCode 200 || $statusCode 299) {
  39246.                 throw new ApiException(
  39247.                     sprintf(
  39248.                         '[%d] Error connecting to the API (%s)',
  39249.                         $statusCode,
  39250.                         $request->getUri()
  39251.                     ),
  39252.                     $statusCode,
  39253.                     $response->getHeaders(),
  39254.                     $response->getBody()
  39255.                 );
  39256.             }
  39257.             $responseBody $response->getBody();
  39258.             switch($statusCode) {
  39259.                 case 200:
  39260.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Prepayments' === '\SplFileObject') {
  39261.                         $content $responseBody//stream goes to serializer
  39262.                     } else {
  39263.                         $content $responseBody->getContents();
  39264.                     }
  39265.                     return [
  39266.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Prepayments', []),
  39267.                         $response->getStatusCode(),
  39268.                         $response->getHeaders()
  39269.                     ];
  39270.             }
  39271.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Prepayments';
  39272.             $responseBody $response->getBody();
  39273.             if ($returnType === '\SplFileObject') {
  39274.                 $content $responseBody//stream goes to serializer
  39275.             } else {
  39276.                 $content $responseBody->getContents();
  39277.             }
  39278.             return [
  39279.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  39280.                 $response->getStatusCode(),
  39281.                 $response->getHeaders()
  39282.             ];
  39283.         } catch (ApiException $e) {
  39284.             switch ($e->getCode()) {
  39285.                 case 200:
  39286.                     $data AccountingObjectSerializer::deserialize(
  39287.                         $e->getResponseBody(),
  39288.                         '\XeroAPI\XeroPHP\Models\Accounting\Prepayments',
  39289.                         $e->getResponseHeaders()
  39290.                     );
  39291.                     $e->setResponseObject($data);
  39292.                     break;
  39293.             }
  39294.             throw $e;
  39295.         }
  39296.     }
  39297.     /**
  39298.      * Operation getPrepaymentAsync
  39299.      * Allows you to retrieve a specified prepayments
  39300.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  39301.      * @param  string $prepayment_id Unique identifier for a PrePayment (required)
  39302.      * @throws \InvalidArgumentException
  39303.      * @return \GuzzleHttp\Promise\PromiseInterface
  39304.      */
  39305.     public function getPrepaymentAsync($xero_tenant_id$prepayment_id)
  39306.     {
  39307.         return $this->getPrepaymentAsyncWithHttpInfo($xero_tenant_id$prepayment_id)
  39308.             ->then(
  39309.                 function ($response) {
  39310.                     return $response[0];
  39311.                 }
  39312.             );
  39313.     }
  39314.     /**
  39315.      * Operation getPrepaymentAsyncWithHttpInfo
  39316.      * Allows you to retrieve a specified prepayments
  39317.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  39318.      * @param  string $prepayment_id Unique identifier for a PrePayment (required)
  39319.      * @throws \InvalidArgumentException
  39320.      * @return \GuzzleHttp\Promise\PromiseInterface */
  39321.     public function getPrepaymentAsyncWithHttpInfo($xero_tenant_id$prepayment_id)
  39322.     {
  39323.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Prepayments';
  39324.         $request $this->getPrepaymentRequest($xero_tenant_id$prepayment_id);
  39325.         return $this->client
  39326.             ->sendAsync($request$this->createHttpClientOption())
  39327.             ->then(
  39328.                 function ($response) use ($returnType) {
  39329.                     $responseBody $response->getBody();
  39330.                     if ($returnType === '\SplFileObject') {
  39331.                         $content $responseBody//stream goes to serializer
  39332.                     } else {
  39333.                         $content $responseBody->getContents();
  39334.                     }
  39335.                     return [
  39336.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  39337.                         $response->getStatusCode(),
  39338.                         $response->getHeaders()
  39339.                     ];
  39340.                 },
  39341.                 function ($exception) {
  39342.                     $response $exception->getResponse();
  39343.                     $statusCode $response->getStatusCode();
  39344.                     throw new ApiException(
  39345.                         sprintf(
  39346.                             '[%d] Error connecting to the API (%s)',
  39347.                             $statusCode,
  39348.                             $exception->getRequest()->getUri()
  39349.                         ),
  39350.                         $statusCode,
  39351.                         $response->getHeaders(),
  39352.                         $response->getBody()
  39353.                     );
  39354.                 }
  39355.             );
  39356.     }
  39357.     /**
  39358.      * Create request for operation 'getPrepayment'
  39359.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  39360.      * @param  string $prepayment_id Unique identifier for a PrePayment (required)
  39361.      * @throws \InvalidArgumentException
  39362.      * @return \GuzzleHttp\Psr7\Request  */
  39363.     protected function getPrepaymentRequest($xero_tenant_id$prepayment_id)
  39364.     {
  39365.         // verify the required parameter 'xero_tenant_id' is set
  39366.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  39367.             throw new \InvalidArgumentException(
  39368.                 'Missing the required parameter $xero_tenant_id when calling getPrepayment'
  39369.             );
  39370.         }
  39371.         // verify the required parameter 'prepayment_id' is set
  39372.         if ($prepayment_id === null || (is_array($prepayment_id) && count($prepayment_id) === 0)) {
  39373.             throw new \InvalidArgumentException(
  39374.                 'Missing the required parameter $prepayment_id when calling getPrepayment'
  39375.             );
  39376.         }
  39377.         $resourcePath '/Prepayments/{PrepaymentID}';
  39378.         $formParams = [];
  39379.         $queryParams = [];
  39380.         $headerParams = [];
  39381.         $httpBody '';
  39382.         $multipart false;
  39383.         // header params
  39384.         if ($xero_tenant_id !== null) {
  39385.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  39386.         }
  39387.         // path params
  39388.         if ($prepayment_id !== null) {
  39389.             $resourcePath str_replace(
  39390.                 '{' 'PrepaymentID' '}',
  39391.                 AccountingObjectSerializer::toPathValue($prepayment_id),
  39392.                 $resourcePath
  39393.             );
  39394.         }
  39395.         // body params
  39396.         $_tempBody null;
  39397.         if ($multipart) {
  39398.             $headers $this->headerSelector->selectHeadersForMultipart(
  39399.                 ['application/json']
  39400.             );
  39401.         } else {
  39402.             $headers $this->headerSelector->selectHeaders(
  39403.                 ['application/json'],
  39404.                 []
  39405.             );
  39406.         }
  39407.         // for model (json/xml)
  39408.         if (isset($_tempBody)) {
  39409.             // $_tempBody is the method argument, if present
  39410.             if ($headers['Content-Type'] === 'application/json') {
  39411.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  39412.             } else {
  39413.                 $httpBody $_tempBody;
  39414.             }
  39415.         } elseif (count($formParams) > 0) {
  39416.             if ($multipart) {
  39417.                 $multipartContents = [
  39418.                     [
  39419.                         'Content-type' => 'multipart/form-data',
  39420.                     ]
  39421.                 ];
  39422.                 
  39423.                 // for HTTP post (form)
  39424.                 $httpBody = new MultipartStream($multipartContents);
  39425.             } elseif ($headers['Content-Type'] === 'application/json') {
  39426.                 $httpBody \GuzzleHttp\json_encode($formParams);
  39427.             } else {
  39428.                 // for HTTP post (form)
  39429.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  39430.             }
  39431.         }
  39432.         // this endpoint requires OAuth (access token)
  39433.         if ($this->config->getAccessToken() !== null) {
  39434.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  39435.         }
  39436.         $defaultHeaders = [];
  39437.         if ($this->config->getUserAgent()) {
  39438.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  39439.         }
  39440.         $headers array_merge(
  39441.             $defaultHeaders,
  39442.             $headerParams,
  39443.             $headers
  39444.         );
  39445.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  39446.         return new Request(
  39447.             'GET',
  39448.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  39449.             $headers,
  39450.             $httpBody
  39451.         );
  39452.     }
  39453.     /**
  39454.      * Operation getPrepaymentHistory
  39455.      * Retrieves history record for a specific prepayment
  39456.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  39457.      * @param  string $prepayment_id Unique identifier for a PrePayment (required)
  39458.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  39459.      * @throws \InvalidArgumentException
  39460.      * @return \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords
  39461.      */
  39462.     public function getPrepaymentHistory($xero_tenant_id$prepayment_id)
  39463.     {
  39464.         list($response) = $this->getPrepaymentHistoryWithHttpInfo($xero_tenant_id$prepayment_id);
  39465.         return $response;
  39466.     }
  39467.     /**
  39468.      * Operation getPrepaymentHistoryWithHttpInfo
  39469.      * Retrieves history record for a specific prepayment
  39470.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  39471.      * @param  string $prepayment_id Unique identifier for a PrePayment (required)
  39472.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  39473.      * @throws \InvalidArgumentException
  39474.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords, HTTP status code, HTTP response headers (array of strings)
  39475.      */
  39476.     public function getPrepaymentHistoryWithHttpInfo($xero_tenant_id$prepayment_id)
  39477.     {
  39478.         $request $this->getPrepaymentHistoryRequest($xero_tenant_id$prepayment_id);
  39479.         try {
  39480.             $options $this->createHttpClientOption();
  39481.             try {
  39482.                 $response $this->client->send($request$options);
  39483.             } catch (RequestException $e) {
  39484.                 throw new ApiException(
  39485.                     "[{$e->getCode()}{$e->getMessage()}",
  39486.                     $e->getCode(),
  39487.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  39488.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  39489.                 );
  39490.             }
  39491.             $statusCode $response->getStatusCode();
  39492.             if ($statusCode 200 || $statusCode 299) {
  39493.                 throw new ApiException(
  39494.                     sprintf(
  39495.                         '[%d] Error connecting to the API (%s)',
  39496.                         $statusCode,
  39497.                         $request->getUri()
  39498.                     ),
  39499.                     $statusCode,
  39500.                     $response->getHeaders(),
  39501.                     $response->getBody()
  39502.                 );
  39503.             }
  39504.             $responseBody $response->getBody();
  39505.             switch($statusCode) {
  39506.                 case 200:
  39507.                     if ('\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords' === '\SplFileObject') {
  39508.                         $content $responseBody//stream goes to serializer
  39509.                     } else {
  39510.                         $content $responseBody->getContents();
  39511.                     }
  39512.                     return [
  39513.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords', []),
  39514.                         $response->getStatusCode(),
  39515.                         $response->getHeaders()
  39516.                     ];
  39517.             }
  39518.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  39519.             $responseBody $response->getBody();
  39520.             if ($returnType === '\SplFileObject') {
  39521.                 $content $responseBody//stream goes to serializer
  39522.             } else {
  39523.                 $content $responseBody->getContents();
  39524.             }
  39525.             return [
  39526.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  39527.                 $response->getStatusCode(),
  39528.                 $response->getHeaders()
  39529.             ];
  39530.         } catch (ApiException $e) {
  39531.             switch ($e->getCode()) {
  39532.                 case 200:
  39533.                     $data AccountingObjectSerializer::deserialize(
  39534.                         $e->getResponseBody(),
  39535.                         '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords',
  39536.                         $e->getResponseHeaders()
  39537.                     );
  39538.                     $e->setResponseObject($data);
  39539.                     break;
  39540.             }
  39541.             throw $e;
  39542.         }
  39543.     }
  39544.     /**
  39545.      * Operation getPrepaymentHistoryAsync
  39546.      * Retrieves history record for a specific prepayment
  39547.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  39548.      * @param  string $prepayment_id Unique identifier for a PrePayment (required)
  39549.      * @throws \InvalidArgumentException
  39550.      * @return \GuzzleHttp\Promise\PromiseInterface
  39551.      */
  39552.     public function getPrepaymentHistoryAsync($xero_tenant_id$prepayment_id)
  39553.     {
  39554.         return $this->getPrepaymentHistoryAsyncWithHttpInfo($xero_tenant_id$prepayment_id)
  39555.             ->then(
  39556.                 function ($response) {
  39557.                     return $response[0];
  39558.                 }
  39559.             );
  39560.     }
  39561.     /**
  39562.      * Operation getPrepaymentHistoryAsyncWithHttpInfo
  39563.      * Retrieves history record for a specific prepayment
  39564.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  39565.      * @param  string $prepayment_id Unique identifier for a PrePayment (required)
  39566.      * @throws \InvalidArgumentException
  39567.      * @return \GuzzleHttp\Promise\PromiseInterface */
  39568.     public function getPrepaymentHistoryAsyncWithHttpInfo($xero_tenant_id$prepayment_id)
  39569.     {
  39570.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  39571.         $request $this->getPrepaymentHistoryRequest($xero_tenant_id$prepayment_id);
  39572.         return $this->client
  39573.             ->sendAsync($request$this->createHttpClientOption())
  39574.             ->then(
  39575.                 function ($response) use ($returnType) {
  39576.                     $responseBody $response->getBody();
  39577.                     if ($returnType === '\SplFileObject') {
  39578.                         $content $responseBody//stream goes to serializer
  39579.                     } else {
  39580.                         $content $responseBody->getContents();
  39581.                     }
  39582.                     return [
  39583.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  39584.                         $response->getStatusCode(),
  39585.                         $response->getHeaders()
  39586.                     ];
  39587.                 },
  39588.                 function ($exception) {
  39589.                     $response $exception->getResponse();
  39590.                     $statusCode $response->getStatusCode();
  39591.                     throw new ApiException(
  39592.                         sprintf(
  39593.                             '[%d] Error connecting to the API (%s)',
  39594.                             $statusCode,
  39595.                             $exception->getRequest()->getUri()
  39596.                         ),
  39597.                         $statusCode,
  39598.                         $response->getHeaders(),
  39599.                         $response->getBody()
  39600.                     );
  39601.                 }
  39602.             );
  39603.     }
  39604.     /**
  39605.      * Create request for operation 'getPrepaymentHistory'
  39606.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  39607.      * @param  string $prepayment_id Unique identifier for a PrePayment (required)
  39608.      * @throws \InvalidArgumentException
  39609.      * @return \GuzzleHttp\Psr7\Request  */
  39610.     protected function getPrepaymentHistoryRequest($xero_tenant_id$prepayment_id)
  39611.     {
  39612.         // verify the required parameter 'xero_tenant_id' is set
  39613.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  39614.             throw new \InvalidArgumentException(
  39615.                 'Missing the required parameter $xero_tenant_id when calling getPrepaymentHistory'
  39616.             );
  39617.         }
  39618.         // verify the required parameter 'prepayment_id' is set
  39619.         if ($prepayment_id === null || (is_array($prepayment_id) && count($prepayment_id) === 0)) {
  39620.             throw new \InvalidArgumentException(
  39621.                 'Missing the required parameter $prepayment_id when calling getPrepaymentHistory'
  39622.             );
  39623.         }
  39624.         $resourcePath '/Prepayments/{PrepaymentID}/History';
  39625.         $formParams = [];
  39626.         $queryParams = [];
  39627.         $headerParams = [];
  39628.         $httpBody '';
  39629.         $multipart false;
  39630.         // header params
  39631.         if ($xero_tenant_id !== null) {
  39632.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  39633.         }
  39634.         // path params
  39635.         if ($prepayment_id !== null) {
  39636.             $resourcePath str_replace(
  39637.                 '{' 'PrepaymentID' '}',
  39638.                 AccountingObjectSerializer::toPathValue($prepayment_id),
  39639.                 $resourcePath
  39640.             );
  39641.         }
  39642.         // body params
  39643.         $_tempBody null;
  39644.         if ($multipart) {
  39645.             $headers $this->headerSelector->selectHeadersForMultipart(
  39646.                 ['application/json']
  39647.             );
  39648.         } else {
  39649.             $headers $this->headerSelector->selectHeaders(
  39650.                 ['application/json'],
  39651.                 []
  39652.             );
  39653.         }
  39654.         // for model (json/xml)
  39655.         if (isset($_tempBody)) {
  39656.             // $_tempBody is the method argument, if present
  39657.             if ($headers['Content-Type'] === 'application/json') {
  39658.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  39659.             } else {
  39660.                 $httpBody $_tempBody;
  39661.             }
  39662.         } elseif (count($formParams) > 0) {
  39663.             if ($multipart) {
  39664.                 $multipartContents = [
  39665.                     [
  39666.                         'Content-type' => 'multipart/form-data',
  39667.                     ]
  39668.                 ];
  39669.                 
  39670.                 // for HTTP post (form)
  39671.                 $httpBody = new MultipartStream($multipartContents);
  39672.             } elseif ($headers['Content-Type'] === 'application/json') {
  39673.                 $httpBody \GuzzleHttp\json_encode($formParams);
  39674.             } else {
  39675.                 // for HTTP post (form)
  39676.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  39677.             }
  39678.         }
  39679.         // this endpoint requires OAuth (access token)
  39680.         if ($this->config->getAccessToken() !== null) {
  39681.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  39682.         }
  39683.         $defaultHeaders = [];
  39684.         if ($this->config->getUserAgent()) {
  39685.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  39686.         }
  39687.         $headers array_merge(
  39688.             $defaultHeaders,
  39689.             $headerParams,
  39690.             $headers
  39691.         );
  39692.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  39693.         return new Request(
  39694.             'GET',
  39695.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  39696.             $headers,
  39697.             $httpBody
  39698.         );
  39699.     }
  39700.     /**
  39701.      * Operation getPrepayments
  39702.      * Retrieves prepayments
  39703.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  39704.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  39705.      * @param  string $where Filter by an any element (optional)
  39706.      * @param  string $order Order by an any element (optional)
  39707.      * @param  int $page e.g. page&#x3D;1 â€“ Up to 100 prepayments will be returned in a single API call with line items shown for each overpayment (optional)
  39708.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  39709.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  39710.      * @throws \InvalidArgumentException
  39711.      * @return \XeroAPI\XeroPHP\Models\Accounting\Prepayments
  39712.      */
  39713.     public function getPrepayments($xero_tenant_id$if_modified_since null$where null$order null$page null$unitdp null)
  39714.     {
  39715.         list($response) = $this->getPrepaymentsWithHttpInfo($xero_tenant_id$if_modified_since$where$order$page$unitdp);
  39716.         return $response;
  39717.     }
  39718.     /**
  39719.      * Operation getPrepaymentsWithHttpInfo
  39720.      * Retrieves prepayments
  39721.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  39722.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  39723.      * @param  string $where Filter by an any element (optional)
  39724.      * @param  string $order Order by an any element (optional)
  39725.      * @param  int $page e.g. page&#x3D;1 â€“ Up to 100 prepayments will be returned in a single API call with line items shown for each overpayment (optional)
  39726.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  39727.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  39728.      * @throws \InvalidArgumentException
  39729.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Prepayments, HTTP status code, HTTP response headers (array of strings)
  39730.      */
  39731.     public function getPrepaymentsWithHttpInfo($xero_tenant_id$if_modified_since null$where null$order null$page null$unitdp null)
  39732.     {
  39733.         $request $this->getPrepaymentsRequest($xero_tenant_id$if_modified_since$where$order$page$unitdp);
  39734.         try {
  39735.             $options $this->createHttpClientOption();
  39736.             try {
  39737.                 $response $this->client->send($request$options);
  39738.             } catch (RequestException $e) {
  39739.                 throw new ApiException(
  39740.                     "[{$e->getCode()}{$e->getMessage()}",
  39741.                     $e->getCode(),
  39742.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  39743.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  39744.                 );
  39745.             }
  39746.             $statusCode $response->getStatusCode();
  39747.             if ($statusCode 200 || $statusCode 299) {
  39748.                 throw new ApiException(
  39749.                     sprintf(
  39750.                         '[%d] Error connecting to the API (%s)',
  39751.                         $statusCode,
  39752.                         $request->getUri()
  39753.                     ),
  39754.                     $statusCode,
  39755.                     $response->getHeaders(),
  39756.                     $response->getBody()
  39757.                 );
  39758.             }
  39759.             $responseBody $response->getBody();
  39760.             switch($statusCode) {
  39761.                 case 200:
  39762.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Prepayments' === '\SplFileObject') {
  39763.                         $content $responseBody//stream goes to serializer
  39764.                     } else {
  39765.                         $content $responseBody->getContents();
  39766.                     }
  39767.                     return [
  39768.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Prepayments', []),
  39769.                         $response->getStatusCode(),
  39770.                         $response->getHeaders()
  39771.                     ];
  39772.             }
  39773.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Prepayments';
  39774.             $responseBody $response->getBody();
  39775.             if ($returnType === '\SplFileObject') {
  39776.                 $content $responseBody//stream goes to serializer
  39777.             } else {
  39778.                 $content $responseBody->getContents();
  39779.             }
  39780.             return [
  39781.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  39782.                 $response->getStatusCode(),
  39783.                 $response->getHeaders()
  39784.             ];
  39785.         } catch (ApiException $e) {
  39786.             switch ($e->getCode()) {
  39787.                 case 200:
  39788.                     $data AccountingObjectSerializer::deserialize(
  39789.                         $e->getResponseBody(),
  39790.                         '\XeroAPI\XeroPHP\Models\Accounting\Prepayments',
  39791.                         $e->getResponseHeaders()
  39792.                     );
  39793.                     $e->setResponseObject($data);
  39794.                     break;
  39795.             }
  39796.             throw $e;
  39797.         }
  39798.     }
  39799.     /**
  39800.      * Operation getPrepaymentsAsync
  39801.      * Retrieves prepayments
  39802.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  39803.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  39804.      * @param  string $where Filter by an any element (optional)
  39805.      * @param  string $order Order by an any element (optional)
  39806.      * @param  int $page e.g. page&#x3D;1 â€“ Up to 100 prepayments will be returned in a single API call with line items shown for each overpayment (optional)
  39807.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  39808.      * @throws \InvalidArgumentException
  39809.      * @return \GuzzleHttp\Promise\PromiseInterface
  39810.      */
  39811.     public function getPrepaymentsAsync($xero_tenant_id$if_modified_since null$where null$order null$page null$unitdp null)
  39812.     {
  39813.         return $this->getPrepaymentsAsyncWithHttpInfo($xero_tenant_id$if_modified_since$where$order$page$unitdp)
  39814.             ->then(
  39815.                 function ($response) {
  39816.                     return $response[0];
  39817.                 }
  39818.             );
  39819.     }
  39820.     /**
  39821.      * Operation getPrepaymentsAsyncWithHttpInfo
  39822.      * Retrieves prepayments
  39823.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  39824.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  39825.      * @param  string $where Filter by an any element (optional)
  39826.      * @param  string $order Order by an any element (optional)
  39827.      * @param  int $page e.g. page&#x3D;1 â€“ Up to 100 prepayments will be returned in a single API call with line items shown for each overpayment (optional)
  39828.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  39829.      * @throws \InvalidArgumentException
  39830.      * @return \GuzzleHttp\Promise\PromiseInterface */
  39831.     public function getPrepaymentsAsyncWithHttpInfo($xero_tenant_id$if_modified_since null$where null$order null$page null$unitdp null)
  39832.     {
  39833.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Prepayments';
  39834.         $request $this->getPrepaymentsRequest($xero_tenant_id$if_modified_since$where$order$page$unitdp);
  39835.         return $this->client
  39836.             ->sendAsync($request$this->createHttpClientOption())
  39837.             ->then(
  39838.                 function ($response) use ($returnType) {
  39839.                     $responseBody $response->getBody();
  39840.                     if ($returnType === '\SplFileObject') {
  39841.                         $content $responseBody//stream goes to serializer
  39842.                     } else {
  39843.                         $content $responseBody->getContents();
  39844.                     }
  39845.                     return [
  39846.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  39847.                         $response->getStatusCode(),
  39848.                         $response->getHeaders()
  39849.                     ];
  39850.                 },
  39851.                 function ($exception) {
  39852.                     $response $exception->getResponse();
  39853.                     $statusCode $response->getStatusCode();
  39854.                     throw new ApiException(
  39855.                         sprintf(
  39856.                             '[%d] Error connecting to the API (%s)',
  39857.                             $statusCode,
  39858.                             $exception->getRequest()->getUri()
  39859.                         ),
  39860.                         $statusCode,
  39861.                         $response->getHeaders(),
  39862.                         $response->getBody()
  39863.                     );
  39864.                 }
  39865.             );
  39866.     }
  39867.     /**
  39868.      * Create request for operation 'getPrepayments'
  39869.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  39870.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  39871.      * @param  string $where Filter by an any element (optional)
  39872.      * @param  string $order Order by an any element (optional)
  39873.      * @param  int $page e.g. page&#x3D;1 â€“ Up to 100 prepayments will be returned in a single API call with line items shown for each overpayment (optional)
  39874.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  39875.      * @throws \InvalidArgumentException
  39876.      * @return \GuzzleHttp\Psr7\Request  */
  39877.     protected function getPrepaymentsRequest($xero_tenant_id$if_modified_since null$where null$order null$page null$unitdp null)
  39878.     {
  39879.         // verify the required parameter 'xero_tenant_id' is set
  39880.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  39881.             throw new \InvalidArgumentException(
  39882.                 'Missing the required parameter $xero_tenant_id when calling getPrepayments'
  39883.             );
  39884.         }
  39885.         $resourcePath '/Prepayments';
  39886.         $formParams = [];
  39887.         $queryParams = [];
  39888.         $headerParams = [];
  39889.         $httpBody '';
  39890.         $multipart false;
  39891.         // query params
  39892.         if ($where !== null) {
  39893.             $queryParams['where'] = AccountingObjectSerializer::toQueryValue($where);
  39894.         }
  39895.         // query params
  39896.         if ($order !== null) {
  39897.             $queryParams['order'] = AccountingObjectSerializer::toQueryValue($order);
  39898.         }
  39899.         // query params
  39900.         if ($page !== null) {
  39901.             $queryParams['page'] = AccountingObjectSerializer::toQueryValue($page);
  39902.         }
  39903.         // query params
  39904.         if ($unitdp !== null) {
  39905.             $queryParams['unitdp'] = AccountingObjectSerializer::toQueryValue($unitdp);
  39906.         }
  39907.         // header params
  39908.         if ($xero_tenant_id !== null) {
  39909.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  39910.         }
  39911.         // header params
  39912.         if ($if_modified_since !== null) {
  39913.             $headerParams['If-Modified-Since'] = AccountingObjectSerializer::toHeaderValue($if_modified_since);
  39914.         }
  39915.         // body params
  39916.         $_tempBody null;
  39917.         if ($multipart) {
  39918.             $headers $this->headerSelector->selectHeadersForMultipart(
  39919.                 ['application/json']
  39920.             );
  39921.         } else {
  39922.             $headers $this->headerSelector->selectHeaders(
  39923.                 ['application/json'],
  39924.                 []
  39925.             );
  39926.         }
  39927.         // for model (json/xml)
  39928.         if (isset($_tempBody)) {
  39929.             // $_tempBody is the method argument, if present
  39930.             if ($headers['Content-Type'] === 'application/json') {
  39931.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  39932.             } else {
  39933.                 $httpBody $_tempBody;
  39934.             }
  39935.         } elseif (count($formParams) > 0) {
  39936.             if ($multipart) {
  39937.                 $multipartContents = [
  39938.                     [
  39939.                         'Content-type' => 'multipart/form-data',
  39940.                     ]
  39941.                 ];
  39942.                 
  39943.                 // for HTTP post (form)
  39944.                 $httpBody = new MultipartStream($multipartContents);
  39945.             } elseif ($headers['Content-Type'] === 'application/json') {
  39946.                 $httpBody \GuzzleHttp\json_encode($formParams);
  39947.             } else {
  39948.                 // for HTTP post (form)
  39949.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  39950.             }
  39951.         }
  39952.         // this endpoint requires OAuth (access token)
  39953.         if ($this->config->getAccessToken() !== null) {
  39954.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  39955.         }
  39956.         $defaultHeaders = [];
  39957.         if ($this->config->getUserAgent()) {
  39958.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  39959.         }
  39960.         $headers array_merge(
  39961.             $defaultHeaders,
  39962.             $headerParams,
  39963.             $headers
  39964.         );
  39965.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  39966.         return new Request(
  39967.             'GET',
  39968.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  39969.             $headers,
  39970.             $httpBody
  39971.         );
  39972.     }
  39973.     /**
  39974.      * Operation getPurchaseOrder
  39975.      * Retrieves a specific purchase order using a unique purchase order Id
  39976.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  39977.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  39978.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  39979.      * @throws \InvalidArgumentException
  39980.      * @return \XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders
  39981.      */
  39982.     public function getPurchaseOrder($xero_tenant_id$purchase_order_id)
  39983.     {
  39984.         list($response) = $this->getPurchaseOrderWithHttpInfo($xero_tenant_id$purchase_order_id);
  39985.         return $response;
  39986.     }
  39987.     /**
  39988.      * Operation getPurchaseOrderWithHttpInfo
  39989.      * Retrieves a specific purchase order using a unique purchase order Id
  39990.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  39991.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  39992.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  39993.      * @throws \InvalidArgumentException
  39994.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders, HTTP status code, HTTP response headers (array of strings)
  39995.      */
  39996.     public function getPurchaseOrderWithHttpInfo($xero_tenant_id$purchase_order_id)
  39997.     {
  39998.         $request $this->getPurchaseOrderRequest($xero_tenant_id$purchase_order_id);
  39999.         try {
  40000.             $options $this->createHttpClientOption();
  40001.             try {
  40002.                 $response $this->client->send($request$options);
  40003.             } catch (RequestException $e) {
  40004.                 throw new ApiException(
  40005.                     "[{$e->getCode()}{$e->getMessage()}",
  40006.                     $e->getCode(),
  40007.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  40008.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  40009.                 );
  40010.             }
  40011.             $statusCode $response->getStatusCode();
  40012.             if ($statusCode 200 || $statusCode 299) {
  40013.                 throw new ApiException(
  40014.                     sprintf(
  40015.                         '[%d] Error connecting to the API (%s)',
  40016.                         $statusCode,
  40017.                         $request->getUri()
  40018.                     ),
  40019.                     $statusCode,
  40020.                     $response->getHeaders(),
  40021.                     $response->getBody()
  40022.                 );
  40023.             }
  40024.             $responseBody $response->getBody();
  40025.             switch($statusCode) {
  40026.                 case 200:
  40027.                     if ('\XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders' === '\SplFileObject') {
  40028.                         $content $responseBody//stream goes to serializer
  40029.                     } else {
  40030.                         $content $responseBody->getContents();
  40031.                     }
  40032.                     return [
  40033.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders', []),
  40034.                         $response->getStatusCode(),
  40035.                         $response->getHeaders()
  40036.                     ];
  40037.             }
  40038.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders';
  40039.             $responseBody $response->getBody();
  40040.             if ($returnType === '\SplFileObject') {
  40041.                 $content $responseBody//stream goes to serializer
  40042.             } else {
  40043.                 $content $responseBody->getContents();
  40044.             }
  40045.             return [
  40046.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  40047.                 $response->getStatusCode(),
  40048.                 $response->getHeaders()
  40049.             ];
  40050.         } catch (ApiException $e) {
  40051.             switch ($e->getCode()) {
  40052.                 case 200:
  40053.                     $data AccountingObjectSerializer::deserialize(
  40054.                         $e->getResponseBody(),
  40055.                         '\XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders',
  40056.                         $e->getResponseHeaders()
  40057.                     );
  40058.                     $e->setResponseObject($data);
  40059.                     break;
  40060.             }
  40061.             throw $e;
  40062.         }
  40063.     }
  40064.     /**
  40065.      * Operation getPurchaseOrderAsync
  40066.      * Retrieves a specific purchase order using a unique purchase order Id
  40067.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  40068.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  40069.      * @throws \InvalidArgumentException
  40070.      * @return \GuzzleHttp\Promise\PromiseInterface
  40071.      */
  40072.     public function getPurchaseOrderAsync($xero_tenant_id$purchase_order_id)
  40073.     {
  40074.         return $this->getPurchaseOrderAsyncWithHttpInfo($xero_tenant_id$purchase_order_id)
  40075.             ->then(
  40076.                 function ($response) {
  40077.                     return $response[0];
  40078.                 }
  40079.             );
  40080.     }
  40081.     /**
  40082.      * Operation getPurchaseOrderAsyncWithHttpInfo
  40083.      * Retrieves a specific purchase order using a unique purchase order Id
  40084.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  40085.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  40086.      * @throws \InvalidArgumentException
  40087.      * @return \GuzzleHttp\Promise\PromiseInterface */
  40088.     public function getPurchaseOrderAsyncWithHttpInfo($xero_tenant_id$purchase_order_id)
  40089.     {
  40090.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders';
  40091.         $request $this->getPurchaseOrderRequest($xero_tenant_id$purchase_order_id);
  40092.         return $this->client
  40093.             ->sendAsync($request$this->createHttpClientOption())
  40094.             ->then(
  40095.                 function ($response) use ($returnType) {
  40096.                     $responseBody $response->getBody();
  40097.                     if ($returnType === '\SplFileObject') {
  40098.                         $content $responseBody//stream goes to serializer
  40099.                     } else {
  40100.                         $content $responseBody->getContents();
  40101.                     }
  40102.                     return [
  40103.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  40104.                         $response->getStatusCode(),
  40105.                         $response->getHeaders()
  40106.                     ];
  40107.                 },
  40108.                 function ($exception) {
  40109.                     $response $exception->getResponse();
  40110.                     $statusCode $response->getStatusCode();
  40111.                     throw new ApiException(
  40112.                         sprintf(
  40113.                             '[%d] Error connecting to the API (%s)',
  40114.                             $statusCode,
  40115.                             $exception->getRequest()->getUri()
  40116.                         ),
  40117.                         $statusCode,
  40118.                         $response->getHeaders(),
  40119.                         $response->getBody()
  40120.                     );
  40121.                 }
  40122.             );
  40123.     }
  40124.     /**
  40125.      * Create request for operation 'getPurchaseOrder'
  40126.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  40127.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  40128.      * @throws \InvalidArgumentException
  40129.      * @return \GuzzleHttp\Psr7\Request  */
  40130.     protected function getPurchaseOrderRequest($xero_tenant_id$purchase_order_id)
  40131.     {
  40132.         // verify the required parameter 'xero_tenant_id' is set
  40133.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  40134.             throw new \InvalidArgumentException(
  40135.                 'Missing the required parameter $xero_tenant_id when calling getPurchaseOrder'
  40136.             );
  40137.         }
  40138.         // verify the required parameter 'purchase_order_id' is set
  40139.         if ($purchase_order_id === null || (is_array($purchase_order_id) && count($purchase_order_id) === 0)) {
  40140.             throw new \InvalidArgumentException(
  40141.                 'Missing the required parameter $purchase_order_id when calling getPurchaseOrder'
  40142.             );
  40143.         }
  40144.         $resourcePath '/PurchaseOrders/{PurchaseOrderID}';
  40145.         $formParams = [];
  40146.         $queryParams = [];
  40147.         $headerParams = [];
  40148.         $httpBody '';
  40149.         $multipart false;
  40150.         // header params
  40151.         if ($xero_tenant_id !== null) {
  40152.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  40153.         }
  40154.         // path params
  40155.         if ($purchase_order_id !== null) {
  40156.             $resourcePath str_replace(
  40157.                 '{' 'PurchaseOrderID' '}',
  40158.                 AccountingObjectSerializer::toPathValue($purchase_order_id),
  40159.                 $resourcePath
  40160.             );
  40161.         }
  40162.         // body params
  40163.         $_tempBody null;
  40164.         if ($multipart) {
  40165.             $headers $this->headerSelector->selectHeadersForMultipart(
  40166.                 ['application/json']
  40167.             );
  40168.         } else {
  40169.             $headers $this->headerSelector->selectHeaders(
  40170.                 ['application/json'],
  40171.                 []
  40172.             );
  40173.         }
  40174.         // for model (json/xml)
  40175.         if (isset($_tempBody)) {
  40176.             // $_tempBody is the method argument, if present
  40177.             if ($headers['Content-Type'] === 'application/json') {
  40178.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  40179.             } else {
  40180.                 $httpBody $_tempBody;
  40181.             }
  40182.         } elseif (count($formParams) > 0) {
  40183.             if ($multipart) {
  40184.                 $multipartContents = [
  40185.                     [
  40186.                         'Content-type' => 'multipart/form-data',
  40187.                     ]
  40188.                 ];
  40189.                 
  40190.                 // for HTTP post (form)
  40191.                 $httpBody = new MultipartStream($multipartContents);
  40192.             } elseif ($headers['Content-Type'] === 'application/json') {
  40193.                 $httpBody \GuzzleHttp\json_encode($formParams);
  40194.             } else {
  40195.                 // for HTTP post (form)
  40196.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  40197.             }
  40198.         }
  40199.         // this endpoint requires OAuth (access token)
  40200.         if ($this->config->getAccessToken() !== null) {
  40201.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  40202.         }
  40203.         $defaultHeaders = [];
  40204.         if ($this->config->getUserAgent()) {
  40205.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  40206.         }
  40207.         $headers array_merge(
  40208.             $defaultHeaders,
  40209.             $headerParams,
  40210.             $headers
  40211.         );
  40212.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  40213.         return new Request(
  40214.             'GET',
  40215.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  40216.             $headers,
  40217.             $httpBody
  40218.         );
  40219.     }
  40220.     /**
  40221.      * Operation getPurchaseOrderAsPdf
  40222.      * Retrieves specific purchase order as PDF files using a unique purchase order Id
  40223.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  40224.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  40225.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  40226.      * @throws \InvalidArgumentException
  40227.      * @return \SplFileObject
  40228.      */
  40229.     public function getPurchaseOrderAsPdf($xero_tenant_id$purchase_order_id)
  40230.     {
  40231.         list($response) = $this->getPurchaseOrderAsPdfWithHttpInfo($xero_tenant_id$purchase_order_id);
  40232.         return $response;
  40233.     }
  40234.     /**
  40235.      * Operation getPurchaseOrderAsPdfWithHttpInfo
  40236.      * Retrieves specific purchase order as PDF files using a unique purchase order Id
  40237.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  40238.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  40239.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  40240.      * @throws \InvalidArgumentException
  40241.      * @return array of \SplFileObject, HTTP status code, HTTP response headers (array of strings)
  40242.      */
  40243.     public function getPurchaseOrderAsPdfWithHttpInfo($xero_tenant_id$purchase_order_id)
  40244.     {
  40245.         $request $this->getPurchaseOrderAsPdfRequest($xero_tenant_id$purchase_order_id);
  40246.         try {
  40247.             $options $this->createHttpClientOption();
  40248.             try {
  40249.                 $response $this->client->send($request$options);
  40250.             } catch (RequestException $e) {
  40251.                 throw new ApiException(
  40252.                     "[{$e->getCode()}{$e->getMessage()}",
  40253.                     $e->getCode(),
  40254.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  40255.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  40256.                 );
  40257.             }
  40258.             $statusCode $response->getStatusCode();
  40259.             if ($statusCode 200 || $statusCode 299) {
  40260.                 throw new ApiException(
  40261.                     sprintf(
  40262.                         '[%d] Error connecting to the API (%s)',
  40263.                         $statusCode,
  40264.                         $request->getUri()
  40265.                     ),
  40266.                     $statusCode,
  40267.                     $response->getHeaders(),
  40268.                     $response->getBody()
  40269.                 );
  40270.             }
  40271.             $responseBody $response->getBody();
  40272.             switch($statusCode) {
  40273.                 case 200:
  40274.                     if ('\SplFileObject' === '\SplFileObject') {
  40275.                         $content $responseBody//stream goes to serializer
  40276.                     } else {
  40277.                         $content $responseBody->getContents();
  40278.                     }
  40279.                     return [
  40280.                         AccountingObjectSerializer::deserialize($content'\SplFileObject', []),
  40281.                         $response->getStatusCode(),
  40282.                         $response->getHeaders()
  40283.                     ];
  40284.             }
  40285.             $returnType '\SplFileObject';
  40286.             $responseBody $response->getBody();
  40287.             if ($returnType === '\SplFileObject') {
  40288.                 $content $responseBody//stream goes to serializer
  40289.             } else {
  40290.                 $content $responseBody->getContents();
  40291.             }
  40292.             return [
  40293.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  40294.                 $response->getStatusCode(),
  40295.                 $response->getHeaders()
  40296.             ];
  40297.         } catch (ApiException $e) {
  40298.             switch ($e->getCode()) {
  40299.                 case 200:
  40300.                     $data AccountingObjectSerializer::deserialize(
  40301.                         $e->getResponseBody(),
  40302.                         '\SplFileObject',
  40303.                         $e->getResponseHeaders()
  40304.                     );
  40305.                     $e->setResponseObject($data);
  40306.                     break;
  40307.             }
  40308.             throw $e;
  40309.         }
  40310.     }
  40311.     /**
  40312.      * Operation getPurchaseOrderAsPdfAsync
  40313.      * Retrieves specific purchase order as PDF files using a unique purchase order Id
  40314.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  40315.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  40316.      * @throws \InvalidArgumentException
  40317.      * @return \GuzzleHttp\Promise\PromiseInterface
  40318.      */
  40319.     public function getPurchaseOrderAsPdfAsync($xero_tenant_id$purchase_order_id)
  40320.     {
  40321.         return $this->getPurchaseOrderAsPdfAsyncWithHttpInfo($xero_tenant_id$purchase_order_id)
  40322.             ->then(
  40323.                 function ($response) {
  40324.                     return $response[0];
  40325.                 }
  40326.             );
  40327.     }
  40328.     /**
  40329.      * Operation getPurchaseOrderAsPdfAsyncWithHttpInfo
  40330.      * Retrieves specific purchase order as PDF files using a unique purchase order Id
  40331.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  40332.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  40333.      * @throws \InvalidArgumentException
  40334.      * @return \GuzzleHttp\Promise\PromiseInterface */
  40335.     public function getPurchaseOrderAsPdfAsyncWithHttpInfo($xero_tenant_id$purchase_order_id)
  40336.     {
  40337.         $returnType '\SplFileObject';
  40338.         $request $this->getPurchaseOrderAsPdfRequest($xero_tenant_id$purchase_order_id);
  40339.         return $this->client
  40340.             ->sendAsync($request$this->createHttpClientOption())
  40341.             ->then(
  40342.                 function ($response) use ($returnType) {
  40343.                     $responseBody $response->getBody();
  40344.                     if ($returnType === '\SplFileObject') {
  40345.                         $content $responseBody//stream goes to serializer
  40346.                     } else {
  40347.                         $content $responseBody->getContents();
  40348.                     }
  40349.                     return [
  40350.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  40351.                         $response->getStatusCode(),
  40352.                         $response->getHeaders()
  40353.                     ];
  40354.                 },
  40355.                 function ($exception) {
  40356.                     $response $exception->getResponse();
  40357.                     $statusCode $response->getStatusCode();
  40358.                     throw new ApiException(
  40359.                         sprintf(
  40360.                             '[%d] Error connecting to the API (%s)',
  40361.                             $statusCode,
  40362.                             $exception->getRequest()->getUri()
  40363.                         ),
  40364.                         $statusCode,
  40365.                         $response->getHeaders(),
  40366.                         $response->getBody()
  40367.                     );
  40368.                 }
  40369.             );
  40370.     }
  40371.     /**
  40372.      * Create request for operation 'getPurchaseOrderAsPdf'
  40373.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  40374.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  40375.      * @throws \InvalidArgumentException
  40376.      * @return \GuzzleHttp\Psr7\Request  */
  40377.     protected function getPurchaseOrderAsPdfRequest($xero_tenant_id$purchase_order_id)
  40378.     {
  40379.         // verify the required parameter 'xero_tenant_id' is set
  40380.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  40381.             throw new \InvalidArgumentException(
  40382.                 'Missing the required parameter $xero_tenant_id when calling getPurchaseOrderAsPdf'
  40383.             );
  40384.         }
  40385.         // verify the required parameter 'purchase_order_id' is set
  40386.         if ($purchase_order_id === null || (is_array($purchase_order_id) && count($purchase_order_id) === 0)) {
  40387.             throw new \InvalidArgumentException(
  40388.                 'Missing the required parameter $purchase_order_id when calling getPurchaseOrderAsPdf'
  40389.             );
  40390.         }
  40391.         $resourcePath '/PurchaseOrders/{PurchaseOrderID}';
  40392.         $formParams = [];
  40393.         $queryParams = [];
  40394.         $headerParams = [];
  40395.         $httpBody '';
  40396.         $multipart false;
  40397.         // header params
  40398.         if ($xero_tenant_id !== null) {
  40399.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  40400.         }
  40401.         // path params
  40402.         if ($purchase_order_id !== null) {
  40403.             $resourcePath str_replace(
  40404.                 '{' 'PurchaseOrderID' '}',
  40405.                 AccountingObjectSerializer::toPathValue($purchase_order_id),
  40406.                 $resourcePath
  40407.             );
  40408.         }
  40409.         // body params
  40410.         $_tempBody null;
  40411.         if ($multipart) {
  40412.             $headers $this->headerSelector->selectHeadersForMultipart(
  40413.                 ['application/pdf']
  40414.             );
  40415.         } else {
  40416.             $headers $this->headerSelector->selectHeaders(
  40417.                 ['application/pdf'],
  40418.                 []
  40419.             );
  40420.         }
  40421.         // for model (json/xml)
  40422.         if (isset($_tempBody)) {
  40423.             // $_tempBody is the method argument, if present
  40424.             if ($headers['Content-Type'] === 'application/json') {
  40425.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  40426.             } else {
  40427.                 $httpBody $_tempBody;
  40428.             }
  40429.         } elseif (count($formParams) > 0) {
  40430.             if ($multipart) {
  40431.                 $multipartContents = [
  40432.                     [
  40433.                         'Content-type' => 'multipart/form-data',
  40434.                     ]
  40435.                 ];
  40436.                 
  40437.                 // for HTTP post (form)
  40438.                 $httpBody = new MultipartStream($multipartContents);
  40439.             } elseif ($headers['Content-Type'] === 'application/json') {
  40440.                 $httpBody \GuzzleHttp\json_encode($formParams);
  40441.             } else {
  40442.                 // for HTTP post (form)
  40443.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  40444.             }
  40445.         }
  40446.         // this endpoint requires OAuth (access token)
  40447.         if ($this->config->getAccessToken() !== null) {
  40448.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  40449.         }
  40450.         $defaultHeaders = [];
  40451.         if ($this->config->getUserAgent()) {
  40452.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  40453.         }
  40454.         $headers array_merge(
  40455.             $defaultHeaders,
  40456.             $headerParams,
  40457.             $headers
  40458.         );
  40459.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  40460.         return new Request(
  40461.             'GET',
  40462.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  40463.             $headers,
  40464.             $httpBody
  40465.         );
  40466.     }
  40467.     /**
  40468.      * Operation getPurchaseOrderAttachmentByFileName
  40469.      * Retrieves a specific attachment for a specific purchase order by filename
  40470.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  40471.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  40472.      * @param  string $file_name Name of the attachment (required)
  40473.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  40474.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  40475.      * @throws \InvalidArgumentException
  40476.      * @return \SplFileObject
  40477.      */
  40478.     public function getPurchaseOrderAttachmentByFileName($xero_tenant_id$purchase_order_id$file_name$content_type)
  40479.     {
  40480.         list($response) = $this->getPurchaseOrderAttachmentByFileNameWithHttpInfo($xero_tenant_id$purchase_order_id$file_name$content_type);
  40481.         return $response;
  40482.     }
  40483.     /**
  40484.      * Operation getPurchaseOrderAttachmentByFileNameWithHttpInfo
  40485.      * Retrieves a specific attachment for a specific purchase order by filename
  40486.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  40487.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  40488.      * @param  string $file_name Name of the attachment (required)
  40489.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  40490.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  40491.      * @throws \InvalidArgumentException
  40492.      * @return array of \SplFileObject, HTTP status code, HTTP response headers (array of strings)
  40493.      */
  40494.     public function getPurchaseOrderAttachmentByFileNameWithHttpInfo($xero_tenant_id$purchase_order_id$file_name$content_type)
  40495.     {
  40496.         $request $this->getPurchaseOrderAttachmentByFileNameRequest($xero_tenant_id$purchase_order_id$file_name$content_type);
  40497.         try {
  40498.             $options $this->createHttpClientOption();
  40499.             try {
  40500.                 $response $this->client->send($request$options);
  40501.             } catch (RequestException $e) {
  40502.                 throw new ApiException(
  40503.                     "[{$e->getCode()}{$e->getMessage()}",
  40504.                     $e->getCode(),
  40505.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  40506.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  40507.                 );
  40508.             }
  40509.             $statusCode $response->getStatusCode();
  40510.             if ($statusCode 200 || $statusCode 299) {
  40511.                 throw new ApiException(
  40512.                     sprintf(
  40513.                         '[%d] Error connecting to the API (%s)',
  40514.                         $statusCode,
  40515.                         $request->getUri()
  40516.                     ),
  40517.                     $statusCode,
  40518.                     $response->getHeaders(),
  40519.                     $response->getBody()
  40520.                 );
  40521.             }
  40522.             $responseBody $response->getBody();
  40523.             switch($statusCode) {
  40524.                 case 200:
  40525.                     if ('\SplFileObject' === '\SplFileObject') {
  40526.                         $content $responseBody//stream goes to serializer
  40527.                     } else {
  40528.                         $content $responseBody->getContents();
  40529.                     }
  40530.                     return [
  40531.                         AccountingObjectSerializer::deserialize($content'\SplFileObject', []),
  40532.                         $response->getStatusCode(),
  40533.                         $response->getHeaders()
  40534.                     ];
  40535.             }
  40536.             $returnType '\SplFileObject';
  40537.             $responseBody $response->getBody();
  40538.             if ($returnType === '\SplFileObject') {
  40539.                 $content $responseBody//stream goes to serializer
  40540.             } else {
  40541.                 $content $responseBody->getContents();
  40542.             }
  40543.             return [
  40544.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  40545.                 $response->getStatusCode(),
  40546.                 $response->getHeaders()
  40547.             ];
  40548.         } catch (ApiException $e) {
  40549.             switch ($e->getCode()) {
  40550.                 case 200:
  40551.                     $data AccountingObjectSerializer::deserialize(
  40552.                         $e->getResponseBody(),
  40553.                         '\SplFileObject',
  40554.                         $e->getResponseHeaders()
  40555.                     );
  40556.                     $e->setResponseObject($data);
  40557.                     break;
  40558.             }
  40559.             throw $e;
  40560.         }
  40561.     }
  40562.     /**
  40563.      * Operation getPurchaseOrderAttachmentByFileNameAsync
  40564.      * Retrieves a specific attachment for a specific purchase order by filename
  40565.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  40566.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  40567.      * @param  string $file_name Name of the attachment (required)
  40568.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  40569.      * @throws \InvalidArgumentException
  40570.      * @return \GuzzleHttp\Promise\PromiseInterface
  40571.      */
  40572.     public function getPurchaseOrderAttachmentByFileNameAsync($xero_tenant_id$purchase_order_id$file_name$content_type)
  40573.     {
  40574.         return $this->getPurchaseOrderAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$purchase_order_id$file_name$content_type)
  40575.             ->then(
  40576.                 function ($response) {
  40577.                     return $response[0];
  40578.                 }
  40579.             );
  40580.     }
  40581.     /**
  40582.      * Operation getPurchaseOrderAttachmentByFileNameAsyncWithHttpInfo
  40583.      * Retrieves a specific attachment for a specific purchase order by filename
  40584.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  40585.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  40586.      * @param  string $file_name Name of the attachment (required)
  40587.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  40588.      * @throws \InvalidArgumentException
  40589.      * @return \GuzzleHttp\Promise\PromiseInterface */
  40590.     public function getPurchaseOrderAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$purchase_order_id$file_name$content_type)
  40591.     {
  40592.         $returnType '\SplFileObject';
  40593.         $request $this->getPurchaseOrderAttachmentByFileNameRequest($xero_tenant_id$purchase_order_id$file_name$content_type);
  40594.         return $this->client
  40595.             ->sendAsync($request$this->createHttpClientOption())
  40596.             ->then(
  40597.                 function ($response) use ($returnType) {
  40598.                     $responseBody $response->getBody();
  40599.                     if ($returnType === '\SplFileObject') {
  40600.                         $content $responseBody//stream goes to serializer
  40601.                     } else {
  40602.                         $content $responseBody->getContents();
  40603.                     }
  40604.                     return [
  40605.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  40606.                         $response->getStatusCode(),
  40607.                         $response->getHeaders()
  40608.                     ];
  40609.                 },
  40610.                 function ($exception) {
  40611.                     $response $exception->getResponse();
  40612.                     $statusCode $response->getStatusCode();
  40613.                     throw new ApiException(
  40614.                         sprintf(
  40615.                             '[%d] Error connecting to the API (%s)',
  40616.                             $statusCode,
  40617.                             $exception->getRequest()->getUri()
  40618.                         ),
  40619.                         $statusCode,
  40620.                         $response->getHeaders(),
  40621.                         $response->getBody()
  40622.                     );
  40623.                 }
  40624.             );
  40625.     }
  40626.     /**
  40627.      * Create request for operation 'getPurchaseOrderAttachmentByFileName'
  40628.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  40629.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  40630.      * @param  string $file_name Name of the attachment (required)
  40631.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  40632.      * @throws \InvalidArgumentException
  40633.      * @return \GuzzleHttp\Psr7\Request  */
  40634.     protected function getPurchaseOrderAttachmentByFileNameRequest($xero_tenant_id$purchase_order_id$file_name$content_type)
  40635.     {
  40636.         // verify the required parameter 'xero_tenant_id' is set
  40637.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  40638.             throw new \InvalidArgumentException(
  40639.                 'Missing the required parameter $xero_tenant_id when calling getPurchaseOrderAttachmentByFileName'
  40640.             );
  40641.         }
  40642.         // verify the required parameter 'purchase_order_id' is set
  40643.         if ($purchase_order_id === null || (is_array($purchase_order_id) && count($purchase_order_id) === 0)) {
  40644.             throw new \InvalidArgumentException(
  40645.                 'Missing the required parameter $purchase_order_id when calling getPurchaseOrderAttachmentByFileName'
  40646.             );
  40647.         }
  40648.         // verify the required parameter 'file_name' is set
  40649.         if ($file_name === null || (is_array($file_name) && count($file_name) === 0)) {
  40650.             throw new \InvalidArgumentException(
  40651.                 'Missing the required parameter $file_name when calling getPurchaseOrderAttachmentByFileName'
  40652.             );
  40653.         }
  40654.         // verify the required parameter 'content_type' is set
  40655.         if ($content_type === null || (is_array($content_type) && count($content_type) === 0)) {
  40656.             throw new \InvalidArgumentException(
  40657.                 'Missing the required parameter $content_type when calling getPurchaseOrderAttachmentByFileName'
  40658.             );
  40659.         }
  40660.         $resourcePath '/PurchaseOrders/{PurchaseOrderID}/Attachments/{FileName}';
  40661.         $formParams = [];
  40662.         $queryParams = [];
  40663.         $headerParams = [];
  40664.         $httpBody '';
  40665.         $multipart false;
  40666.         // header params
  40667.         if ($xero_tenant_id !== null) {
  40668.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  40669.         }
  40670.         // header params
  40671.         if ($content_type !== null) {
  40672.             $headerParams['contentType'] = AccountingObjectSerializer::toHeaderValue($content_type);
  40673.         }
  40674.         // path params
  40675.         if ($purchase_order_id !== null) {
  40676.             $resourcePath str_replace(
  40677.                 '{' 'PurchaseOrderID' '}',
  40678.                 AccountingObjectSerializer::toPathValue($purchase_order_id),
  40679.                 $resourcePath
  40680.             );
  40681.         }
  40682.         // path params
  40683.         if ($file_name !== null) {
  40684.             $resourcePath str_replace(
  40685.                 '{' 'FileName' '}',
  40686.                 AccountingObjectSerializer::toPathValue($file_name),
  40687.                 $resourcePath
  40688.             );
  40689.         }
  40690.         // body params
  40691.         $_tempBody null;
  40692.         if ($multipart) {
  40693.             $headers $this->headerSelector->selectHeadersForMultipart(
  40694.                 ['application/octet-stream']
  40695.             );
  40696.         } else {
  40697.             $headers $this->headerSelector->selectHeaders(
  40698.                 ['application/octet-stream'],
  40699.                 []
  40700.             );
  40701.         }
  40702.         // for model (json/xml)
  40703.         if (isset($_tempBody)) {
  40704.             // $_tempBody is the method argument, if present
  40705.             if ($headers['Content-Type'] === 'application/json') {
  40706.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  40707.             } else {
  40708.                 $httpBody $_tempBody;
  40709.             }
  40710.         } elseif (count($formParams) > 0) {
  40711.             if ($multipart) {
  40712.                 $multipartContents = [
  40713.                     [
  40714.                         'Content-type' => 'multipart/form-data',
  40715.                     ]
  40716.                 ];
  40717.                 
  40718.                 // for HTTP post (form)
  40719.                 $httpBody = new MultipartStream($multipartContents);
  40720.             } elseif ($headers['Content-Type'] === 'application/json') {
  40721.                 $httpBody \GuzzleHttp\json_encode($formParams);
  40722.             } else {
  40723.                 // for HTTP post (form)
  40724.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  40725.             }
  40726.         }
  40727.         // this endpoint requires OAuth (access token)
  40728.         if ($this->config->getAccessToken() !== null) {
  40729.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  40730.         }
  40731.         $defaultHeaders = [];
  40732.         if ($this->config->getUserAgent()) {
  40733.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  40734.         }
  40735.         $headers array_merge(
  40736.             $defaultHeaders,
  40737.             $headerParams,
  40738.             $headers
  40739.         );
  40740.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  40741.         return new Request(
  40742.             'GET',
  40743.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  40744.             $headers,
  40745.             $httpBody
  40746.         );
  40747.     }
  40748.     /**
  40749.      * Operation getPurchaseOrderAttachmentById
  40750.      * Retrieves specific attachment for a specific purchase order using a unique attachment Id
  40751.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  40752.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  40753.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  40754.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  40755.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  40756.      * @throws \InvalidArgumentException
  40757.      * @return \SplFileObject
  40758.      */
  40759.     public function getPurchaseOrderAttachmentById($xero_tenant_id$purchase_order_id$attachment_id$content_type)
  40760.     {
  40761.         list($response) = $this->getPurchaseOrderAttachmentByIdWithHttpInfo($xero_tenant_id$purchase_order_id$attachment_id$content_type);
  40762.         return $response;
  40763.     }
  40764.     /**
  40765.      * Operation getPurchaseOrderAttachmentByIdWithHttpInfo
  40766.      * Retrieves specific attachment for a specific purchase order using a unique attachment Id
  40767.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  40768.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  40769.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  40770.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  40771.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  40772.      * @throws \InvalidArgumentException
  40773.      * @return array of \SplFileObject, HTTP status code, HTTP response headers (array of strings)
  40774.      */
  40775.     public function getPurchaseOrderAttachmentByIdWithHttpInfo($xero_tenant_id$purchase_order_id$attachment_id$content_type)
  40776.     {
  40777.         $request $this->getPurchaseOrderAttachmentByIdRequest($xero_tenant_id$purchase_order_id$attachment_id$content_type);
  40778.         try {
  40779.             $options $this->createHttpClientOption();
  40780.             try {
  40781.                 $response $this->client->send($request$options);
  40782.             } catch (RequestException $e) {
  40783.                 throw new ApiException(
  40784.                     "[{$e->getCode()}{$e->getMessage()}",
  40785.                     $e->getCode(),
  40786.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  40787.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  40788.                 );
  40789.             }
  40790.             $statusCode $response->getStatusCode();
  40791.             if ($statusCode 200 || $statusCode 299) {
  40792.                 throw new ApiException(
  40793.                     sprintf(
  40794.                         '[%d] Error connecting to the API (%s)',
  40795.                         $statusCode,
  40796.                         $request->getUri()
  40797.                     ),
  40798.                     $statusCode,
  40799.                     $response->getHeaders(),
  40800.                     $response->getBody()
  40801.                 );
  40802.             }
  40803.             $responseBody $response->getBody();
  40804.             switch($statusCode) {
  40805.                 case 200:
  40806.                     if ('\SplFileObject' === '\SplFileObject') {
  40807.                         $content $responseBody//stream goes to serializer
  40808.                     } else {
  40809.                         $content $responseBody->getContents();
  40810.                     }
  40811.                     return [
  40812.                         AccountingObjectSerializer::deserialize($content'\SplFileObject', []),
  40813.                         $response->getStatusCode(),
  40814.                         $response->getHeaders()
  40815.                     ];
  40816.             }
  40817.             $returnType '\SplFileObject';
  40818.             $responseBody $response->getBody();
  40819.             if ($returnType === '\SplFileObject') {
  40820.                 $content $responseBody//stream goes to serializer
  40821.             } else {
  40822.                 $content $responseBody->getContents();
  40823.             }
  40824.             return [
  40825.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  40826.                 $response->getStatusCode(),
  40827.                 $response->getHeaders()
  40828.             ];
  40829.         } catch (ApiException $e) {
  40830.             switch ($e->getCode()) {
  40831.                 case 200:
  40832.                     $data AccountingObjectSerializer::deserialize(
  40833.                         $e->getResponseBody(),
  40834.                         '\SplFileObject',
  40835.                         $e->getResponseHeaders()
  40836.                     );
  40837.                     $e->setResponseObject($data);
  40838.                     break;
  40839.             }
  40840.             throw $e;
  40841.         }
  40842.     }
  40843.     /**
  40844.      * Operation getPurchaseOrderAttachmentByIdAsync
  40845.      * Retrieves specific attachment for a specific purchase order using a unique attachment Id
  40846.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  40847.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  40848.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  40849.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  40850.      * @throws \InvalidArgumentException
  40851.      * @return \GuzzleHttp\Promise\PromiseInterface
  40852.      */
  40853.     public function getPurchaseOrderAttachmentByIdAsync($xero_tenant_id$purchase_order_id$attachment_id$content_type)
  40854.     {
  40855.         return $this->getPurchaseOrderAttachmentByIdAsyncWithHttpInfo($xero_tenant_id$purchase_order_id$attachment_id$content_type)
  40856.             ->then(
  40857.                 function ($response) {
  40858.                     return $response[0];
  40859.                 }
  40860.             );
  40861.     }
  40862.     /**
  40863.      * Operation getPurchaseOrderAttachmentByIdAsyncWithHttpInfo
  40864.      * Retrieves specific attachment for a specific purchase order using a unique attachment Id
  40865.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  40866.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  40867.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  40868.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  40869.      * @throws \InvalidArgumentException
  40870.      * @return \GuzzleHttp\Promise\PromiseInterface */
  40871.     public function getPurchaseOrderAttachmentByIdAsyncWithHttpInfo($xero_tenant_id$purchase_order_id$attachment_id$content_type)
  40872.     {
  40873.         $returnType '\SplFileObject';
  40874.         $request $this->getPurchaseOrderAttachmentByIdRequest($xero_tenant_id$purchase_order_id$attachment_id$content_type);
  40875.         return $this->client
  40876.             ->sendAsync($request$this->createHttpClientOption())
  40877.             ->then(
  40878.                 function ($response) use ($returnType) {
  40879.                     $responseBody $response->getBody();
  40880.                     if ($returnType === '\SplFileObject') {
  40881.                         $content $responseBody//stream goes to serializer
  40882.                     } else {
  40883.                         $content $responseBody->getContents();
  40884.                     }
  40885.                     return [
  40886.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  40887.                         $response->getStatusCode(),
  40888.                         $response->getHeaders()
  40889.                     ];
  40890.                 },
  40891.                 function ($exception) {
  40892.                     $response $exception->getResponse();
  40893.                     $statusCode $response->getStatusCode();
  40894.                     throw new ApiException(
  40895.                         sprintf(
  40896.                             '[%d] Error connecting to the API (%s)',
  40897.                             $statusCode,
  40898.                             $exception->getRequest()->getUri()
  40899.                         ),
  40900.                         $statusCode,
  40901.                         $response->getHeaders(),
  40902.                         $response->getBody()
  40903.                     );
  40904.                 }
  40905.             );
  40906.     }
  40907.     /**
  40908.      * Create request for operation 'getPurchaseOrderAttachmentById'
  40909.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  40910.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  40911.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  40912.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  40913.      * @throws \InvalidArgumentException
  40914.      * @return \GuzzleHttp\Psr7\Request  */
  40915.     protected function getPurchaseOrderAttachmentByIdRequest($xero_tenant_id$purchase_order_id$attachment_id$content_type)
  40916.     {
  40917.         // verify the required parameter 'xero_tenant_id' is set
  40918.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  40919.             throw new \InvalidArgumentException(
  40920.                 'Missing the required parameter $xero_tenant_id when calling getPurchaseOrderAttachmentById'
  40921.             );
  40922.         }
  40923.         // verify the required parameter 'purchase_order_id' is set
  40924.         if ($purchase_order_id === null || (is_array($purchase_order_id) && count($purchase_order_id) === 0)) {
  40925.             throw new \InvalidArgumentException(
  40926.                 'Missing the required parameter $purchase_order_id when calling getPurchaseOrderAttachmentById'
  40927.             );
  40928.         }
  40929.         // verify the required parameter 'attachment_id' is set
  40930.         if ($attachment_id === null || (is_array($attachment_id) && count($attachment_id) === 0)) {
  40931.             throw new \InvalidArgumentException(
  40932.                 'Missing the required parameter $attachment_id when calling getPurchaseOrderAttachmentById'
  40933.             );
  40934.         }
  40935.         // verify the required parameter 'content_type' is set
  40936.         if ($content_type === null || (is_array($content_type) && count($content_type) === 0)) {
  40937.             throw new \InvalidArgumentException(
  40938.                 'Missing the required parameter $content_type when calling getPurchaseOrderAttachmentById'
  40939.             );
  40940.         }
  40941.         $resourcePath '/PurchaseOrders/{PurchaseOrderID}/Attachments/{AttachmentID}';
  40942.         $formParams = [];
  40943.         $queryParams = [];
  40944.         $headerParams = [];
  40945.         $httpBody '';
  40946.         $multipart false;
  40947.         // header params
  40948.         if ($xero_tenant_id !== null) {
  40949.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  40950.         }
  40951.         // header params
  40952.         if ($content_type !== null) {
  40953.             $headerParams['contentType'] = AccountingObjectSerializer::toHeaderValue($content_type);
  40954.         }
  40955.         // path params
  40956.         if ($purchase_order_id !== null) {
  40957.             $resourcePath str_replace(
  40958.                 '{' 'PurchaseOrderID' '}',
  40959.                 AccountingObjectSerializer::toPathValue($purchase_order_id),
  40960.                 $resourcePath
  40961.             );
  40962.         }
  40963.         // path params
  40964.         if ($attachment_id !== null) {
  40965.             $resourcePath str_replace(
  40966.                 '{' 'AttachmentID' '}',
  40967.                 AccountingObjectSerializer::toPathValue($attachment_id),
  40968.                 $resourcePath
  40969.             );
  40970.         }
  40971.         // body params
  40972.         $_tempBody null;
  40973.         if ($multipart) {
  40974.             $headers $this->headerSelector->selectHeadersForMultipart(
  40975.                 ['application/octet-stream']
  40976.             );
  40977.         } else {
  40978.             $headers $this->headerSelector->selectHeaders(
  40979.                 ['application/octet-stream'],
  40980.                 []
  40981.             );
  40982.         }
  40983.         // for model (json/xml)
  40984.         if (isset($_tempBody)) {
  40985.             // $_tempBody is the method argument, if present
  40986.             if ($headers['Content-Type'] === 'application/json') {
  40987.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  40988.             } else {
  40989.                 $httpBody $_tempBody;
  40990.             }
  40991.         } elseif (count($formParams) > 0) {
  40992.             if ($multipart) {
  40993.                 $multipartContents = [
  40994.                     [
  40995.                         'Content-type' => 'multipart/form-data',
  40996.                     ]
  40997.                 ];
  40998.                 
  40999.                 // for HTTP post (form)
  41000.                 $httpBody = new MultipartStream($multipartContents);
  41001.             } elseif ($headers['Content-Type'] === 'application/json') {
  41002.                 $httpBody \GuzzleHttp\json_encode($formParams);
  41003.             } else {
  41004.                 // for HTTP post (form)
  41005.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  41006.             }
  41007.         }
  41008.         // this endpoint requires OAuth (access token)
  41009.         if ($this->config->getAccessToken() !== null) {
  41010.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  41011.         }
  41012.         $defaultHeaders = [];
  41013.         if ($this->config->getUserAgent()) {
  41014.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  41015.         }
  41016.         $headers array_merge(
  41017.             $defaultHeaders,
  41018.             $headerParams,
  41019.             $headers
  41020.         );
  41021.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  41022.         return new Request(
  41023.             'GET',
  41024.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  41025.             $headers,
  41026.             $httpBody
  41027.         );
  41028.     }
  41029.     /**
  41030.      * Operation getPurchaseOrderAttachments
  41031.      * Retrieves attachments for a specific purchase order
  41032.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  41033.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  41034.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  41035.      * @throws \InvalidArgumentException
  41036.      * @return \XeroAPI\XeroPHP\Models\Accounting\Attachments
  41037.      */
  41038.     public function getPurchaseOrderAttachments($xero_tenant_id$purchase_order_id)
  41039.     {
  41040.         list($response) = $this->getPurchaseOrderAttachmentsWithHttpInfo($xero_tenant_id$purchase_order_id);
  41041.         return $response;
  41042.     }
  41043.     /**
  41044.      * Operation getPurchaseOrderAttachmentsWithHttpInfo
  41045.      * Retrieves attachments for a specific purchase order
  41046.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  41047.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  41048.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  41049.      * @throws \InvalidArgumentException
  41050.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Attachments, HTTP status code, HTTP response headers (array of strings)
  41051.      */
  41052.     public function getPurchaseOrderAttachmentsWithHttpInfo($xero_tenant_id$purchase_order_id)
  41053.     {
  41054.         $request $this->getPurchaseOrderAttachmentsRequest($xero_tenant_id$purchase_order_id);
  41055.         try {
  41056.             $options $this->createHttpClientOption();
  41057.             try {
  41058.                 $response $this->client->send($request$options);
  41059.             } catch (RequestException $e) {
  41060.                 throw new ApiException(
  41061.                     "[{$e->getCode()}{$e->getMessage()}",
  41062.                     $e->getCode(),
  41063.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  41064.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  41065.                 );
  41066.             }
  41067.             $statusCode $response->getStatusCode();
  41068.             if ($statusCode 200 || $statusCode 299) {
  41069.                 throw new ApiException(
  41070.                     sprintf(
  41071.                         '[%d] Error connecting to the API (%s)',
  41072.                         $statusCode,
  41073.                         $request->getUri()
  41074.                     ),
  41075.                     $statusCode,
  41076.                     $response->getHeaders(),
  41077.                     $response->getBody()
  41078.                 );
  41079.             }
  41080.             $responseBody $response->getBody();
  41081.             switch($statusCode) {
  41082.                 case 200:
  41083.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Attachments' === '\SplFileObject') {
  41084.                         $content $responseBody//stream goes to serializer
  41085.                     } else {
  41086.                         $content $responseBody->getContents();
  41087.                     }
  41088.                     return [
  41089.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Attachments', []),
  41090.                         $response->getStatusCode(),
  41091.                         $response->getHeaders()
  41092.                     ];
  41093.             }
  41094.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  41095.             $responseBody $response->getBody();
  41096.             if ($returnType === '\SplFileObject') {
  41097.                 $content $responseBody//stream goes to serializer
  41098.             } else {
  41099.                 $content $responseBody->getContents();
  41100.             }
  41101.             return [
  41102.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  41103.                 $response->getStatusCode(),
  41104.                 $response->getHeaders()
  41105.             ];
  41106.         } catch (ApiException $e) {
  41107.             switch ($e->getCode()) {
  41108.                 case 200:
  41109.                     $data AccountingObjectSerializer::deserialize(
  41110.                         $e->getResponseBody(),
  41111.                         '\XeroAPI\XeroPHP\Models\Accounting\Attachments',
  41112.                         $e->getResponseHeaders()
  41113.                     );
  41114.                     $e->setResponseObject($data);
  41115.                     break;
  41116.             }
  41117.             throw $e;
  41118.         }
  41119.     }
  41120.     /**
  41121.      * Operation getPurchaseOrderAttachmentsAsync
  41122.      * Retrieves attachments for a specific purchase order
  41123.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  41124.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  41125.      * @throws \InvalidArgumentException
  41126.      * @return \GuzzleHttp\Promise\PromiseInterface
  41127.      */
  41128.     public function getPurchaseOrderAttachmentsAsync($xero_tenant_id$purchase_order_id)
  41129.     {
  41130.         return $this->getPurchaseOrderAttachmentsAsyncWithHttpInfo($xero_tenant_id$purchase_order_id)
  41131.             ->then(
  41132.                 function ($response) {
  41133.                     return $response[0];
  41134.                 }
  41135.             );
  41136.     }
  41137.     /**
  41138.      * Operation getPurchaseOrderAttachmentsAsyncWithHttpInfo
  41139.      * Retrieves attachments for a specific purchase order
  41140.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  41141.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  41142.      * @throws \InvalidArgumentException
  41143.      * @return \GuzzleHttp\Promise\PromiseInterface */
  41144.     public function getPurchaseOrderAttachmentsAsyncWithHttpInfo($xero_tenant_id$purchase_order_id)
  41145.     {
  41146.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  41147.         $request $this->getPurchaseOrderAttachmentsRequest($xero_tenant_id$purchase_order_id);
  41148.         return $this->client
  41149.             ->sendAsync($request$this->createHttpClientOption())
  41150.             ->then(
  41151.                 function ($response) use ($returnType) {
  41152.                     $responseBody $response->getBody();
  41153.                     if ($returnType === '\SplFileObject') {
  41154.                         $content $responseBody//stream goes to serializer
  41155.                     } else {
  41156.                         $content $responseBody->getContents();
  41157.                     }
  41158.                     return [
  41159.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  41160.                         $response->getStatusCode(),
  41161.                         $response->getHeaders()
  41162.                     ];
  41163.                 },
  41164.                 function ($exception) {
  41165.                     $response $exception->getResponse();
  41166.                     $statusCode $response->getStatusCode();
  41167.                     throw new ApiException(
  41168.                         sprintf(
  41169.                             '[%d] Error connecting to the API (%s)',
  41170.                             $statusCode,
  41171.                             $exception->getRequest()->getUri()
  41172.                         ),
  41173.                         $statusCode,
  41174.                         $response->getHeaders(),
  41175.                         $response->getBody()
  41176.                     );
  41177.                 }
  41178.             );
  41179.     }
  41180.     /**
  41181.      * Create request for operation 'getPurchaseOrderAttachments'
  41182.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  41183.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  41184.      * @throws \InvalidArgumentException
  41185.      * @return \GuzzleHttp\Psr7\Request  */
  41186.     protected function getPurchaseOrderAttachmentsRequest($xero_tenant_id$purchase_order_id)
  41187.     {
  41188.         // verify the required parameter 'xero_tenant_id' is set
  41189.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  41190.             throw new \InvalidArgumentException(
  41191.                 'Missing the required parameter $xero_tenant_id when calling getPurchaseOrderAttachments'
  41192.             );
  41193.         }
  41194.         // verify the required parameter 'purchase_order_id' is set
  41195.         if ($purchase_order_id === null || (is_array($purchase_order_id) && count($purchase_order_id) === 0)) {
  41196.             throw new \InvalidArgumentException(
  41197.                 'Missing the required parameter $purchase_order_id when calling getPurchaseOrderAttachments'
  41198.             );
  41199.         }
  41200.         $resourcePath '/PurchaseOrders/{PurchaseOrderID}/Attachments';
  41201.         $formParams = [];
  41202.         $queryParams = [];
  41203.         $headerParams = [];
  41204.         $httpBody '';
  41205.         $multipart false;
  41206.         // header params
  41207.         if ($xero_tenant_id !== null) {
  41208.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  41209.         }
  41210.         // path params
  41211.         if ($purchase_order_id !== null) {
  41212.             $resourcePath str_replace(
  41213.                 '{' 'PurchaseOrderID' '}',
  41214.                 AccountingObjectSerializer::toPathValue($purchase_order_id),
  41215.                 $resourcePath
  41216.             );
  41217.         }
  41218.         // body params
  41219.         $_tempBody null;
  41220.         if ($multipart) {
  41221.             $headers $this->headerSelector->selectHeadersForMultipart(
  41222.                 ['application/json']
  41223.             );
  41224.         } else {
  41225.             $headers $this->headerSelector->selectHeaders(
  41226.                 ['application/json'],
  41227.                 []
  41228.             );
  41229.         }
  41230.         // for model (json/xml)
  41231.         if (isset($_tempBody)) {
  41232.             // $_tempBody is the method argument, if present
  41233.             if ($headers['Content-Type'] === 'application/json') {
  41234.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  41235.             } else {
  41236.                 $httpBody $_tempBody;
  41237.             }
  41238.         } elseif (count($formParams) > 0) {
  41239.             if ($multipart) {
  41240.                 $multipartContents = [
  41241.                     [
  41242.                         'Content-type' => 'multipart/form-data',
  41243.                     ]
  41244.                 ];
  41245.                 
  41246.                 // for HTTP post (form)
  41247.                 $httpBody = new MultipartStream($multipartContents);
  41248.             } elseif ($headers['Content-Type'] === 'application/json') {
  41249.                 $httpBody \GuzzleHttp\json_encode($formParams);
  41250.             } else {
  41251.                 // for HTTP post (form)
  41252.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  41253.             }
  41254.         }
  41255.         // this endpoint requires OAuth (access token)
  41256.         if ($this->config->getAccessToken() !== null) {
  41257.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  41258.         }
  41259.         $defaultHeaders = [];
  41260.         if ($this->config->getUserAgent()) {
  41261.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  41262.         }
  41263.         $headers array_merge(
  41264.             $defaultHeaders,
  41265.             $headerParams,
  41266.             $headers
  41267.         );
  41268.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  41269.         return new Request(
  41270.             'GET',
  41271.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  41272.             $headers,
  41273.             $httpBody
  41274.         );
  41275.     }
  41276.     /**
  41277.      * Operation getPurchaseOrderByNumber
  41278.      * Retrieves a specific purchase order using purchase order number
  41279.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  41280.      * @param  string $purchase_order_number Unique identifier for a PurchaseOrder (required)
  41281.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  41282.      * @throws \InvalidArgumentException
  41283.      * @return \XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders
  41284.      */
  41285.     public function getPurchaseOrderByNumber($xero_tenant_id$purchase_order_number)
  41286.     {
  41287.         list($response) = $this->getPurchaseOrderByNumberWithHttpInfo($xero_tenant_id$purchase_order_number);
  41288.         return $response;
  41289.     }
  41290.     /**
  41291.      * Operation getPurchaseOrderByNumberWithHttpInfo
  41292.      * Retrieves a specific purchase order using purchase order number
  41293.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  41294.      * @param  string $purchase_order_number Unique identifier for a PurchaseOrder (required)
  41295.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  41296.      * @throws \InvalidArgumentException
  41297.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders, HTTP status code, HTTP response headers (array of strings)
  41298.      */
  41299.     public function getPurchaseOrderByNumberWithHttpInfo($xero_tenant_id$purchase_order_number)
  41300.     {
  41301.         $request $this->getPurchaseOrderByNumberRequest($xero_tenant_id$purchase_order_number);
  41302.         try {
  41303.             $options $this->createHttpClientOption();
  41304.             try {
  41305.                 $response $this->client->send($request$options);
  41306.             } catch (RequestException $e) {
  41307.                 throw new ApiException(
  41308.                     "[{$e->getCode()}{$e->getMessage()}",
  41309.                     $e->getCode(),
  41310.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  41311.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  41312.                 );
  41313.             }
  41314.             $statusCode $response->getStatusCode();
  41315.             if ($statusCode 200 || $statusCode 299) {
  41316.                 throw new ApiException(
  41317.                     sprintf(
  41318.                         '[%d] Error connecting to the API (%s)',
  41319.                         $statusCode,
  41320.                         $request->getUri()
  41321.                     ),
  41322.                     $statusCode,
  41323.                     $response->getHeaders(),
  41324.                     $response->getBody()
  41325.                 );
  41326.             }
  41327.             $responseBody $response->getBody();
  41328.             switch($statusCode) {
  41329.                 case 200:
  41330.                     if ('\XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders' === '\SplFileObject') {
  41331.                         $content $responseBody//stream goes to serializer
  41332.                     } else {
  41333.                         $content $responseBody->getContents();
  41334.                     }
  41335.                     return [
  41336.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders', []),
  41337.                         $response->getStatusCode(),
  41338.                         $response->getHeaders()
  41339.                     ];
  41340.             }
  41341.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders';
  41342.             $responseBody $response->getBody();
  41343.             if ($returnType === '\SplFileObject') {
  41344.                 $content $responseBody//stream goes to serializer
  41345.             } else {
  41346.                 $content $responseBody->getContents();
  41347.             }
  41348.             return [
  41349.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  41350.                 $response->getStatusCode(),
  41351.                 $response->getHeaders()
  41352.             ];
  41353.         } catch (ApiException $e) {
  41354.             switch ($e->getCode()) {
  41355.                 case 200:
  41356.                     $data AccountingObjectSerializer::deserialize(
  41357.                         $e->getResponseBody(),
  41358.                         '\XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders',
  41359.                         $e->getResponseHeaders()
  41360.                     );
  41361.                     $e->setResponseObject($data);
  41362.                     break;
  41363.             }
  41364.             throw $e;
  41365.         }
  41366.     }
  41367.     /**
  41368.      * Operation getPurchaseOrderByNumberAsync
  41369.      * Retrieves a specific purchase order using purchase order number
  41370.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  41371.      * @param  string $purchase_order_number Unique identifier for a PurchaseOrder (required)
  41372.      * @throws \InvalidArgumentException
  41373.      * @return \GuzzleHttp\Promise\PromiseInterface
  41374.      */
  41375.     public function getPurchaseOrderByNumberAsync($xero_tenant_id$purchase_order_number)
  41376.     {
  41377.         return $this->getPurchaseOrderByNumberAsyncWithHttpInfo($xero_tenant_id$purchase_order_number)
  41378.             ->then(
  41379.                 function ($response) {
  41380.                     return $response[0];
  41381.                 }
  41382.             );
  41383.     }
  41384.     /**
  41385.      * Operation getPurchaseOrderByNumberAsyncWithHttpInfo
  41386.      * Retrieves a specific purchase order using purchase order number
  41387.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  41388.      * @param  string $purchase_order_number Unique identifier for a PurchaseOrder (required)
  41389.      * @throws \InvalidArgumentException
  41390.      * @return \GuzzleHttp\Promise\PromiseInterface */
  41391.     public function getPurchaseOrderByNumberAsyncWithHttpInfo($xero_tenant_id$purchase_order_number)
  41392.     {
  41393.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders';
  41394.         $request $this->getPurchaseOrderByNumberRequest($xero_tenant_id$purchase_order_number);
  41395.         return $this->client
  41396.             ->sendAsync($request$this->createHttpClientOption())
  41397.             ->then(
  41398.                 function ($response) use ($returnType) {
  41399.                     $responseBody $response->getBody();
  41400.                     if ($returnType === '\SplFileObject') {
  41401.                         $content $responseBody//stream goes to serializer
  41402.                     } else {
  41403.                         $content $responseBody->getContents();
  41404.                     }
  41405.                     return [
  41406.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  41407.                         $response->getStatusCode(),
  41408.                         $response->getHeaders()
  41409.                     ];
  41410.                 },
  41411.                 function ($exception) {
  41412.                     $response $exception->getResponse();
  41413.                     $statusCode $response->getStatusCode();
  41414.                     throw new ApiException(
  41415.                         sprintf(
  41416.                             '[%d] Error connecting to the API (%s)',
  41417.                             $statusCode,
  41418.                             $exception->getRequest()->getUri()
  41419.                         ),
  41420.                         $statusCode,
  41421.                         $response->getHeaders(),
  41422.                         $response->getBody()
  41423.                     );
  41424.                 }
  41425.             );
  41426.     }
  41427.     /**
  41428.      * Create request for operation 'getPurchaseOrderByNumber'
  41429.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  41430.      * @param  string $purchase_order_number Unique identifier for a PurchaseOrder (required)
  41431.      * @throws \InvalidArgumentException
  41432.      * @return \GuzzleHttp\Psr7\Request  */
  41433.     protected function getPurchaseOrderByNumberRequest($xero_tenant_id$purchase_order_number)
  41434.     {
  41435.         // verify the required parameter 'xero_tenant_id' is set
  41436.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  41437.             throw new \InvalidArgumentException(
  41438.                 'Missing the required parameter $xero_tenant_id when calling getPurchaseOrderByNumber'
  41439.             );
  41440.         }
  41441.         // verify the required parameter 'purchase_order_number' is set
  41442.         if ($purchase_order_number === null || (is_array($purchase_order_number) && count($purchase_order_number) === 0)) {
  41443.             throw new \InvalidArgumentException(
  41444.                 'Missing the required parameter $purchase_order_number when calling getPurchaseOrderByNumber'
  41445.             );
  41446.         }
  41447.         $resourcePath '/PurchaseOrders/{PurchaseOrderNumber}';
  41448.         $formParams = [];
  41449.         $queryParams = [];
  41450.         $headerParams = [];
  41451.         $httpBody '';
  41452.         $multipart false;
  41453.         // header params
  41454.         if ($xero_tenant_id !== null) {
  41455.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  41456.         }
  41457.         // path params
  41458.         if ($purchase_order_number !== null) {
  41459.             $resourcePath str_replace(
  41460.                 '{' 'PurchaseOrderNumber' '}',
  41461.                 AccountingObjectSerializer::toPathValue($purchase_order_number),
  41462.                 $resourcePath
  41463.             );
  41464.         }
  41465.         // body params
  41466.         $_tempBody null;
  41467.         if ($multipart) {
  41468.             $headers $this->headerSelector->selectHeadersForMultipart(
  41469.                 ['application/json']
  41470.             );
  41471.         } else {
  41472.             $headers $this->headerSelector->selectHeaders(
  41473.                 ['application/json'],
  41474.                 []
  41475.             );
  41476.         }
  41477.         // for model (json/xml)
  41478.         if (isset($_tempBody)) {
  41479.             // $_tempBody is the method argument, if present
  41480.             if ($headers['Content-Type'] === 'application/json') {
  41481.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  41482.             } else {
  41483.                 $httpBody $_tempBody;
  41484.             }
  41485.         } elseif (count($formParams) > 0) {
  41486.             if ($multipart) {
  41487.                 $multipartContents = [
  41488.                     [
  41489.                         'Content-type' => 'multipart/form-data',
  41490.                     ]
  41491.                 ];
  41492.                 
  41493.                 // for HTTP post (form)
  41494.                 $httpBody = new MultipartStream($multipartContents);
  41495.             } elseif ($headers['Content-Type'] === 'application/json') {
  41496.                 $httpBody \GuzzleHttp\json_encode($formParams);
  41497.             } else {
  41498.                 // for HTTP post (form)
  41499.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  41500.             }
  41501.         }
  41502.         // this endpoint requires OAuth (access token)
  41503.         if ($this->config->getAccessToken() !== null) {
  41504.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  41505.         }
  41506.         $defaultHeaders = [];
  41507.         if ($this->config->getUserAgent()) {
  41508.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  41509.         }
  41510.         $headers array_merge(
  41511.             $defaultHeaders,
  41512.             $headerParams,
  41513.             $headers
  41514.         );
  41515.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  41516.         return new Request(
  41517.             'GET',
  41518.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  41519.             $headers,
  41520.             $httpBody
  41521.         );
  41522.     }
  41523.     /**
  41524.      * Operation getPurchaseOrderHistory
  41525.      * Retrieves history for a specific purchase order
  41526.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  41527.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  41528.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  41529.      * @throws \InvalidArgumentException
  41530.      * @return \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords
  41531.      */
  41532.     public function getPurchaseOrderHistory($xero_tenant_id$purchase_order_id)
  41533.     {
  41534.         list($response) = $this->getPurchaseOrderHistoryWithHttpInfo($xero_tenant_id$purchase_order_id);
  41535.         return $response;
  41536.     }
  41537.     /**
  41538.      * Operation getPurchaseOrderHistoryWithHttpInfo
  41539.      * Retrieves history for a specific purchase order
  41540.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  41541.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  41542.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  41543.      * @throws \InvalidArgumentException
  41544.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords, HTTP status code, HTTP response headers (array of strings)
  41545.      */
  41546.     public function getPurchaseOrderHistoryWithHttpInfo($xero_tenant_id$purchase_order_id)
  41547.     {
  41548.         $request $this->getPurchaseOrderHistoryRequest($xero_tenant_id$purchase_order_id);
  41549.         try {
  41550.             $options $this->createHttpClientOption();
  41551.             try {
  41552.                 $response $this->client->send($request$options);
  41553.             } catch (RequestException $e) {
  41554.                 throw new ApiException(
  41555.                     "[{$e->getCode()}{$e->getMessage()}",
  41556.                     $e->getCode(),
  41557.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  41558.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  41559.                 );
  41560.             }
  41561.             $statusCode $response->getStatusCode();
  41562.             if ($statusCode 200 || $statusCode 299) {
  41563.                 throw new ApiException(
  41564.                     sprintf(
  41565.                         '[%d] Error connecting to the API (%s)',
  41566.                         $statusCode,
  41567.                         $request->getUri()
  41568.                     ),
  41569.                     $statusCode,
  41570.                     $response->getHeaders(),
  41571.                     $response->getBody()
  41572.                 );
  41573.             }
  41574.             $responseBody $response->getBody();
  41575.             switch($statusCode) {
  41576.                 case 200:
  41577.                     if ('\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords' === '\SplFileObject') {
  41578.                         $content $responseBody//stream goes to serializer
  41579.                     } else {
  41580.                         $content $responseBody->getContents();
  41581.                     }
  41582.                     return [
  41583.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords', []),
  41584.                         $response->getStatusCode(),
  41585.                         $response->getHeaders()
  41586.                     ];
  41587.             }
  41588.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  41589.             $responseBody $response->getBody();
  41590.             if ($returnType === '\SplFileObject') {
  41591.                 $content $responseBody//stream goes to serializer
  41592.             } else {
  41593.                 $content $responseBody->getContents();
  41594.             }
  41595.             return [
  41596.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  41597.                 $response->getStatusCode(),
  41598.                 $response->getHeaders()
  41599.             ];
  41600.         } catch (ApiException $e) {
  41601.             switch ($e->getCode()) {
  41602.                 case 200:
  41603.                     $data AccountingObjectSerializer::deserialize(
  41604.                         $e->getResponseBody(),
  41605.                         '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords',
  41606.                         $e->getResponseHeaders()
  41607.                     );
  41608.                     $e->setResponseObject($data);
  41609.                     break;
  41610.             }
  41611.             throw $e;
  41612.         }
  41613.     }
  41614.     /**
  41615.      * Operation getPurchaseOrderHistoryAsync
  41616.      * Retrieves history for a specific purchase order
  41617.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  41618.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  41619.      * @throws \InvalidArgumentException
  41620.      * @return \GuzzleHttp\Promise\PromiseInterface
  41621.      */
  41622.     public function getPurchaseOrderHistoryAsync($xero_tenant_id$purchase_order_id)
  41623.     {
  41624.         return $this->getPurchaseOrderHistoryAsyncWithHttpInfo($xero_tenant_id$purchase_order_id)
  41625.             ->then(
  41626.                 function ($response) {
  41627.                     return $response[0];
  41628.                 }
  41629.             );
  41630.     }
  41631.     /**
  41632.      * Operation getPurchaseOrderHistoryAsyncWithHttpInfo
  41633.      * Retrieves history for a specific purchase order
  41634.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  41635.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  41636.      * @throws \InvalidArgumentException
  41637.      * @return \GuzzleHttp\Promise\PromiseInterface */
  41638.     public function getPurchaseOrderHistoryAsyncWithHttpInfo($xero_tenant_id$purchase_order_id)
  41639.     {
  41640.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  41641.         $request $this->getPurchaseOrderHistoryRequest($xero_tenant_id$purchase_order_id);
  41642.         return $this->client
  41643.             ->sendAsync($request$this->createHttpClientOption())
  41644.             ->then(
  41645.                 function ($response) use ($returnType) {
  41646.                     $responseBody $response->getBody();
  41647.                     if ($returnType === '\SplFileObject') {
  41648.                         $content $responseBody//stream goes to serializer
  41649.                     } else {
  41650.                         $content $responseBody->getContents();
  41651.                     }
  41652.                     return [
  41653.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  41654.                         $response->getStatusCode(),
  41655.                         $response->getHeaders()
  41656.                     ];
  41657.                 },
  41658.                 function ($exception) {
  41659.                     $response $exception->getResponse();
  41660.                     $statusCode $response->getStatusCode();
  41661.                     throw new ApiException(
  41662.                         sprintf(
  41663.                             '[%d] Error connecting to the API (%s)',
  41664.                             $statusCode,
  41665.                             $exception->getRequest()->getUri()
  41666.                         ),
  41667.                         $statusCode,
  41668.                         $response->getHeaders(),
  41669.                         $response->getBody()
  41670.                     );
  41671.                 }
  41672.             );
  41673.     }
  41674.     /**
  41675.      * Create request for operation 'getPurchaseOrderHistory'
  41676.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  41677.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  41678.      * @throws \InvalidArgumentException
  41679.      * @return \GuzzleHttp\Psr7\Request  */
  41680.     protected function getPurchaseOrderHistoryRequest($xero_tenant_id$purchase_order_id)
  41681.     {
  41682.         // verify the required parameter 'xero_tenant_id' is set
  41683.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  41684.             throw new \InvalidArgumentException(
  41685.                 'Missing the required parameter $xero_tenant_id when calling getPurchaseOrderHistory'
  41686.             );
  41687.         }
  41688.         // verify the required parameter 'purchase_order_id' is set
  41689.         if ($purchase_order_id === null || (is_array($purchase_order_id) && count($purchase_order_id) === 0)) {
  41690.             throw new \InvalidArgumentException(
  41691.                 'Missing the required parameter $purchase_order_id when calling getPurchaseOrderHistory'
  41692.             );
  41693.         }
  41694.         $resourcePath '/PurchaseOrders/{PurchaseOrderID}/History';
  41695.         $formParams = [];
  41696.         $queryParams = [];
  41697.         $headerParams = [];
  41698.         $httpBody '';
  41699.         $multipart false;
  41700.         // header params
  41701.         if ($xero_tenant_id !== null) {
  41702.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  41703.         }
  41704.         // path params
  41705.         if ($purchase_order_id !== null) {
  41706.             $resourcePath str_replace(
  41707.                 '{' 'PurchaseOrderID' '}',
  41708.                 AccountingObjectSerializer::toPathValue($purchase_order_id),
  41709.                 $resourcePath
  41710.             );
  41711.         }
  41712.         // body params
  41713.         $_tempBody null;
  41714.         if ($multipart) {
  41715.             $headers $this->headerSelector->selectHeadersForMultipart(
  41716.                 ['application/json']
  41717.             );
  41718.         } else {
  41719.             $headers $this->headerSelector->selectHeaders(
  41720.                 ['application/json'],
  41721.                 []
  41722.             );
  41723.         }
  41724.         // for model (json/xml)
  41725.         if (isset($_tempBody)) {
  41726.             // $_tempBody is the method argument, if present
  41727.             if ($headers['Content-Type'] === 'application/json') {
  41728.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  41729.             } else {
  41730.                 $httpBody $_tempBody;
  41731.             }
  41732.         } elseif (count($formParams) > 0) {
  41733.             if ($multipart) {
  41734.                 $multipartContents = [
  41735.                     [
  41736.                         'Content-type' => 'multipart/form-data',
  41737.                     ]
  41738.                 ];
  41739.                 
  41740.                 // for HTTP post (form)
  41741.                 $httpBody = new MultipartStream($multipartContents);
  41742.             } elseif ($headers['Content-Type'] === 'application/json') {
  41743.                 $httpBody \GuzzleHttp\json_encode($formParams);
  41744.             } else {
  41745.                 // for HTTP post (form)
  41746.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  41747.             }
  41748.         }
  41749.         // this endpoint requires OAuth (access token)
  41750.         if ($this->config->getAccessToken() !== null) {
  41751.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  41752.         }
  41753.         $defaultHeaders = [];
  41754.         if ($this->config->getUserAgent()) {
  41755.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  41756.         }
  41757.         $headers array_merge(
  41758.             $defaultHeaders,
  41759.             $headerParams,
  41760.             $headers
  41761.         );
  41762.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  41763.         return new Request(
  41764.             'GET',
  41765.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  41766.             $headers,
  41767.             $httpBody
  41768.         );
  41769.     }
  41770.     /**
  41771.      * Operation getPurchaseOrders
  41772.      * Retrieves purchase orders
  41773.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  41774.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  41775.      * @param  string $status Filter by purchase order status (optional)
  41776.      * @param  string $date_from Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom&#x3D;2015-12-01&amp;DateTo&#x3D;2015-12-31 (optional)
  41777.      * @param  string $date_to Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom&#x3D;2015-12-01&amp;DateTo&#x3D;2015-12-31 (optional)
  41778.      * @param  string $order Order by an any element (optional)
  41779.      * @param  int $page To specify a page, append the page parameter to the URL e.g. ?page&#x3D;1. If there are 100 records in the response you will need to check if there is any more data by fetching the next page e.g ?page&#x3D;2 and continuing this process until no more results are returned. (optional)
  41780.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  41781.      * @throws \InvalidArgumentException
  41782.      * @return \XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders
  41783.      */
  41784.     public function getPurchaseOrders($xero_tenant_id$if_modified_since null$status null$date_from null$date_to null$order null$page null)
  41785.     {
  41786.         list($response) = $this->getPurchaseOrdersWithHttpInfo($xero_tenant_id$if_modified_since$status$date_from$date_to$order$page);
  41787.         return $response;
  41788.     }
  41789.     /**
  41790.      * Operation getPurchaseOrdersWithHttpInfo
  41791.      * Retrieves purchase orders
  41792.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  41793.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  41794.      * @param  string $status Filter by purchase order status (optional)
  41795.      * @param  string $date_from Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom&#x3D;2015-12-01&amp;DateTo&#x3D;2015-12-31 (optional)
  41796.      * @param  string $date_to Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom&#x3D;2015-12-01&amp;DateTo&#x3D;2015-12-31 (optional)
  41797.      * @param  string $order Order by an any element (optional)
  41798.      * @param  int $page To specify a page, append the page parameter to the URL e.g. ?page&#x3D;1. If there are 100 records in the response you will need to check if there is any more data by fetching the next page e.g ?page&#x3D;2 and continuing this process until no more results are returned. (optional)
  41799.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  41800.      * @throws \InvalidArgumentException
  41801.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders, HTTP status code, HTTP response headers (array of strings)
  41802.      */
  41803.     public function getPurchaseOrdersWithHttpInfo($xero_tenant_id$if_modified_since null$status null$date_from null$date_to null$order null$page null)
  41804.     {
  41805.         $request $this->getPurchaseOrdersRequest($xero_tenant_id$if_modified_since$status$date_from$date_to$order$page);
  41806.         try {
  41807.             $options $this->createHttpClientOption();
  41808.             try {
  41809.                 $response $this->client->send($request$options);
  41810.             } catch (RequestException $e) {
  41811.                 throw new ApiException(
  41812.                     "[{$e->getCode()}{$e->getMessage()}",
  41813.                     $e->getCode(),
  41814.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  41815.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  41816.                 );
  41817.             }
  41818.             $statusCode $response->getStatusCode();
  41819.             if ($statusCode 200 || $statusCode 299) {
  41820.                 throw new ApiException(
  41821.                     sprintf(
  41822.                         '[%d] Error connecting to the API (%s)',
  41823.                         $statusCode,
  41824.                         $request->getUri()
  41825.                     ),
  41826.                     $statusCode,
  41827.                     $response->getHeaders(),
  41828.                     $response->getBody()
  41829.                 );
  41830.             }
  41831.             $responseBody $response->getBody();
  41832.             switch($statusCode) {
  41833.                 case 200:
  41834.                     if ('\XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders' === '\SplFileObject') {
  41835.                         $content $responseBody//stream goes to serializer
  41836.                     } else {
  41837.                         $content $responseBody->getContents();
  41838.                     }
  41839.                     return [
  41840.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders', []),
  41841.                         $response->getStatusCode(),
  41842.                         $response->getHeaders()
  41843.                     ];
  41844.             }
  41845.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders';
  41846.             $responseBody $response->getBody();
  41847.             if ($returnType === '\SplFileObject') {
  41848.                 $content $responseBody//stream goes to serializer
  41849.             } else {
  41850.                 $content $responseBody->getContents();
  41851.             }
  41852.             return [
  41853.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  41854.                 $response->getStatusCode(),
  41855.                 $response->getHeaders()
  41856.             ];
  41857.         } catch (ApiException $e) {
  41858.             switch ($e->getCode()) {
  41859.                 case 200:
  41860.                     $data AccountingObjectSerializer::deserialize(
  41861.                         $e->getResponseBody(),
  41862.                         '\XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders',
  41863.                         $e->getResponseHeaders()
  41864.                     );
  41865.                     $e->setResponseObject($data);
  41866.                     break;
  41867.             }
  41868.             throw $e;
  41869.         }
  41870.     }
  41871.     /**
  41872.      * Operation getPurchaseOrdersAsync
  41873.      * Retrieves purchase orders
  41874.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  41875.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  41876.      * @param  string $status Filter by purchase order status (optional)
  41877.      * @param  string $date_from Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom&#x3D;2015-12-01&amp;DateTo&#x3D;2015-12-31 (optional)
  41878.      * @param  string $date_to Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom&#x3D;2015-12-01&amp;DateTo&#x3D;2015-12-31 (optional)
  41879.      * @param  string $order Order by an any element (optional)
  41880.      * @param  int $page To specify a page, append the page parameter to the URL e.g. ?page&#x3D;1. If there are 100 records in the response you will need to check if there is any more data by fetching the next page e.g ?page&#x3D;2 and continuing this process until no more results are returned. (optional)
  41881.      * @throws \InvalidArgumentException
  41882.      * @return \GuzzleHttp\Promise\PromiseInterface
  41883.      */
  41884.     public function getPurchaseOrdersAsync($xero_tenant_id$if_modified_since null$status null$date_from null$date_to null$order null$page null)
  41885.     {
  41886.         return $this->getPurchaseOrdersAsyncWithHttpInfo($xero_tenant_id$if_modified_since$status$date_from$date_to$order$page)
  41887.             ->then(
  41888.                 function ($response) {
  41889.                     return $response[0];
  41890.                 }
  41891.             );
  41892.     }
  41893.     /**
  41894.      * Operation getPurchaseOrdersAsyncWithHttpInfo
  41895.      * Retrieves purchase orders
  41896.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  41897.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  41898.      * @param  string $status Filter by purchase order status (optional)
  41899.      * @param  string $date_from Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom&#x3D;2015-12-01&amp;DateTo&#x3D;2015-12-31 (optional)
  41900.      * @param  string $date_to Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom&#x3D;2015-12-01&amp;DateTo&#x3D;2015-12-31 (optional)
  41901.      * @param  string $order Order by an any element (optional)
  41902.      * @param  int $page To specify a page, append the page parameter to the URL e.g. ?page&#x3D;1. If there are 100 records in the response you will need to check if there is any more data by fetching the next page e.g ?page&#x3D;2 and continuing this process until no more results are returned. (optional)
  41903.      * @throws \InvalidArgumentException
  41904.      * @return \GuzzleHttp\Promise\PromiseInterface */
  41905.     public function getPurchaseOrdersAsyncWithHttpInfo($xero_tenant_id$if_modified_since null$status null$date_from null$date_to null$order null$page null)
  41906.     {
  41907.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders';
  41908.         $request $this->getPurchaseOrdersRequest($xero_tenant_id$if_modified_since$status$date_from$date_to$order$page);
  41909.         return $this->client
  41910.             ->sendAsync($request$this->createHttpClientOption())
  41911.             ->then(
  41912.                 function ($response) use ($returnType) {
  41913.                     $responseBody $response->getBody();
  41914.                     if ($returnType === '\SplFileObject') {
  41915.                         $content $responseBody//stream goes to serializer
  41916.                     } else {
  41917.                         $content $responseBody->getContents();
  41918.                     }
  41919.                     return [
  41920.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  41921.                         $response->getStatusCode(),
  41922.                         $response->getHeaders()
  41923.                     ];
  41924.                 },
  41925.                 function ($exception) {
  41926.                     $response $exception->getResponse();
  41927.                     $statusCode $response->getStatusCode();
  41928.                     throw new ApiException(
  41929.                         sprintf(
  41930.                             '[%d] Error connecting to the API (%s)',
  41931.                             $statusCode,
  41932.                             $exception->getRequest()->getUri()
  41933.                         ),
  41934.                         $statusCode,
  41935.                         $response->getHeaders(),
  41936.                         $response->getBody()
  41937.                     );
  41938.                 }
  41939.             );
  41940.     }
  41941.     /**
  41942.      * Create request for operation 'getPurchaseOrders'
  41943.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  41944.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  41945.      * @param  string $status Filter by purchase order status (optional)
  41946.      * @param  string $date_from Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom&#x3D;2015-12-01&amp;DateTo&#x3D;2015-12-31 (optional)
  41947.      * @param  string $date_to Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom&#x3D;2015-12-01&amp;DateTo&#x3D;2015-12-31 (optional)
  41948.      * @param  string $order Order by an any element (optional)
  41949.      * @param  int $page To specify a page, append the page parameter to the URL e.g. ?page&#x3D;1. If there are 100 records in the response you will need to check if there is any more data by fetching the next page e.g ?page&#x3D;2 and continuing this process until no more results are returned. (optional)
  41950.      * @throws \InvalidArgumentException
  41951.      * @return \GuzzleHttp\Psr7\Request  */
  41952.     protected function getPurchaseOrdersRequest($xero_tenant_id$if_modified_since null$status null$date_from null$date_to null$order null$page null)
  41953.     {
  41954.         // verify the required parameter 'xero_tenant_id' is set
  41955.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  41956.             throw new \InvalidArgumentException(
  41957.                 'Missing the required parameter $xero_tenant_id when calling getPurchaseOrders'
  41958.             );
  41959.         }
  41960.         $resourcePath '/PurchaseOrders';
  41961.         $formParams = [];
  41962.         $queryParams = [];
  41963.         $headerParams = [];
  41964.         $httpBody '';
  41965.         $multipart false;
  41966.         // query params
  41967.         if ($status !== null) {
  41968.             $queryParams['Status'] = AccountingObjectSerializer::toQueryValue($status);
  41969.         }
  41970.         // query params
  41971.         if ($date_from !== null) {
  41972.             $queryParams['DateFrom'] = AccountingObjectSerializer::toQueryValue($date_from);
  41973.         }
  41974.         // query params
  41975.         if ($date_to !== null) {
  41976.             $queryParams['DateTo'] = AccountingObjectSerializer::toQueryValue($date_to);
  41977.         }
  41978.         // query params
  41979.         if ($order !== null) {
  41980.             $queryParams['order'] = AccountingObjectSerializer::toQueryValue($order);
  41981.         }
  41982.         // query params
  41983.         if ($page !== null) {
  41984.             $queryParams['page'] = AccountingObjectSerializer::toQueryValue($page);
  41985.         }
  41986.         // header params
  41987.         if ($xero_tenant_id !== null) {
  41988.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  41989.         }
  41990.         // header params
  41991.         if ($if_modified_since !== null) {
  41992.             $headerParams['If-Modified-Since'] = AccountingObjectSerializer::toHeaderValue($if_modified_since);
  41993.         }
  41994.         // body params
  41995.         $_tempBody null;
  41996.         if ($multipart) {
  41997.             $headers $this->headerSelector->selectHeadersForMultipart(
  41998.                 ['application/json']
  41999.             );
  42000.         } else {
  42001.             $headers $this->headerSelector->selectHeaders(
  42002.                 ['application/json'],
  42003.                 []
  42004.             );
  42005.         }
  42006.         // for model (json/xml)
  42007.         if (isset($_tempBody)) {
  42008.             // $_tempBody is the method argument, if present
  42009.             if ($headers['Content-Type'] === 'application/json') {
  42010.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  42011.             } else {
  42012.                 $httpBody $_tempBody;
  42013.             }
  42014.         } elseif (count($formParams) > 0) {
  42015.             if ($multipart) {
  42016.                 $multipartContents = [
  42017.                     [
  42018.                         'Content-type' => 'multipart/form-data',
  42019.                     ]
  42020.                 ];
  42021.                 
  42022.                 // for HTTP post (form)
  42023.                 $httpBody = new MultipartStream($multipartContents);
  42024.             } elseif ($headers['Content-Type'] === 'application/json') {
  42025.                 $httpBody \GuzzleHttp\json_encode($formParams);
  42026.             } else {
  42027.                 // for HTTP post (form)
  42028.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  42029.             }
  42030.         }
  42031.         // this endpoint requires OAuth (access token)
  42032.         if ($this->config->getAccessToken() !== null) {
  42033.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  42034.         }
  42035.         $defaultHeaders = [];
  42036.         if ($this->config->getUserAgent()) {
  42037.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  42038.         }
  42039.         $headers array_merge(
  42040.             $defaultHeaders,
  42041.             $headerParams,
  42042.             $headers
  42043.         );
  42044.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  42045.         return new Request(
  42046.             'GET',
  42047.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  42048.             $headers,
  42049.             $httpBody
  42050.         );
  42051.     }
  42052.     /**
  42053.      * Operation getQuote
  42054.      * Retrieves a specific quote using a unique quote Id
  42055.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  42056.      * @param  string $quote_id Unique identifier for an Quote (required)
  42057.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  42058.      * @throws \InvalidArgumentException
  42059.      * @return \XeroAPI\XeroPHP\Models\Accounting\Quotes
  42060.      */
  42061.     public function getQuote($xero_tenant_id$quote_id)
  42062.     {
  42063.         list($response) = $this->getQuoteWithHttpInfo($xero_tenant_id$quote_id);
  42064.         return $response;
  42065.     }
  42066.     /**
  42067.      * Operation getQuoteWithHttpInfo
  42068.      * Retrieves a specific quote using a unique quote Id
  42069.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  42070.      * @param  string $quote_id Unique identifier for an Quote (required)
  42071.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  42072.      * @throws \InvalidArgumentException
  42073.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Quotes, HTTP status code, HTTP response headers (array of strings)
  42074.      */
  42075.     public function getQuoteWithHttpInfo($xero_tenant_id$quote_id)
  42076.     {
  42077.         $request $this->getQuoteRequest($xero_tenant_id$quote_id);
  42078.         try {
  42079.             $options $this->createHttpClientOption();
  42080.             try {
  42081.                 $response $this->client->send($request$options);
  42082.             } catch (RequestException $e) {
  42083.                 throw new ApiException(
  42084.                     "[{$e->getCode()}{$e->getMessage()}",
  42085.                     $e->getCode(),
  42086.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  42087.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  42088.                 );
  42089.             }
  42090.             $statusCode $response->getStatusCode();
  42091.             if ($statusCode 200 || $statusCode 299) {
  42092.                 throw new ApiException(
  42093.                     sprintf(
  42094.                         '[%d] Error connecting to the API (%s)',
  42095.                         $statusCode,
  42096.                         $request->getUri()
  42097.                     ),
  42098.                     $statusCode,
  42099.                     $response->getHeaders(),
  42100.                     $response->getBody()
  42101.                 );
  42102.             }
  42103.             $responseBody $response->getBody();
  42104.             switch($statusCode) {
  42105.                 case 200:
  42106.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Quotes' === '\SplFileObject') {
  42107.                         $content $responseBody//stream goes to serializer
  42108.                     } else {
  42109.                         $content $responseBody->getContents();
  42110.                     }
  42111.                     return [
  42112.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Quotes', []),
  42113.                         $response->getStatusCode(),
  42114.                         $response->getHeaders()
  42115.                     ];
  42116.             }
  42117.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Quotes';
  42118.             $responseBody $response->getBody();
  42119.             if ($returnType === '\SplFileObject') {
  42120.                 $content $responseBody//stream goes to serializer
  42121.             } else {
  42122.                 $content $responseBody->getContents();
  42123.             }
  42124.             return [
  42125.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  42126.                 $response->getStatusCode(),
  42127.                 $response->getHeaders()
  42128.             ];
  42129.         } catch (ApiException $e) {
  42130.             switch ($e->getCode()) {
  42131.                 case 200:
  42132.                     $data AccountingObjectSerializer::deserialize(
  42133.                         $e->getResponseBody(),
  42134.                         '\XeroAPI\XeroPHP\Models\Accounting\Quotes',
  42135.                         $e->getResponseHeaders()
  42136.                     );
  42137.                     $e->setResponseObject($data);
  42138.                     break;
  42139.             }
  42140.             throw $e;
  42141.         }
  42142.     }
  42143.     /**
  42144.      * Operation getQuoteAsync
  42145.      * Retrieves a specific quote using a unique quote Id
  42146.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  42147.      * @param  string $quote_id Unique identifier for an Quote (required)
  42148.      * @throws \InvalidArgumentException
  42149.      * @return \GuzzleHttp\Promise\PromiseInterface
  42150.      */
  42151.     public function getQuoteAsync($xero_tenant_id$quote_id)
  42152.     {
  42153.         return $this->getQuoteAsyncWithHttpInfo($xero_tenant_id$quote_id)
  42154.             ->then(
  42155.                 function ($response) {
  42156.                     return $response[0];
  42157.                 }
  42158.             );
  42159.     }
  42160.     /**
  42161.      * Operation getQuoteAsyncWithHttpInfo
  42162.      * Retrieves a specific quote using a unique quote Id
  42163.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  42164.      * @param  string $quote_id Unique identifier for an Quote (required)
  42165.      * @throws \InvalidArgumentException
  42166.      * @return \GuzzleHttp\Promise\PromiseInterface */
  42167.     public function getQuoteAsyncWithHttpInfo($xero_tenant_id$quote_id)
  42168.     {
  42169.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Quotes';
  42170.         $request $this->getQuoteRequest($xero_tenant_id$quote_id);
  42171.         return $this->client
  42172.             ->sendAsync($request$this->createHttpClientOption())
  42173.             ->then(
  42174.                 function ($response) use ($returnType) {
  42175.                     $responseBody $response->getBody();
  42176.                     if ($returnType === '\SplFileObject') {
  42177.                         $content $responseBody//stream goes to serializer
  42178.                     } else {
  42179.                         $content $responseBody->getContents();
  42180.                     }
  42181.                     return [
  42182.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  42183.                         $response->getStatusCode(),
  42184.                         $response->getHeaders()
  42185.                     ];
  42186.                 },
  42187.                 function ($exception) {
  42188.                     $response $exception->getResponse();
  42189.                     $statusCode $response->getStatusCode();
  42190.                     throw new ApiException(
  42191.                         sprintf(
  42192.                             '[%d] Error connecting to the API (%s)',
  42193.                             $statusCode,
  42194.                             $exception->getRequest()->getUri()
  42195.                         ),
  42196.                         $statusCode,
  42197.                         $response->getHeaders(),
  42198.                         $response->getBody()
  42199.                     );
  42200.                 }
  42201.             );
  42202.     }
  42203.     /**
  42204.      * Create request for operation 'getQuote'
  42205.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  42206.      * @param  string $quote_id Unique identifier for an Quote (required)
  42207.      * @throws \InvalidArgumentException
  42208.      * @return \GuzzleHttp\Psr7\Request  */
  42209.     protected function getQuoteRequest($xero_tenant_id$quote_id)
  42210.     {
  42211.         // verify the required parameter 'xero_tenant_id' is set
  42212.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  42213.             throw new \InvalidArgumentException(
  42214.                 'Missing the required parameter $xero_tenant_id when calling getQuote'
  42215.             );
  42216.         }
  42217.         // verify the required parameter 'quote_id' is set
  42218.         if ($quote_id === null || (is_array($quote_id) && count($quote_id) === 0)) {
  42219.             throw new \InvalidArgumentException(
  42220.                 'Missing the required parameter $quote_id when calling getQuote'
  42221.             );
  42222.         }
  42223.         $resourcePath '/Quotes/{QuoteID}';
  42224.         $formParams = [];
  42225.         $queryParams = [];
  42226.         $headerParams = [];
  42227.         $httpBody '';
  42228.         $multipart false;
  42229.         // header params
  42230.         if ($xero_tenant_id !== null) {
  42231.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  42232.         }
  42233.         // path params
  42234.         if ($quote_id !== null) {
  42235.             $resourcePath str_replace(
  42236.                 '{' 'QuoteID' '}',
  42237.                 AccountingObjectSerializer::toPathValue($quote_id),
  42238.                 $resourcePath
  42239.             );
  42240.         }
  42241.         // body params
  42242.         $_tempBody null;
  42243.         if ($multipart) {
  42244.             $headers $this->headerSelector->selectHeadersForMultipart(
  42245.                 ['application/json']
  42246.             );
  42247.         } else {
  42248.             $headers $this->headerSelector->selectHeaders(
  42249.                 ['application/json'],
  42250.                 []
  42251.             );
  42252.         }
  42253.         // for model (json/xml)
  42254.         if (isset($_tempBody)) {
  42255.             // $_tempBody is the method argument, if present
  42256.             if ($headers['Content-Type'] === 'application/json') {
  42257.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  42258.             } else {
  42259.                 $httpBody $_tempBody;
  42260.             }
  42261.         } elseif (count($formParams) > 0) {
  42262.             if ($multipart) {
  42263.                 $multipartContents = [
  42264.                     [
  42265.                         'Content-type' => 'multipart/form-data',
  42266.                     ]
  42267.                 ];
  42268.                 
  42269.                 // for HTTP post (form)
  42270.                 $httpBody = new MultipartStream($multipartContents);
  42271.             } elseif ($headers['Content-Type'] === 'application/json') {
  42272.                 $httpBody \GuzzleHttp\json_encode($formParams);
  42273.             } else {
  42274.                 // for HTTP post (form)
  42275.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  42276.             }
  42277.         }
  42278.         // this endpoint requires OAuth (access token)
  42279.         if ($this->config->getAccessToken() !== null) {
  42280.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  42281.         }
  42282.         $defaultHeaders = [];
  42283.         if ($this->config->getUserAgent()) {
  42284.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  42285.         }
  42286.         $headers array_merge(
  42287.             $defaultHeaders,
  42288.             $headerParams,
  42289.             $headers
  42290.         );
  42291.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  42292.         return new Request(
  42293.             'GET',
  42294.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  42295.             $headers,
  42296.             $httpBody
  42297.         );
  42298.     }
  42299.     /**
  42300.      * Operation getQuoteAsPdf
  42301.      * Retrieves a specific quote as a PDF file using a unique quote Id
  42302.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  42303.      * @param  string $quote_id Unique identifier for an Quote (required)
  42304.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  42305.      * @throws \InvalidArgumentException
  42306.      * @return \SplFileObject
  42307.      */
  42308.     public function getQuoteAsPdf($xero_tenant_id$quote_id)
  42309.     {
  42310.         list($response) = $this->getQuoteAsPdfWithHttpInfo($xero_tenant_id$quote_id);
  42311.         return $response;
  42312.     }
  42313.     /**
  42314.      * Operation getQuoteAsPdfWithHttpInfo
  42315.      * Retrieves a specific quote as a PDF file using a unique quote Id
  42316.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  42317.      * @param  string $quote_id Unique identifier for an Quote (required)
  42318.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  42319.      * @throws \InvalidArgumentException
  42320.      * @return array of \SplFileObject, HTTP status code, HTTP response headers (array of strings)
  42321.      */
  42322.     public function getQuoteAsPdfWithHttpInfo($xero_tenant_id$quote_id)
  42323.     {
  42324.         $request $this->getQuoteAsPdfRequest($xero_tenant_id$quote_id);
  42325.         try {
  42326.             $options $this->createHttpClientOption();
  42327.             try {
  42328.                 $response $this->client->send($request$options);
  42329.             } catch (RequestException $e) {
  42330.                 throw new ApiException(
  42331.                     "[{$e->getCode()}{$e->getMessage()}",
  42332.                     $e->getCode(),
  42333.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  42334.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  42335.                 );
  42336.             }
  42337.             $statusCode $response->getStatusCode();
  42338.             if ($statusCode 200 || $statusCode 299) {
  42339.                 throw new ApiException(
  42340.                     sprintf(
  42341.                         '[%d] Error connecting to the API (%s)',
  42342.                         $statusCode,
  42343.                         $request->getUri()
  42344.                     ),
  42345.                     $statusCode,
  42346.                     $response->getHeaders(),
  42347.                     $response->getBody()
  42348.                 );
  42349.             }
  42350.             $responseBody $response->getBody();
  42351.             switch($statusCode) {
  42352.                 case 200:
  42353.                     if ('\SplFileObject' === '\SplFileObject') {
  42354.                         $content $responseBody//stream goes to serializer
  42355.                     } else {
  42356.                         $content $responseBody->getContents();
  42357.                     }
  42358.                     return [
  42359.                         AccountingObjectSerializer::deserialize($content'\SplFileObject', []),
  42360.                         $response->getStatusCode(),
  42361.                         $response->getHeaders()
  42362.                     ];
  42363.             }
  42364.             $returnType '\SplFileObject';
  42365.             $responseBody $response->getBody();
  42366.             if ($returnType === '\SplFileObject') {
  42367.                 $content $responseBody//stream goes to serializer
  42368.             } else {
  42369.                 $content $responseBody->getContents();
  42370.             }
  42371.             return [
  42372.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  42373.                 $response->getStatusCode(),
  42374.                 $response->getHeaders()
  42375.             ];
  42376.         } catch (ApiException $e) {
  42377.             switch ($e->getCode()) {
  42378.                 case 200:
  42379.                     $data AccountingObjectSerializer::deserialize(
  42380.                         $e->getResponseBody(),
  42381.                         '\SplFileObject',
  42382.                         $e->getResponseHeaders()
  42383.                     );
  42384.                     $e->setResponseObject($data);
  42385.                     break;
  42386.             }
  42387.             throw $e;
  42388.         }
  42389.     }
  42390.     /**
  42391.      * Operation getQuoteAsPdfAsync
  42392.      * Retrieves a specific quote as a PDF file using a unique quote Id
  42393.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  42394.      * @param  string $quote_id Unique identifier for an Quote (required)
  42395.      * @throws \InvalidArgumentException
  42396.      * @return \GuzzleHttp\Promise\PromiseInterface
  42397.      */
  42398.     public function getQuoteAsPdfAsync($xero_tenant_id$quote_id)
  42399.     {
  42400.         return $this->getQuoteAsPdfAsyncWithHttpInfo($xero_tenant_id$quote_id)
  42401.             ->then(
  42402.                 function ($response) {
  42403.                     return $response[0];
  42404.                 }
  42405.             );
  42406.     }
  42407.     /**
  42408.      * Operation getQuoteAsPdfAsyncWithHttpInfo
  42409.      * Retrieves a specific quote as a PDF file using a unique quote Id
  42410.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  42411.      * @param  string $quote_id Unique identifier for an Quote (required)
  42412.      * @throws \InvalidArgumentException
  42413.      * @return \GuzzleHttp\Promise\PromiseInterface */
  42414.     public function getQuoteAsPdfAsyncWithHttpInfo($xero_tenant_id$quote_id)
  42415.     {
  42416.         $returnType '\SplFileObject';
  42417.         $request $this->getQuoteAsPdfRequest($xero_tenant_id$quote_id);
  42418.         return $this->client
  42419.             ->sendAsync($request$this->createHttpClientOption())
  42420.             ->then(
  42421.                 function ($response) use ($returnType) {
  42422.                     $responseBody $response->getBody();
  42423.                     if ($returnType === '\SplFileObject') {
  42424.                         $content $responseBody//stream goes to serializer
  42425.                     } else {
  42426.                         $content $responseBody->getContents();
  42427.                     }
  42428.                     return [
  42429.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  42430.                         $response->getStatusCode(),
  42431.                         $response->getHeaders()
  42432.                     ];
  42433.                 },
  42434.                 function ($exception) {
  42435.                     $response $exception->getResponse();
  42436.                     $statusCode $response->getStatusCode();
  42437.                     throw new ApiException(
  42438.                         sprintf(
  42439.                             '[%d] Error connecting to the API (%s)',
  42440.                             $statusCode,
  42441.                             $exception->getRequest()->getUri()
  42442.                         ),
  42443.                         $statusCode,
  42444.                         $response->getHeaders(),
  42445.                         $response->getBody()
  42446.                     );
  42447.                 }
  42448.             );
  42449.     }
  42450.     /**
  42451.      * Create request for operation 'getQuoteAsPdf'
  42452.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  42453.      * @param  string $quote_id Unique identifier for an Quote (required)
  42454.      * @throws \InvalidArgumentException
  42455.      * @return \GuzzleHttp\Psr7\Request  */
  42456.     protected function getQuoteAsPdfRequest($xero_tenant_id$quote_id)
  42457.     {
  42458.         // verify the required parameter 'xero_tenant_id' is set
  42459.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  42460.             throw new \InvalidArgumentException(
  42461.                 'Missing the required parameter $xero_tenant_id when calling getQuoteAsPdf'
  42462.             );
  42463.         }
  42464.         // verify the required parameter 'quote_id' is set
  42465.         if ($quote_id === null || (is_array($quote_id) && count($quote_id) === 0)) {
  42466.             throw new \InvalidArgumentException(
  42467.                 'Missing the required parameter $quote_id when calling getQuoteAsPdf'
  42468.             );
  42469.         }
  42470.         $resourcePath '/Quotes/{QuoteID}';
  42471.         $formParams = [];
  42472.         $queryParams = [];
  42473.         $headerParams = [];
  42474.         $httpBody '';
  42475.         $multipart false;
  42476.         // header params
  42477.         if ($xero_tenant_id !== null) {
  42478.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  42479.         }
  42480.         // path params
  42481.         if ($quote_id !== null) {
  42482.             $resourcePath str_replace(
  42483.                 '{' 'QuoteID' '}',
  42484.                 AccountingObjectSerializer::toPathValue($quote_id),
  42485.                 $resourcePath
  42486.             );
  42487.         }
  42488.         // body params
  42489.         $_tempBody null;
  42490.         if ($multipart) {
  42491.             $headers $this->headerSelector->selectHeadersForMultipart(
  42492.                 ['application/pdf']
  42493.             );
  42494.         } else {
  42495.             $headers $this->headerSelector->selectHeaders(
  42496.                 ['application/pdf'],
  42497.                 []
  42498.             );
  42499.         }
  42500.         // for model (json/xml)
  42501.         if (isset($_tempBody)) {
  42502.             // $_tempBody is the method argument, if present
  42503.             if ($headers['Content-Type'] === 'application/json') {
  42504.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  42505.             } else {
  42506.                 $httpBody $_tempBody;
  42507.             }
  42508.         } elseif (count($formParams) > 0) {
  42509.             if ($multipart) {
  42510.                 $multipartContents = [
  42511.                     [
  42512.                         'Content-type' => 'multipart/form-data',
  42513.                     ]
  42514.                 ];
  42515.                 
  42516.                 // for HTTP post (form)
  42517.                 $httpBody = new MultipartStream($multipartContents);
  42518.             } elseif ($headers['Content-Type'] === 'application/json') {
  42519.                 $httpBody \GuzzleHttp\json_encode($formParams);
  42520.             } else {
  42521.                 // for HTTP post (form)
  42522.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  42523.             }
  42524.         }
  42525.         // this endpoint requires OAuth (access token)
  42526.         if ($this->config->getAccessToken() !== null) {
  42527.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  42528.         }
  42529.         $defaultHeaders = [];
  42530.         if ($this->config->getUserAgent()) {
  42531.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  42532.         }
  42533.         $headers array_merge(
  42534.             $defaultHeaders,
  42535.             $headerParams,
  42536.             $headers
  42537.         );
  42538.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  42539.         return new Request(
  42540.             'GET',
  42541.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  42542.             $headers,
  42543.             $httpBody
  42544.         );
  42545.     }
  42546.     /**
  42547.      * Operation getQuoteAttachmentByFileName
  42548.      * Retrieves a specific attachment from a specific quote by filename
  42549.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  42550.      * @param  string $quote_id Unique identifier for an Quote (required)
  42551.      * @param  string $file_name Name of the attachment (required)
  42552.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  42553.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  42554.      * @throws \InvalidArgumentException
  42555.      * @return \SplFileObject
  42556.      */
  42557.     public function getQuoteAttachmentByFileName($xero_tenant_id$quote_id$file_name$content_type)
  42558.     {
  42559.         list($response) = $this->getQuoteAttachmentByFileNameWithHttpInfo($xero_tenant_id$quote_id$file_name$content_type);
  42560.         return $response;
  42561.     }
  42562.     /**
  42563.      * Operation getQuoteAttachmentByFileNameWithHttpInfo
  42564.      * Retrieves a specific attachment from a specific quote by filename
  42565.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  42566.      * @param  string $quote_id Unique identifier for an Quote (required)
  42567.      * @param  string $file_name Name of the attachment (required)
  42568.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  42569.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  42570.      * @throws \InvalidArgumentException
  42571.      * @return array of \SplFileObject, HTTP status code, HTTP response headers (array of strings)
  42572.      */
  42573.     public function getQuoteAttachmentByFileNameWithHttpInfo($xero_tenant_id$quote_id$file_name$content_type)
  42574.     {
  42575.         $request $this->getQuoteAttachmentByFileNameRequest($xero_tenant_id$quote_id$file_name$content_type);
  42576.         try {
  42577.             $options $this->createHttpClientOption();
  42578.             try {
  42579.                 $response $this->client->send($request$options);
  42580.             } catch (RequestException $e) {
  42581.                 throw new ApiException(
  42582.                     "[{$e->getCode()}{$e->getMessage()}",
  42583.                     $e->getCode(),
  42584.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  42585.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  42586.                 );
  42587.             }
  42588.             $statusCode $response->getStatusCode();
  42589.             if ($statusCode 200 || $statusCode 299) {
  42590.                 throw new ApiException(
  42591.                     sprintf(
  42592.                         '[%d] Error connecting to the API (%s)',
  42593.                         $statusCode,
  42594.                         $request->getUri()
  42595.                     ),
  42596.                     $statusCode,
  42597.                     $response->getHeaders(),
  42598.                     $response->getBody()
  42599.                 );
  42600.             }
  42601.             $responseBody $response->getBody();
  42602.             switch($statusCode) {
  42603.                 case 200:
  42604.                     if ('\SplFileObject' === '\SplFileObject') {
  42605.                         $content $responseBody//stream goes to serializer
  42606.                     } else {
  42607.                         $content $responseBody->getContents();
  42608.                     }
  42609.                     return [
  42610.                         AccountingObjectSerializer::deserialize($content'\SplFileObject', []),
  42611.                         $response->getStatusCode(),
  42612.                         $response->getHeaders()
  42613.                     ];
  42614.             }
  42615.             $returnType '\SplFileObject';
  42616.             $responseBody $response->getBody();
  42617.             if ($returnType === '\SplFileObject') {
  42618.                 $content $responseBody//stream goes to serializer
  42619.             } else {
  42620.                 $content $responseBody->getContents();
  42621.             }
  42622.             return [
  42623.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  42624.                 $response->getStatusCode(),
  42625.                 $response->getHeaders()
  42626.             ];
  42627.         } catch (ApiException $e) {
  42628.             switch ($e->getCode()) {
  42629.                 case 200:
  42630.                     $data AccountingObjectSerializer::deserialize(
  42631.                         $e->getResponseBody(),
  42632.                         '\SplFileObject',
  42633.                         $e->getResponseHeaders()
  42634.                     );
  42635.                     $e->setResponseObject($data);
  42636.                     break;
  42637.             }
  42638.             throw $e;
  42639.         }
  42640.     }
  42641.     /**
  42642.      * Operation getQuoteAttachmentByFileNameAsync
  42643.      * Retrieves a specific attachment from a specific quote by filename
  42644.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  42645.      * @param  string $quote_id Unique identifier for an Quote (required)
  42646.      * @param  string $file_name Name of the attachment (required)
  42647.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  42648.      * @throws \InvalidArgumentException
  42649.      * @return \GuzzleHttp\Promise\PromiseInterface
  42650.      */
  42651.     public function getQuoteAttachmentByFileNameAsync($xero_tenant_id$quote_id$file_name$content_type)
  42652.     {
  42653.         return $this->getQuoteAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$quote_id$file_name$content_type)
  42654.             ->then(
  42655.                 function ($response) {
  42656.                     return $response[0];
  42657.                 }
  42658.             );
  42659.     }
  42660.     /**
  42661.      * Operation getQuoteAttachmentByFileNameAsyncWithHttpInfo
  42662.      * Retrieves a specific attachment from a specific quote by filename
  42663.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  42664.      * @param  string $quote_id Unique identifier for an Quote (required)
  42665.      * @param  string $file_name Name of the attachment (required)
  42666.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  42667.      * @throws \InvalidArgumentException
  42668.      * @return \GuzzleHttp\Promise\PromiseInterface */
  42669.     public function getQuoteAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$quote_id$file_name$content_type)
  42670.     {
  42671.         $returnType '\SplFileObject';
  42672.         $request $this->getQuoteAttachmentByFileNameRequest($xero_tenant_id$quote_id$file_name$content_type);
  42673.         return $this->client
  42674.             ->sendAsync($request$this->createHttpClientOption())
  42675.             ->then(
  42676.                 function ($response) use ($returnType) {
  42677.                     $responseBody $response->getBody();
  42678.                     if ($returnType === '\SplFileObject') {
  42679.                         $content $responseBody//stream goes to serializer
  42680.                     } else {
  42681.                         $content $responseBody->getContents();
  42682.                     }
  42683.                     return [
  42684.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  42685.                         $response->getStatusCode(),
  42686.                         $response->getHeaders()
  42687.                     ];
  42688.                 },
  42689.                 function ($exception) {
  42690.                     $response $exception->getResponse();
  42691.                     $statusCode $response->getStatusCode();
  42692.                     throw new ApiException(
  42693.                         sprintf(
  42694.                             '[%d] Error connecting to the API (%s)',
  42695.                             $statusCode,
  42696.                             $exception->getRequest()->getUri()
  42697.                         ),
  42698.                         $statusCode,
  42699.                         $response->getHeaders(),
  42700.                         $response->getBody()
  42701.                     );
  42702.                 }
  42703.             );
  42704.     }
  42705.     /**
  42706.      * Create request for operation 'getQuoteAttachmentByFileName'
  42707.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  42708.      * @param  string $quote_id Unique identifier for an Quote (required)
  42709.      * @param  string $file_name Name of the attachment (required)
  42710.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  42711.      * @throws \InvalidArgumentException
  42712.      * @return \GuzzleHttp\Psr7\Request  */
  42713.     protected function getQuoteAttachmentByFileNameRequest($xero_tenant_id$quote_id$file_name$content_type)
  42714.     {
  42715.         // verify the required parameter 'xero_tenant_id' is set
  42716.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  42717.             throw new \InvalidArgumentException(
  42718.                 'Missing the required parameter $xero_tenant_id when calling getQuoteAttachmentByFileName'
  42719.             );
  42720.         }
  42721.         // verify the required parameter 'quote_id' is set
  42722.         if ($quote_id === null || (is_array($quote_id) && count($quote_id) === 0)) {
  42723.             throw new \InvalidArgumentException(
  42724.                 'Missing the required parameter $quote_id when calling getQuoteAttachmentByFileName'
  42725.             );
  42726.         }
  42727.         // verify the required parameter 'file_name' is set
  42728.         if ($file_name === null || (is_array($file_name) && count($file_name) === 0)) {
  42729.             throw new \InvalidArgumentException(
  42730.                 'Missing the required parameter $file_name when calling getQuoteAttachmentByFileName'
  42731.             );
  42732.         }
  42733.         // verify the required parameter 'content_type' is set
  42734.         if ($content_type === null || (is_array($content_type) && count($content_type) === 0)) {
  42735.             throw new \InvalidArgumentException(
  42736.                 'Missing the required parameter $content_type when calling getQuoteAttachmentByFileName'
  42737.             );
  42738.         }
  42739.         $resourcePath '/Quotes/{QuoteID}/Attachments/{FileName}';
  42740.         $formParams = [];
  42741.         $queryParams = [];
  42742.         $headerParams = [];
  42743.         $httpBody '';
  42744.         $multipart false;
  42745.         // header params
  42746.         if ($xero_tenant_id !== null) {
  42747.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  42748.         }
  42749.         // header params
  42750.         if ($content_type !== null) {
  42751.             $headerParams['contentType'] = AccountingObjectSerializer::toHeaderValue($content_type);
  42752.         }
  42753.         // path params
  42754.         if ($quote_id !== null) {
  42755.             $resourcePath str_replace(
  42756.                 '{' 'QuoteID' '}',
  42757.                 AccountingObjectSerializer::toPathValue($quote_id),
  42758.                 $resourcePath
  42759.             );
  42760.         }
  42761.         // path params
  42762.         if ($file_name !== null) {
  42763.             $resourcePath str_replace(
  42764.                 '{' 'FileName' '}',
  42765.                 AccountingObjectSerializer::toPathValue($file_name),
  42766.                 $resourcePath
  42767.             );
  42768.         }
  42769.         // body params
  42770.         $_tempBody null;
  42771.         if ($multipart) {
  42772.             $headers $this->headerSelector->selectHeadersForMultipart(
  42773.                 ['application/octet-stream']
  42774.             );
  42775.         } else {
  42776.             $headers $this->headerSelector->selectHeaders(
  42777.                 ['application/octet-stream'],
  42778.                 []
  42779.             );
  42780.         }
  42781.         // for model (json/xml)
  42782.         if (isset($_tempBody)) {
  42783.             // $_tempBody is the method argument, if present
  42784.             if ($headers['Content-Type'] === 'application/json') {
  42785.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  42786.             } else {
  42787.                 $httpBody $_tempBody;
  42788.             }
  42789.         } elseif (count($formParams) > 0) {
  42790.             if ($multipart) {
  42791.                 $multipartContents = [
  42792.                     [
  42793.                         'Content-type' => 'multipart/form-data',
  42794.                     ]
  42795.                 ];
  42796.                 
  42797.                 // for HTTP post (form)
  42798.                 $httpBody = new MultipartStream($multipartContents);
  42799.             } elseif ($headers['Content-Type'] === 'application/json') {
  42800.                 $httpBody \GuzzleHttp\json_encode($formParams);
  42801.             } else {
  42802.                 // for HTTP post (form)
  42803.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  42804.             }
  42805.         }
  42806.         // this endpoint requires OAuth (access token)
  42807.         if ($this->config->getAccessToken() !== null) {
  42808.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  42809.         }
  42810.         $defaultHeaders = [];
  42811.         if ($this->config->getUserAgent()) {
  42812.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  42813.         }
  42814.         $headers array_merge(
  42815.             $defaultHeaders,
  42816.             $headerParams,
  42817.             $headers
  42818.         );
  42819.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  42820.         return new Request(
  42821.             'GET',
  42822.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  42823.             $headers,
  42824.             $httpBody
  42825.         );
  42826.     }
  42827.     /**
  42828.      * Operation getQuoteAttachmentById
  42829.      * Retrieves a specific attachment from a specific quote using a unique attachment Id
  42830.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  42831.      * @param  string $quote_id Unique identifier for an Quote (required)
  42832.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  42833.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  42834.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  42835.      * @throws \InvalidArgumentException
  42836.      * @return \SplFileObject
  42837.      */
  42838.     public function getQuoteAttachmentById($xero_tenant_id$quote_id$attachment_id$content_type)
  42839.     {
  42840.         list($response) = $this->getQuoteAttachmentByIdWithHttpInfo($xero_tenant_id$quote_id$attachment_id$content_type);
  42841.         return $response;
  42842.     }
  42843.     /**
  42844.      * Operation getQuoteAttachmentByIdWithHttpInfo
  42845.      * Retrieves a specific attachment from a specific quote using a unique attachment Id
  42846.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  42847.      * @param  string $quote_id Unique identifier for an Quote (required)
  42848.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  42849.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  42850.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  42851.      * @throws \InvalidArgumentException
  42852.      * @return array of \SplFileObject, HTTP status code, HTTP response headers (array of strings)
  42853.      */
  42854.     public function getQuoteAttachmentByIdWithHttpInfo($xero_tenant_id$quote_id$attachment_id$content_type)
  42855.     {
  42856.         $request $this->getQuoteAttachmentByIdRequest($xero_tenant_id$quote_id$attachment_id$content_type);
  42857.         try {
  42858.             $options $this->createHttpClientOption();
  42859.             try {
  42860.                 $response $this->client->send($request$options);
  42861.             } catch (RequestException $e) {
  42862.                 throw new ApiException(
  42863.                     "[{$e->getCode()}{$e->getMessage()}",
  42864.                     $e->getCode(),
  42865.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  42866.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  42867.                 );
  42868.             }
  42869.             $statusCode $response->getStatusCode();
  42870.             if ($statusCode 200 || $statusCode 299) {
  42871.                 throw new ApiException(
  42872.                     sprintf(
  42873.                         '[%d] Error connecting to the API (%s)',
  42874.                         $statusCode,
  42875.                         $request->getUri()
  42876.                     ),
  42877.                     $statusCode,
  42878.                     $response->getHeaders(),
  42879.                     $response->getBody()
  42880.                 );
  42881.             }
  42882.             $responseBody $response->getBody();
  42883.             switch($statusCode) {
  42884.                 case 200:
  42885.                     if ('\SplFileObject' === '\SplFileObject') {
  42886.                         $content $responseBody//stream goes to serializer
  42887.                     } else {
  42888.                         $content $responseBody->getContents();
  42889.                     }
  42890.                     return [
  42891.                         AccountingObjectSerializer::deserialize($content'\SplFileObject', []),
  42892.                         $response->getStatusCode(),
  42893.                         $response->getHeaders()
  42894.                     ];
  42895.             }
  42896.             $returnType '\SplFileObject';
  42897.             $responseBody $response->getBody();
  42898.             if ($returnType === '\SplFileObject') {
  42899.                 $content $responseBody//stream goes to serializer
  42900.             } else {
  42901.                 $content $responseBody->getContents();
  42902.             }
  42903.             return [
  42904.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  42905.                 $response->getStatusCode(),
  42906.                 $response->getHeaders()
  42907.             ];
  42908.         } catch (ApiException $e) {
  42909.             switch ($e->getCode()) {
  42910.                 case 200:
  42911.                     $data AccountingObjectSerializer::deserialize(
  42912.                         $e->getResponseBody(),
  42913.                         '\SplFileObject',
  42914.                         $e->getResponseHeaders()
  42915.                     );
  42916.                     $e->setResponseObject($data);
  42917.                     break;
  42918.             }
  42919.             throw $e;
  42920.         }
  42921.     }
  42922.     /**
  42923.      * Operation getQuoteAttachmentByIdAsync
  42924.      * Retrieves a specific attachment from a specific quote using a unique attachment Id
  42925.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  42926.      * @param  string $quote_id Unique identifier for an Quote (required)
  42927.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  42928.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  42929.      * @throws \InvalidArgumentException
  42930.      * @return \GuzzleHttp\Promise\PromiseInterface
  42931.      */
  42932.     public function getQuoteAttachmentByIdAsync($xero_tenant_id$quote_id$attachment_id$content_type)
  42933.     {
  42934.         return $this->getQuoteAttachmentByIdAsyncWithHttpInfo($xero_tenant_id$quote_id$attachment_id$content_type)
  42935.             ->then(
  42936.                 function ($response) {
  42937.                     return $response[0];
  42938.                 }
  42939.             );
  42940.     }
  42941.     /**
  42942.      * Operation getQuoteAttachmentByIdAsyncWithHttpInfo
  42943.      * Retrieves a specific attachment from a specific quote using a unique attachment Id
  42944.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  42945.      * @param  string $quote_id Unique identifier for an Quote (required)
  42946.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  42947.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  42948.      * @throws \InvalidArgumentException
  42949.      * @return \GuzzleHttp\Promise\PromiseInterface */
  42950.     public function getQuoteAttachmentByIdAsyncWithHttpInfo($xero_tenant_id$quote_id$attachment_id$content_type)
  42951.     {
  42952.         $returnType '\SplFileObject';
  42953.         $request $this->getQuoteAttachmentByIdRequest($xero_tenant_id$quote_id$attachment_id$content_type);
  42954.         return $this->client
  42955.             ->sendAsync($request$this->createHttpClientOption())
  42956.             ->then(
  42957.                 function ($response) use ($returnType) {
  42958.                     $responseBody $response->getBody();
  42959.                     if ($returnType === '\SplFileObject') {
  42960.                         $content $responseBody//stream goes to serializer
  42961.                     } else {
  42962.                         $content $responseBody->getContents();
  42963.                     }
  42964.                     return [
  42965.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  42966.                         $response->getStatusCode(),
  42967.                         $response->getHeaders()
  42968.                     ];
  42969.                 },
  42970.                 function ($exception) {
  42971.                     $response $exception->getResponse();
  42972.                     $statusCode $response->getStatusCode();
  42973.                     throw new ApiException(
  42974.                         sprintf(
  42975.                             '[%d] Error connecting to the API (%s)',
  42976.                             $statusCode,
  42977.                             $exception->getRequest()->getUri()
  42978.                         ),
  42979.                         $statusCode,
  42980.                         $response->getHeaders(),
  42981.                         $response->getBody()
  42982.                     );
  42983.                 }
  42984.             );
  42985.     }
  42986.     /**
  42987.      * Create request for operation 'getQuoteAttachmentById'
  42988.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  42989.      * @param  string $quote_id Unique identifier for an Quote (required)
  42990.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  42991.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  42992.      * @throws \InvalidArgumentException
  42993.      * @return \GuzzleHttp\Psr7\Request  */
  42994.     protected function getQuoteAttachmentByIdRequest($xero_tenant_id$quote_id$attachment_id$content_type)
  42995.     {
  42996.         // verify the required parameter 'xero_tenant_id' is set
  42997.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  42998.             throw new \InvalidArgumentException(
  42999.                 'Missing the required parameter $xero_tenant_id when calling getQuoteAttachmentById'
  43000.             );
  43001.         }
  43002.         // verify the required parameter 'quote_id' is set
  43003.         if ($quote_id === null || (is_array($quote_id) && count($quote_id) === 0)) {
  43004.             throw new \InvalidArgumentException(
  43005.                 'Missing the required parameter $quote_id when calling getQuoteAttachmentById'
  43006.             );
  43007.         }
  43008.         // verify the required parameter 'attachment_id' is set
  43009.         if ($attachment_id === null || (is_array($attachment_id) && count($attachment_id) === 0)) {
  43010.             throw new \InvalidArgumentException(
  43011.                 'Missing the required parameter $attachment_id when calling getQuoteAttachmentById'
  43012.             );
  43013.         }
  43014.         // verify the required parameter 'content_type' is set
  43015.         if ($content_type === null || (is_array($content_type) && count($content_type) === 0)) {
  43016.             throw new \InvalidArgumentException(
  43017.                 'Missing the required parameter $content_type when calling getQuoteAttachmentById'
  43018.             );
  43019.         }
  43020.         $resourcePath '/Quotes/{QuoteID}/Attachments/{AttachmentID}';
  43021.         $formParams = [];
  43022.         $queryParams = [];
  43023.         $headerParams = [];
  43024.         $httpBody '';
  43025.         $multipart false;
  43026.         // header params
  43027.         if ($xero_tenant_id !== null) {
  43028.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  43029.         }
  43030.         // header params
  43031.         if ($content_type !== null) {
  43032.             $headerParams['contentType'] = AccountingObjectSerializer::toHeaderValue($content_type);
  43033.         }
  43034.         // path params
  43035.         if ($quote_id !== null) {
  43036.             $resourcePath str_replace(
  43037.                 '{' 'QuoteID' '}',
  43038.                 AccountingObjectSerializer::toPathValue($quote_id),
  43039.                 $resourcePath
  43040.             );
  43041.         }
  43042.         // path params
  43043.         if ($attachment_id !== null) {
  43044.             $resourcePath str_replace(
  43045.                 '{' 'AttachmentID' '}',
  43046.                 AccountingObjectSerializer::toPathValue($attachment_id),
  43047.                 $resourcePath
  43048.             );
  43049.         }
  43050.         // body params
  43051.         $_tempBody null;
  43052.         if ($multipart) {
  43053.             $headers $this->headerSelector->selectHeadersForMultipart(
  43054.                 ['application/octet-stream']
  43055.             );
  43056.         } else {
  43057.             $headers $this->headerSelector->selectHeaders(
  43058.                 ['application/octet-stream'],
  43059.                 []
  43060.             );
  43061.         }
  43062.         // for model (json/xml)
  43063.         if (isset($_tempBody)) {
  43064.             // $_tempBody is the method argument, if present
  43065.             if ($headers['Content-Type'] === 'application/json') {
  43066.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  43067.             } else {
  43068.                 $httpBody $_tempBody;
  43069.             }
  43070.         } elseif (count($formParams) > 0) {
  43071.             if ($multipart) {
  43072.                 $multipartContents = [
  43073.                     [
  43074.                         'Content-type' => 'multipart/form-data',
  43075.                     ]
  43076.                 ];
  43077.                 
  43078.                 // for HTTP post (form)
  43079.                 $httpBody = new MultipartStream($multipartContents);
  43080.             } elseif ($headers['Content-Type'] === 'application/json') {
  43081.                 $httpBody \GuzzleHttp\json_encode($formParams);
  43082.             } else {
  43083.                 // for HTTP post (form)
  43084.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  43085.             }
  43086.         }
  43087.         // this endpoint requires OAuth (access token)
  43088.         if ($this->config->getAccessToken() !== null) {
  43089.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  43090.         }
  43091.         $defaultHeaders = [];
  43092.         if ($this->config->getUserAgent()) {
  43093.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  43094.         }
  43095.         $headers array_merge(
  43096.             $defaultHeaders,
  43097.             $headerParams,
  43098.             $headers
  43099.         );
  43100.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  43101.         return new Request(
  43102.             'GET',
  43103.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  43104.             $headers,
  43105.             $httpBody
  43106.         );
  43107.     }
  43108.     /**
  43109.      * Operation getQuoteAttachments
  43110.      * Retrieves attachments for a specific quote
  43111.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  43112.      * @param  string $quote_id Unique identifier for an Quote (required)
  43113.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  43114.      * @throws \InvalidArgumentException
  43115.      * @return \XeroAPI\XeroPHP\Models\Accounting\Attachments
  43116.      */
  43117.     public function getQuoteAttachments($xero_tenant_id$quote_id)
  43118.     {
  43119.         list($response) = $this->getQuoteAttachmentsWithHttpInfo($xero_tenant_id$quote_id);
  43120.         return $response;
  43121.     }
  43122.     /**
  43123.      * Operation getQuoteAttachmentsWithHttpInfo
  43124.      * Retrieves attachments for a specific quote
  43125.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  43126.      * @param  string $quote_id Unique identifier for an Quote (required)
  43127.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  43128.      * @throws \InvalidArgumentException
  43129.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Attachments, HTTP status code, HTTP response headers (array of strings)
  43130.      */
  43131.     public function getQuoteAttachmentsWithHttpInfo($xero_tenant_id$quote_id)
  43132.     {
  43133.         $request $this->getQuoteAttachmentsRequest($xero_tenant_id$quote_id);
  43134.         try {
  43135.             $options $this->createHttpClientOption();
  43136.             try {
  43137.                 $response $this->client->send($request$options);
  43138.             } catch (RequestException $e) {
  43139.                 throw new ApiException(
  43140.                     "[{$e->getCode()}{$e->getMessage()}",
  43141.                     $e->getCode(),
  43142.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  43143.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  43144.                 );
  43145.             }
  43146.             $statusCode $response->getStatusCode();
  43147.             if ($statusCode 200 || $statusCode 299) {
  43148.                 throw new ApiException(
  43149.                     sprintf(
  43150.                         '[%d] Error connecting to the API (%s)',
  43151.                         $statusCode,
  43152.                         $request->getUri()
  43153.                     ),
  43154.                     $statusCode,
  43155.                     $response->getHeaders(),
  43156.                     $response->getBody()
  43157.                 );
  43158.             }
  43159.             $responseBody $response->getBody();
  43160.             switch($statusCode) {
  43161.                 case 200:
  43162.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Attachments' === '\SplFileObject') {
  43163.                         $content $responseBody//stream goes to serializer
  43164.                     } else {
  43165.                         $content $responseBody->getContents();
  43166.                     }
  43167.                     return [
  43168.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Attachments', []),
  43169.                         $response->getStatusCode(),
  43170.                         $response->getHeaders()
  43171.                     ];
  43172.             }
  43173.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  43174.             $responseBody $response->getBody();
  43175.             if ($returnType === '\SplFileObject') {
  43176.                 $content $responseBody//stream goes to serializer
  43177.             } else {
  43178.                 $content $responseBody->getContents();
  43179.             }
  43180.             return [
  43181.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  43182.                 $response->getStatusCode(),
  43183.                 $response->getHeaders()
  43184.             ];
  43185.         } catch (ApiException $e) {
  43186.             switch ($e->getCode()) {
  43187.                 case 200:
  43188.                     $data AccountingObjectSerializer::deserialize(
  43189.                         $e->getResponseBody(),
  43190.                         '\XeroAPI\XeroPHP\Models\Accounting\Attachments',
  43191.                         $e->getResponseHeaders()
  43192.                     );
  43193.                     $e->setResponseObject($data);
  43194.                     break;
  43195.             }
  43196.             throw $e;
  43197.         }
  43198.     }
  43199.     /**
  43200.      * Operation getQuoteAttachmentsAsync
  43201.      * Retrieves attachments for a specific quote
  43202.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  43203.      * @param  string $quote_id Unique identifier for an Quote (required)
  43204.      * @throws \InvalidArgumentException
  43205.      * @return \GuzzleHttp\Promise\PromiseInterface
  43206.      */
  43207.     public function getQuoteAttachmentsAsync($xero_tenant_id$quote_id)
  43208.     {
  43209.         return $this->getQuoteAttachmentsAsyncWithHttpInfo($xero_tenant_id$quote_id)
  43210.             ->then(
  43211.                 function ($response) {
  43212.                     return $response[0];
  43213.                 }
  43214.             );
  43215.     }
  43216.     /**
  43217.      * Operation getQuoteAttachmentsAsyncWithHttpInfo
  43218.      * Retrieves attachments for a specific quote
  43219.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  43220.      * @param  string $quote_id Unique identifier for an Quote (required)
  43221.      * @throws \InvalidArgumentException
  43222.      * @return \GuzzleHttp\Promise\PromiseInterface */
  43223.     public function getQuoteAttachmentsAsyncWithHttpInfo($xero_tenant_id$quote_id)
  43224.     {
  43225.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  43226.         $request $this->getQuoteAttachmentsRequest($xero_tenant_id$quote_id);
  43227.         return $this->client
  43228.             ->sendAsync($request$this->createHttpClientOption())
  43229.             ->then(
  43230.                 function ($response) use ($returnType) {
  43231.                     $responseBody $response->getBody();
  43232.                     if ($returnType === '\SplFileObject') {
  43233.                         $content $responseBody//stream goes to serializer
  43234.                     } else {
  43235.                         $content $responseBody->getContents();
  43236.                     }
  43237.                     return [
  43238.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  43239.                         $response->getStatusCode(),
  43240.                         $response->getHeaders()
  43241.                     ];
  43242.                 },
  43243.                 function ($exception) {
  43244.                     $response $exception->getResponse();
  43245.                     $statusCode $response->getStatusCode();
  43246.                     throw new ApiException(
  43247.                         sprintf(
  43248.                             '[%d] Error connecting to the API (%s)',
  43249.                             $statusCode,
  43250.                             $exception->getRequest()->getUri()
  43251.                         ),
  43252.                         $statusCode,
  43253.                         $response->getHeaders(),
  43254.                         $response->getBody()
  43255.                     );
  43256.                 }
  43257.             );
  43258.     }
  43259.     /**
  43260.      * Create request for operation 'getQuoteAttachments'
  43261.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  43262.      * @param  string $quote_id Unique identifier for an Quote (required)
  43263.      * @throws \InvalidArgumentException
  43264.      * @return \GuzzleHttp\Psr7\Request  */
  43265.     protected function getQuoteAttachmentsRequest($xero_tenant_id$quote_id)
  43266.     {
  43267.         // verify the required parameter 'xero_tenant_id' is set
  43268.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  43269.             throw new \InvalidArgumentException(
  43270.                 'Missing the required parameter $xero_tenant_id when calling getQuoteAttachments'
  43271.             );
  43272.         }
  43273.         // verify the required parameter 'quote_id' is set
  43274.         if ($quote_id === null || (is_array($quote_id) && count($quote_id) === 0)) {
  43275.             throw new \InvalidArgumentException(
  43276.                 'Missing the required parameter $quote_id when calling getQuoteAttachments'
  43277.             );
  43278.         }
  43279.         $resourcePath '/Quotes/{QuoteID}/Attachments';
  43280.         $formParams = [];
  43281.         $queryParams = [];
  43282.         $headerParams = [];
  43283.         $httpBody '';
  43284.         $multipart false;
  43285.         // header params
  43286.         if ($xero_tenant_id !== null) {
  43287.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  43288.         }
  43289.         // path params
  43290.         if ($quote_id !== null) {
  43291.             $resourcePath str_replace(
  43292.                 '{' 'QuoteID' '}',
  43293.                 AccountingObjectSerializer::toPathValue($quote_id),
  43294.                 $resourcePath
  43295.             );
  43296.         }
  43297.         // body params
  43298.         $_tempBody null;
  43299.         if ($multipart) {
  43300.             $headers $this->headerSelector->selectHeadersForMultipart(
  43301.                 ['application/json']
  43302.             );
  43303.         } else {
  43304.             $headers $this->headerSelector->selectHeaders(
  43305.                 ['application/json'],
  43306.                 []
  43307.             );
  43308.         }
  43309.         // for model (json/xml)
  43310.         if (isset($_tempBody)) {
  43311.             // $_tempBody is the method argument, if present
  43312.             if ($headers['Content-Type'] === 'application/json') {
  43313.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  43314.             } else {
  43315.                 $httpBody $_tempBody;
  43316.             }
  43317.         } elseif (count($formParams) > 0) {
  43318.             if ($multipart) {
  43319.                 $multipartContents = [
  43320.                     [
  43321.                         'Content-type' => 'multipart/form-data',
  43322.                     ]
  43323.                 ];
  43324.                 
  43325.                 // for HTTP post (form)
  43326.                 $httpBody = new MultipartStream($multipartContents);
  43327.             } elseif ($headers['Content-Type'] === 'application/json') {
  43328.                 $httpBody \GuzzleHttp\json_encode($formParams);
  43329.             } else {
  43330.                 // for HTTP post (form)
  43331.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  43332.             }
  43333.         }
  43334.         // this endpoint requires OAuth (access token)
  43335.         if ($this->config->getAccessToken() !== null) {
  43336.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  43337.         }
  43338.         $defaultHeaders = [];
  43339.         if ($this->config->getUserAgent()) {
  43340.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  43341.         }
  43342.         $headers array_merge(
  43343.             $defaultHeaders,
  43344.             $headerParams,
  43345.             $headers
  43346.         );
  43347.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  43348.         return new Request(
  43349.             'GET',
  43350.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  43351.             $headers,
  43352.             $httpBody
  43353.         );
  43354.     }
  43355.     /**
  43356.      * Operation getQuoteHistory
  43357.      * Retrieves history records of a specific quote
  43358.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  43359.      * @param  string $quote_id Unique identifier for an Quote (required)
  43360.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  43361.      * @throws \InvalidArgumentException
  43362.      * @return \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords
  43363.      */
  43364.     public function getQuoteHistory($xero_tenant_id$quote_id)
  43365.     {
  43366.         list($response) = $this->getQuoteHistoryWithHttpInfo($xero_tenant_id$quote_id);
  43367.         return $response;
  43368.     }
  43369.     /**
  43370.      * Operation getQuoteHistoryWithHttpInfo
  43371.      * Retrieves history records of a specific quote
  43372.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  43373.      * @param  string $quote_id Unique identifier for an Quote (required)
  43374.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  43375.      * @throws \InvalidArgumentException
  43376.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords, HTTP status code, HTTP response headers (array of strings)
  43377.      */
  43378.     public function getQuoteHistoryWithHttpInfo($xero_tenant_id$quote_id)
  43379.     {
  43380.         $request $this->getQuoteHistoryRequest($xero_tenant_id$quote_id);
  43381.         try {
  43382.             $options $this->createHttpClientOption();
  43383.             try {
  43384.                 $response $this->client->send($request$options);
  43385.             } catch (RequestException $e) {
  43386.                 throw new ApiException(
  43387.                     "[{$e->getCode()}{$e->getMessage()}",
  43388.                     $e->getCode(),
  43389.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  43390.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  43391.                 );
  43392.             }
  43393.             $statusCode $response->getStatusCode();
  43394.             if ($statusCode 200 || $statusCode 299) {
  43395.                 throw new ApiException(
  43396.                     sprintf(
  43397.                         '[%d] Error connecting to the API (%s)',
  43398.                         $statusCode,
  43399.                         $request->getUri()
  43400.                     ),
  43401.                     $statusCode,
  43402.                     $response->getHeaders(),
  43403.                     $response->getBody()
  43404.                 );
  43405.             }
  43406.             $responseBody $response->getBody();
  43407.             switch($statusCode) {
  43408.                 case 200:
  43409.                     if ('\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords' === '\SplFileObject') {
  43410.                         $content $responseBody//stream goes to serializer
  43411.                     } else {
  43412.                         $content $responseBody->getContents();
  43413.                     }
  43414.                     return [
  43415.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords', []),
  43416.                         $response->getStatusCode(),
  43417.                         $response->getHeaders()
  43418.                     ];
  43419.             }
  43420.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  43421.             $responseBody $response->getBody();
  43422.             if ($returnType === '\SplFileObject') {
  43423.                 $content $responseBody//stream goes to serializer
  43424.             } else {
  43425.                 $content $responseBody->getContents();
  43426.             }
  43427.             return [
  43428.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  43429.                 $response->getStatusCode(),
  43430.                 $response->getHeaders()
  43431.             ];
  43432.         } catch (ApiException $e) {
  43433.             switch ($e->getCode()) {
  43434.                 case 200:
  43435.                     $data AccountingObjectSerializer::deserialize(
  43436.                         $e->getResponseBody(),
  43437.                         '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords',
  43438.                         $e->getResponseHeaders()
  43439.                     );
  43440.                     $e->setResponseObject($data);
  43441.                     break;
  43442.             }
  43443.             throw $e;
  43444.         }
  43445.     }
  43446.     /**
  43447.      * Operation getQuoteHistoryAsync
  43448.      * Retrieves history records of a specific quote
  43449.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  43450.      * @param  string $quote_id Unique identifier for an Quote (required)
  43451.      * @throws \InvalidArgumentException
  43452.      * @return \GuzzleHttp\Promise\PromiseInterface
  43453.      */
  43454.     public function getQuoteHistoryAsync($xero_tenant_id$quote_id)
  43455.     {
  43456.         return $this->getQuoteHistoryAsyncWithHttpInfo($xero_tenant_id$quote_id)
  43457.             ->then(
  43458.                 function ($response) {
  43459.                     return $response[0];
  43460.                 }
  43461.             );
  43462.     }
  43463.     /**
  43464.      * Operation getQuoteHistoryAsyncWithHttpInfo
  43465.      * Retrieves history records of a specific quote
  43466.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  43467.      * @param  string $quote_id Unique identifier for an Quote (required)
  43468.      * @throws \InvalidArgumentException
  43469.      * @return \GuzzleHttp\Promise\PromiseInterface */
  43470.     public function getQuoteHistoryAsyncWithHttpInfo($xero_tenant_id$quote_id)
  43471.     {
  43472.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  43473.         $request $this->getQuoteHistoryRequest($xero_tenant_id$quote_id);
  43474.         return $this->client
  43475.             ->sendAsync($request$this->createHttpClientOption())
  43476.             ->then(
  43477.                 function ($response) use ($returnType) {
  43478.                     $responseBody $response->getBody();
  43479.                     if ($returnType === '\SplFileObject') {
  43480.                         $content $responseBody//stream goes to serializer
  43481.                     } else {
  43482.                         $content $responseBody->getContents();
  43483.                     }
  43484.                     return [
  43485.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  43486.                         $response->getStatusCode(),
  43487.                         $response->getHeaders()
  43488.                     ];
  43489.                 },
  43490.                 function ($exception) {
  43491.                     $response $exception->getResponse();
  43492.                     $statusCode $response->getStatusCode();
  43493.                     throw new ApiException(
  43494.                         sprintf(
  43495.                             '[%d] Error connecting to the API (%s)',
  43496.                             $statusCode,
  43497.                             $exception->getRequest()->getUri()
  43498.                         ),
  43499.                         $statusCode,
  43500.                         $response->getHeaders(),
  43501.                         $response->getBody()
  43502.                     );
  43503.                 }
  43504.             );
  43505.     }
  43506.     /**
  43507.      * Create request for operation 'getQuoteHistory'
  43508.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  43509.      * @param  string $quote_id Unique identifier for an Quote (required)
  43510.      * @throws \InvalidArgumentException
  43511.      * @return \GuzzleHttp\Psr7\Request  */
  43512.     protected function getQuoteHistoryRequest($xero_tenant_id$quote_id)
  43513.     {
  43514.         // verify the required parameter 'xero_tenant_id' is set
  43515.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  43516.             throw new \InvalidArgumentException(
  43517.                 'Missing the required parameter $xero_tenant_id when calling getQuoteHistory'
  43518.             );
  43519.         }
  43520.         // verify the required parameter 'quote_id' is set
  43521.         if ($quote_id === null || (is_array($quote_id) && count($quote_id) === 0)) {
  43522.             throw new \InvalidArgumentException(
  43523.                 'Missing the required parameter $quote_id when calling getQuoteHistory'
  43524.             );
  43525.         }
  43526.         $resourcePath '/Quotes/{QuoteID}/History';
  43527.         $formParams = [];
  43528.         $queryParams = [];
  43529.         $headerParams = [];
  43530.         $httpBody '';
  43531.         $multipart false;
  43532.         // header params
  43533.         if ($xero_tenant_id !== null) {
  43534.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  43535.         }
  43536.         // path params
  43537.         if ($quote_id !== null) {
  43538.             $resourcePath str_replace(
  43539.                 '{' 'QuoteID' '}',
  43540.                 AccountingObjectSerializer::toPathValue($quote_id),
  43541.                 $resourcePath
  43542.             );
  43543.         }
  43544.         // body params
  43545.         $_tempBody null;
  43546.         if ($multipart) {
  43547.             $headers $this->headerSelector->selectHeadersForMultipart(
  43548.                 ['application/json']
  43549.             );
  43550.         } else {
  43551.             $headers $this->headerSelector->selectHeaders(
  43552.                 ['application/json'],
  43553.                 []
  43554.             );
  43555.         }
  43556.         // for model (json/xml)
  43557.         if (isset($_tempBody)) {
  43558.             // $_tempBody is the method argument, if present
  43559.             if ($headers['Content-Type'] === 'application/json') {
  43560.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  43561.             } else {
  43562.                 $httpBody $_tempBody;
  43563.             }
  43564.         } elseif (count($formParams) > 0) {
  43565.             if ($multipart) {
  43566.                 $multipartContents = [
  43567.                     [
  43568.                         'Content-type' => 'multipart/form-data',
  43569.                     ]
  43570.                 ];
  43571.                 
  43572.                 // for HTTP post (form)
  43573.                 $httpBody = new MultipartStream($multipartContents);
  43574.             } elseif ($headers['Content-Type'] === 'application/json') {
  43575.                 $httpBody \GuzzleHttp\json_encode($formParams);
  43576.             } else {
  43577.                 // for HTTP post (form)
  43578.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  43579.             }
  43580.         }
  43581.         // this endpoint requires OAuth (access token)
  43582.         if ($this->config->getAccessToken() !== null) {
  43583.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  43584.         }
  43585.         $defaultHeaders = [];
  43586.         if ($this->config->getUserAgent()) {
  43587.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  43588.         }
  43589.         $headers array_merge(
  43590.             $defaultHeaders,
  43591.             $headerParams,
  43592.             $headers
  43593.         );
  43594.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  43595.         return new Request(
  43596.             'GET',
  43597.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  43598.             $headers,
  43599.             $httpBody
  43600.         );
  43601.     }
  43602.     /**
  43603.      * Operation getQuotes
  43604.      * Retrieves sales quotes
  43605.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  43606.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  43607.      * @param  \DateTime $date_from Filter for quotes after a particular date (optional)
  43608.      * @param  \DateTime $date_to Filter for quotes before a particular date (optional)
  43609.      * @param  \DateTime $expiry_date_from Filter for quotes expiring after a particular date (optional)
  43610.      * @param  \DateTime $expiry_date_to Filter for quotes before a particular date (optional)
  43611.      * @param  string $contact_id Filter for quotes belonging to a particular contact (optional)
  43612.      * @param  string $status Filter for quotes of a particular Status (optional)
  43613.      * @param  int $page e.g. page&#x3D;1 â€“ Up to 100 Quotes will be returned in a single API call with line items shown for each quote (optional)
  43614.      * @param  string $order Order by an any element (optional)
  43615.      * @param  string $quote_number Filter by quote number (e.g. GET https://.../Quotes?QuoteNumber&#x3D;QU-0001) (optional)
  43616.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  43617.      * @throws \InvalidArgumentException
  43618.      * @return \XeroAPI\XeroPHP\Models\Accounting\Quotes
  43619.      */
  43620.     public function getQuotes($xero_tenant_id$if_modified_since null$date_from null$date_to null$expiry_date_from null$expiry_date_to null$contact_id null$status null$page null$order null$quote_number null)
  43621.     {
  43622.         list($response) = $this->getQuotesWithHttpInfo($xero_tenant_id$if_modified_since$date_from$date_to$expiry_date_from$expiry_date_to$contact_id$status$page$order$quote_number);
  43623.         return $response;
  43624.     }
  43625.     /**
  43626.      * Operation getQuotesWithHttpInfo
  43627.      * Retrieves sales quotes
  43628.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  43629.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  43630.      * @param  \DateTime $date_from Filter for quotes after a particular date (optional)
  43631.      * @param  \DateTime $date_to Filter for quotes before a particular date (optional)
  43632.      * @param  \DateTime $expiry_date_from Filter for quotes expiring after a particular date (optional)
  43633.      * @param  \DateTime $expiry_date_to Filter for quotes before a particular date (optional)
  43634.      * @param  string $contact_id Filter for quotes belonging to a particular contact (optional)
  43635.      * @param  string $status Filter for quotes of a particular Status (optional)
  43636.      * @param  int $page e.g. page&#x3D;1 â€“ Up to 100 Quotes will be returned in a single API call with line items shown for each quote (optional)
  43637.      * @param  string $order Order by an any element (optional)
  43638.      * @param  string $quote_number Filter by quote number (e.g. GET https://.../Quotes?QuoteNumber&#x3D;QU-0001) (optional)
  43639.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  43640.      * @throws \InvalidArgumentException
  43641.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Quotes, HTTP status code, HTTP response headers (array of strings)
  43642.      */
  43643.     public function getQuotesWithHttpInfo($xero_tenant_id$if_modified_since null$date_from null$date_to null$expiry_date_from null$expiry_date_to null$contact_id null$status null$page null$order null$quote_number null)
  43644.     {
  43645.         $request $this->getQuotesRequest($xero_tenant_id$if_modified_since$date_from$date_to$expiry_date_from$expiry_date_to$contact_id$status$page$order$quote_number);
  43646.         try {
  43647.             $options $this->createHttpClientOption();
  43648.             try {
  43649.                 $response $this->client->send($request$options);
  43650.             } catch (RequestException $e) {
  43651.                 throw new ApiException(
  43652.                     "[{$e->getCode()}{$e->getMessage()}",
  43653.                     $e->getCode(),
  43654.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  43655.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  43656.                 );
  43657.             }
  43658.             $statusCode $response->getStatusCode();
  43659.             if ($statusCode 200 || $statusCode 299) {
  43660.                 throw new ApiException(
  43661.                     sprintf(
  43662.                         '[%d] Error connecting to the API (%s)',
  43663.                         $statusCode,
  43664.                         $request->getUri()
  43665.                     ),
  43666.                     $statusCode,
  43667.                     $response->getHeaders(),
  43668.                     $response->getBody()
  43669.                 );
  43670.             }
  43671.             $responseBody $response->getBody();
  43672.             switch($statusCode) {
  43673.                 case 200:
  43674.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Quotes' === '\SplFileObject') {
  43675.                         $content $responseBody//stream goes to serializer
  43676.                     } else {
  43677.                         $content $responseBody->getContents();
  43678.                     }
  43679.                     return [
  43680.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Quotes', []),
  43681.                         $response->getStatusCode(),
  43682.                         $response->getHeaders()
  43683.                     ];
  43684.             }
  43685.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Quotes';
  43686.             $responseBody $response->getBody();
  43687.             if ($returnType === '\SplFileObject') {
  43688.                 $content $responseBody//stream goes to serializer
  43689.             } else {
  43690.                 $content $responseBody->getContents();
  43691.             }
  43692.             return [
  43693.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  43694.                 $response->getStatusCode(),
  43695.                 $response->getHeaders()
  43696.             ];
  43697.         } catch (ApiException $e) {
  43698.             switch ($e->getCode()) {
  43699.                 case 200:
  43700.                     $data AccountingObjectSerializer::deserialize(
  43701.                         $e->getResponseBody(),
  43702.                         '\XeroAPI\XeroPHP\Models\Accounting\Quotes',
  43703.                         $e->getResponseHeaders()
  43704.                     );
  43705.                     $e->setResponseObject($data);
  43706.                     break;
  43707.             }
  43708.             throw $e;
  43709.         }
  43710.     }
  43711.     /**
  43712.      * Operation getQuotesAsync
  43713.      * Retrieves sales quotes
  43714.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  43715.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  43716.      * @param  \DateTime $date_from Filter for quotes after a particular date (optional)
  43717.      * @param  \DateTime $date_to Filter for quotes before a particular date (optional)
  43718.      * @param  \DateTime $expiry_date_from Filter for quotes expiring after a particular date (optional)
  43719.      * @param  \DateTime $expiry_date_to Filter for quotes before a particular date (optional)
  43720.      * @param  string $contact_id Filter for quotes belonging to a particular contact (optional)
  43721.      * @param  string $status Filter for quotes of a particular Status (optional)
  43722.      * @param  int $page e.g. page&#x3D;1 â€“ Up to 100 Quotes will be returned in a single API call with line items shown for each quote (optional)
  43723.      * @param  string $order Order by an any element (optional)
  43724.      * @param  string $quote_number Filter by quote number (e.g. GET https://.../Quotes?QuoteNumber&#x3D;QU-0001) (optional)
  43725.      * @throws \InvalidArgumentException
  43726.      * @return \GuzzleHttp\Promise\PromiseInterface
  43727.      */
  43728.     public function getQuotesAsync($xero_tenant_id$if_modified_since null$date_from null$date_to null$expiry_date_from null$expiry_date_to null$contact_id null$status null$page null$order null$quote_number null)
  43729.     {
  43730.         return $this->getQuotesAsyncWithHttpInfo($xero_tenant_id$if_modified_since$date_from$date_to$expiry_date_from$expiry_date_to$contact_id$status$page$order$quote_number)
  43731.             ->then(
  43732.                 function ($response) {
  43733.                     return $response[0];
  43734.                 }
  43735.             );
  43736.     }
  43737.     /**
  43738.      * Operation getQuotesAsyncWithHttpInfo
  43739.      * Retrieves sales quotes
  43740.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  43741.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  43742.      * @param  \DateTime $date_from Filter for quotes after a particular date (optional)
  43743.      * @param  \DateTime $date_to Filter for quotes before a particular date (optional)
  43744.      * @param  \DateTime $expiry_date_from Filter for quotes expiring after a particular date (optional)
  43745.      * @param  \DateTime $expiry_date_to Filter for quotes before a particular date (optional)
  43746.      * @param  string $contact_id Filter for quotes belonging to a particular contact (optional)
  43747.      * @param  string $status Filter for quotes of a particular Status (optional)
  43748.      * @param  int $page e.g. page&#x3D;1 â€“ Up to 100 Quotes will be returned in a single API call with line items shown for each quote (optional)
  43749.      * @param  string $order Order by an any element (optional)
  43750.      * @param  string $quote_number Filter by quote number (e.g. GET https://.../Quotes?QuoteNumber&#x3D;QU-0001) (optional)
  43751.      * @throws \InvalidArgumentException
  43752.      * @return \GuzzleHttp\Promise\PromiseInterface */
  43753.     public function getQuotesAsyncWithHttpInfo($xero_tenant_id$if_modified_since null$date_from null$date_to null$expiry_date_from null$expiry_date_to null$contact_id null$status null$page null$order null$quote_number null)
  43754.     {
  43755.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Quotes';
  43756.         $request $this->getQuotesRequest($xero_tenant_id$if_modified_since$date_from$date_to$expiry_date_from$expiry_date_to$contact_id$status$page$order$quote_number);
  43757.         return $this->client
  43758.             ->sendAsync($request$this->createHttpClientOption())
  43759.             ->then(
  43760.                 function ($response) use ($returnType) {
  43761.                     $responseBody $response->getBody();
  43762.                     if ($returnType === '\SplFileObject') {
  43763.                         $content $responseBody//stream goes to serializer
  43764.                     } else {
  43765.                         $content $responseBody->getContents();
  43766.                     }
  43767.                     return [
  43768.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  43769.                         $response->getStatusCode(),
  43770.                         $response->getHeaders()
  43771.                     ];
  43772.                 },
  43773.                 function ($exception) {
  43774.                     $response $exception->getResponse();
  43775.                     $statusCode $response->getStatusCode();
  43776.                     throw new ApiException(
  43777.                         sprintf(
  43778.                             '[%d] Error connecting to the API (%s)',
  43779.                             $statusCode,
  43780.                             $exception->getRequest()->getUri()
  43781.                         ),
  43782.                         $statusCode,
  43783.                         $response->getHeaders(),
  43784.                         $response->getBody()
  43785.                     );
  43786.                 }
  43787.             );
  43788.     }
  43789.     /**
  43790.      * Create request for operation 'getQuotes'
  43791.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  43792.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  43793.      * @param  \DateTime $date_from Filter for quotes after a particular date (optional)
  43794.      * @param  \DateTime $date_to Filter for quotes before a particular date (optional)
  43795.      * @param  \DateTime $expiry_date_from Filter for quotes expiring after a particular date (optional)
  43796.      * @param  \DateTime $expiry_date_to Filter for quotes before a particular date (optional)
  43797.      * @param  string $contact_id Filter for quotes belonging to a particular contact (optional)
  43798.      * @param  string $status Filter for quotes of a particular Status (optional)
  43799.      * @param  int $page e.g. page&#x3D;1 â€“ Up to 100 Quotes will be returned in a single API call with line items shown for each quote (optional)
  43800.      * @param  string $order Order by an any element (optional)
  43801.      * @param  string $quote_number Filter by quote number (e.g. GET https://.../Quotes?QuoteNumber&#x3D;QU-0001) (optional)
  43802.      * @throws \InvalidArgumentException
  43803.      * @return \GuzzleHttp\Psr7\Request  */
  43804.     protected function getQuotesRequest($xero_tenant_id$if_modified_since null$date_from null$date_to null$expiry_date_from null$expiry_date_to null$contact_id null$status null$page null$order null$quote_number null)
  43805.     {
  43806.         // verify the required parameter 'xero_tenant_id' is set
  43807.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  43808.             throw new \InvalidArgumentException(
  43809.                 'Missing the required parameter $xero_tenant_id when calling getQuotes'
  43810.             );
  43811.         }
  43812.         $resourcePath '/Quotes';
  43813.         $formParams = [];
  43814.         $queryParams = [];
  43815.         $headerParams = [];
  43816.         $httpBody '';
  43817.         $multipart false;
  43818.         // query params
  43819.         if ($date_from !== null) {
  43820.             $queryParams['DateFrom'] = AccountingObjectSerializer::toQueryValue($date_from);
  43821.         }
  43822.         // query params
  43823.         if ($date_to !== null) {
  43824.             $queryParams['DateTo'] = AccountingObjectSerializer::toQueryValue($date_to);
  43825.         }
  43826.         // query params
  43827.         if ($expiry_date_from !== null) {
  43828.             $queryParams['ExpiryDateFrom'] = AccountingObjectSerializer::toQueryValue($expiry_date_from);
  43829.         }
  43830.         // query params
  43831.         if ($expiry_date_to !== null) {
  43832.             $queryParams['ExpiryDateTo'] = AccountingObjectSerializer::toQueryValue($expiry_date_to);
  43833.         }
  43834.         // query params
  43835.         if ($contact_id !== null) {
  43836.             $queryParams['ContactID'] = AccountingObjectSerializer::toQueryValue($contact_id);
  43837.         }
  43838.         // query params
  43839.         if ($status !== null) {
  43840.             $queryParams['Status'] = AccountingObjectSerializer::toQueryValue($status);
  43841.         }
  43842.         // query params
  43843.         if ($page !== null) {
  43844.             $queryParams['page'] = AccountingObjectSerializer::toQueryValue($page);
  43845.         }
  43846.         // query params
  43847.         if ($order !== null) {
  43848.             $queryParams['order'] = AccountingObjectSerializer::toQueryValue($order);
  43849.         }
  43850.         // query params
  43851.         if ($quote_number !== null) {
  43852.             $queryParams['QuoteNumber'] = AccountingObjectSerializer::toQueryValue($quote_number);
  43853.         }
  43854.         // header params
  43855.         if ($xero_tenant_id !== null) {
  43856.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  43857.         }
  43858.         // header params
  43859.         if ($if_modified_since !== null) {
  43860.             $headerParams['If-Modified-Since'] = AccountingObjectSerializer::toHeaderValue($if_modified_since);
  43861.         }
  43862.         // body params
  43863.         $_tempBody null;
  43864.         if ($multipart) {
  43865.             $headers $this->headerSelector->selectHeadersForMultipart(
  43866.                 ['application/json']
  43867.             );
  43868.         } else {
  43869.             $headers $this->headerSelector->selectHeaders(
  43870.                 ['application/json'],
  43871.                 []
  43872.             );
  43873.         }
  43874.         // for model (json/xml)
  43875.         if (isset($_tempBody)) {
  43876.             // $_tempBody is the method argument, if present
  43877.             if ($headers['Content-Type'] === 'application/json') {
  43878.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  43879.             } else {
  43880.                 $httpBody $_tempBody;
  43881.             }
  43882.         } elseif (count($formParams) > 0) {
  43883.             if ($multipart) {
  43884.                 $multipartContents = [
  43885.                     [
  43886.                         'Content-type' => 'multipart/form-data',
  43887.                     ]
  43888.                 ];
  43889.                 
  43890.                 // for HTTP post (form)
  43891.                 $httpBody = new MultipartStream($multipartContents);
  43892.             } elseif ($headers['Content-Type'] === 'application/json') {
  43893.                 $httpBody \GuzzleHttp\json_encode($formParams);
  43894.             } else {
  43895.                 // for HTTP post (form)
  43896.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  43897.             }
  43898.         }
  43899.         // this endpoint requires OAuth (access token)
  43900.         if ($this->config->getAccessToken() !== null) {
  43901.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  43902.         }
  43903.         $defaultHeaders = [];
  43904.         if ($this->config->getUserAgent()) {
  43905.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  43906.         }
  43907.         $headers array_merge(
  43908.             $defaultHeaders,
  43909.             $headerParams,
  43910.             $headers
  43911.         );
  43912.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  43913.         return new Request(
  43914.             'GET',
  43915.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  43916.             $headers,
  43917.             $httpBody
  43918.         );
  43919.     }
  43920.     /**
  43921.      * Operation getReceipt
  43922.      * Retrieves a specific draft expense claim receipt by using a unique receipt Id
  43923.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  43924.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  43925.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  43926.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  43927.      * @throws \InvalidArgumentException
  43928.      * @return \XeroAPI\XeroPHP\Models\Accounting\Receipts
  43929.      */
  43930.     public function getReceipt($xero_tenant_id$receipt_id$unitdp null)
  43931.     {
  43932.         list($response) = $this->getReceiptWithHttpInfo($xero_tenant_id$receipt_id$unitdp);
  43933.         return $response;
  43934.     }
  43935.     /**
  43936.      * Operation getReceiptWithHttpInfo
  43937.      * Retrieves a specific draft expense claim receipt by using a unique receipt Id
  43938.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  43939.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  43940.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  43941.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  43942.      * @throws \InvalidArgumentException
  43943.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Receipts, HTTP status code, HTTP response headers (array of strings)
  43944.      */
  43945.     public function getReceiptWithHttpInfo($xero_tenant_id$receipt_id$unitdp null)
  43946.     {
  43947.         $request $this->getReceiptRequest($xero_tenant_id$receipt_id$unitdp);
  43948.         try {
  43949.             $options $this->createHttpClientOption();
  43950.             try {
  43951.                 $response $this->client->send($request$options);
  43952.             } catch (RequestException $e) {
  43953.                 throw new ApiException(
  43954.                     "[{$e->getCode()}{$e->getMessage()}",
  43955.                     $e->getCode(),
  43956.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  43957.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  43958.                 );
  43959.             }
  43960.             $statusCode $response->getStatusCode();
  43961.             if ($statusCode 200 || $statusCode 299) {
  43962.                 throw new ApiException(
  43963.                     sprintf(
  43964.                         '[%d] Error connecting to the API (%s)',
  43965.                         $statusCode,
  43966.                         $request->getUri()
  43967.                     ),
  43968.                     $statusCode,
  43969.                     $response->getHeaders(),
  43970.                     $response->getBody()
  43971.                 );
  43972.             }
  43973.             $responseBody $response->getBody();
  43974.             switch($statusCode) {
  43975.                 case 200:
  43976.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Receipts' === '\SplFileObject') {
  43977.                         $content $responseBody//stream goes to serializer
  43978.                     } else {
  43979.                         $content $responseBody->getContents();
  43980.                     }
  43981.                     return [
  43982.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Receipts', []),
  43983.                         $response->getStatusCode(),
  43984.                         $response->getHeaders()
  43985.                     ];
  43986.             }
  43987.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Receipts';
  43988.             $responseBody $response->getBody();
  43989.             if ($returnType === '\SplFileObject') {
  43990.                 $content $responseBody//stream goes to serializer
  43991.             } else {
  43992.                 $content $responseBody->getContents();
  43993.             }
  43994.             return [
  43995.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  43996.                 $response->getStatusCode(),
  43997.                 $response->getHeaders()
  43998.             ];
  43999.         } catch (ApiException $e) {
  44000.             switch ($e->getCode()) {
  44001.                 case 200:
  44002.                     $data AccountingObjectSerializer::deserialize(
  44003.                         $e->getResponseBody(),
  44004.                         '\XeroAPI\XeroPHP\Models\Accounting\Receipts',
  44005.                         $e->getResponseHeaders()
  44006.                     );
  44007.                     $e->setResponseObject($data);
  44008.                     break;
  44009.             }
  44010.             throw $e;
  44011.         }
  44012.     }
  44013.     /**
  44014.      * Operation getReceiptAsync
  44015.      * Retrieves a specific draft expense claim receipt by using a unique receipt Id
  44016.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  44017.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  44018.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  44019.      * @throws \InvalidArgumentException
  44020.      * @return \GuzzleHttp\Promise\PromiseInterface
  44021.      */
  44022.     public function getReceiptAsync($xero_tenant_id$receipt_id$unitdp null)
  44023.     {
  44024.         return $this->getReceiptAsyncWithHttpInfo($xero_tenant_id$receipt_id$unitdp)
  44025.             ->then(
  44026.                 function ($response) {
  44027.                     return $response[0];
  44028.                 }
  44029.             );
  44030.     }
  44031.     /**
  44032.      * Operation getReceiptAsyncWithHttpInfo
  44033.      * Retrieves a specific draft expense claim receipt by using a unique receipt Id
  44034.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  44035.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  44036.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  44037.      * @throws \InvalidArgumentException
  44038.      * @return \GuzzleHttp\Promise\PromiseInterface */
  44039.     public function getReceiptAsyncWithHttpInfo($xero_tenant_id$receipt_id$unitdp null)
  44040.     {
  44041.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Receipts';
  44042.         $request $this->getReceiptRequest($xero_tenant_id$receipt_id$unitdp);
  44043.         return $this->client
  44044.             ->sendAsync($request$this->createHttpClientOption())
  44045.             ->then(
  44046.                 function ($response) use ($returnType) {
  44047.                     $responseBody $response->getBody();
  44048.                     if ($returnType === '\SplFileObject') {
  44049.                         $content $responseBody//stream goes to serializer
  44050.                     } else {
  44051.                         $content $responseBody->getContents();
  44052.                     }
  44053.                     return [
  44054.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  44055.                         $response->getStatusCode(),
  44056.                         $response->getHeaders()
  44057.                     ];
  44058.                 },
  44059.                 function ($exception) {
  44060.                     $response $exception->getResponse();
  44061.                     $statusCode $response->getStatusCode();
  44062.                     throw new ApiException(
  44063.                         sprintf(
  44064.                             '[%d] Error connecting to the API (%s)',
  44065.                             $statusCode,
  44066.                             $exception->getRequest()->getUri()
  44067.                         ),
  44068.                         $statusCode,
  44069.                         $response->getHeaders(),
  44070.                         $response->getBody()
  44071.                     );
  44072.                 }
  44073.             );
  44074.     }
  44075.     /**
  44076.      * Create request for operation 'getReceipt'
  44077.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  44078.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  44079.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  44080.      * @throws \InvalidArgumentException
  44081.      * @return \GuzzleHttp\Psr7\Request  */
  44082.     protected function getReceiptRequest($xero_tenant_id$receipt_id$unitdp null)
  44083.     {
  44084.         // verify the required parameter 'xero_tenant_id' is set
  44085.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  44086.             throw new \InvalidArgumentException(
  44087.                 'Missing the required parameter $xero_tenant_id when calling getReceipt'
  44088.             );
  44089.         }
  44090.         // verify the required parameter 'receipt_id' is set
  44091.         if ($receipt_id === null || (is_array($receipt_id) && count($receipt_id) === 0)) {
  44092.             throw new \InvalidArgumentException(
  44093.                 'Missing the required parameter $receipt_id when calling getReceipt'
  44094.             );
  44095.         }
  44096.         $resourcePath '/Receipts/{ReceiptID}';
  44097.         $formParams = [];
  44098.         $queryParams = [];
  44099.         $headerParams = [];
  44100.         $httpBody '';
  44101.         $multipart false;
  44102.         // query params
  44103.         if ($unitdp !== null) {
  44104.             $queryParams['unitdp'] = AccountingObjectSerializer::toQueryValue($unitdp);
  44105.         }
  44106.         // header params
  44107.         if ($xero_tenant_id !== null) {
  44108.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  44109.         }
  44110.         // path params
  44111.         if ($receipt_id !== null) {
  44112.             $resourcePath str_replace(
  44113.                 '{' 'ReceiptID' '}',
  44114.                 AccountingObjectSerializer::toPathValue($receipt_id),
  44115.                 $resourcePath
  44116.             );
  44117.         }
  44118.         // body params
  44119.         $_tempBody null;
  44120.         if ($multipart) {
  44121.             $headers $this->headerSelector->selectHeadersForMultipart(
  44122.                 ['application/json']
  44123.             );
  44124.         } else {
  44125.             $headers $this->headerSelector->selectHeaders(
  44126.                 ['application/json'],
  44127.                 []
  44128.             );
  44129.         }
  44130.         // for model (json/xml)
  44131.         if (isset($_tempBody)) {
  44132.             // $_tempBody is the method argument, if present
  44133.             if ($headers['Content-Type'] === 'application/json') {
  44134.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  44135.             } else {
  44136.                 $httpBody $_tempBody;
  44137.             }
  44138.         } elseif (count($formParams) > 0) {
  44139.             if ($multipart) {
  44140.                 $multipartContents = [
  44141.                     [
  44142.                         'Content-type' => 'multipart/form-data',
  44143.                     ]
  44144.                 ];
  44145.                 
  44146.                 // for HTTP post (form)
  44147.                 $httpBody = new MultipartStream($multipartContents);
  44148.             } elseif ($headers['Content-Type'] === 'application/json') {
  44149.                 $httpBody \GuzzleHttp\json_encode($formParams);
  44150.             } else {
  44151.                 // for HTTP post (form)
  44152.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  44153.             }
  44154.         }
  44155.         // this endpoint requires OAuth (access token)
  44156.         if ($this->config->getAccessToken() !== null) {
  44157.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  44158.         }
  44159.         $defaultHeaders = [];
  44160.         if ($this->config->getUserAgent()) {
  44161.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  44162.         }
  44163.         $headers array_merge(
  44164.             $defaultHeaders,
  44165.             $headerParams,
  44166.             $headers
  44167.         );
  44168.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  44169.         return new Request(
  44170.             'GET',
  44171.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  44172.             $headers,
  44173.             $httpBody
  44174.         );
  44175.     }
  44176.     /**
  44177.      * Operation getReceiptAttachmentByFileName
  44178.      * Retrieves a specific attachment from a specific expense claim receipts by file name
  44179.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  44180.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  44181.      * @param  string $file_name Name of the attachment (required)
  44182.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  44183.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  44184.      * @throws \InvalidArgumentException
  44185.      * @return \SplFileObject
  44186.      */
  44187.     public function getReceiptAttachmentByFileName($xero_tenant_id$receipt_id$file_name$content_type)
  44188.     {
  44189.         list($response) = $this->getReceiptAttachmentByFileNameWithHttpInfo($xero_tenant_id$receipt_id$file_name$content_type);
  44190.         return $response;
  44191.     }
  44192.     /**
  44193.      * Operation getReceiptAttachmentByFileNameWithHttpInfo
  44194.      * Retrieves a specific attachment from a specific expense claim receipts by file name
  44195.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  44196.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  44197.      * @param  string $file_name Name of the attachment (required)
  44198.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  44199.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  44200.      * @throws \InvalidArgumentException
  44201.      * @return array of \SplFileObject, HTTP status code, HTTP response headers (array of strings)
  44202.      */
  44203.     public function getReceiptAttachmentByFileNameWithHttpInfo($xero_tenant_id$receipt_id$file_name$content_type)
  44204.     {
  44205.         $request $this->getReceiptAttachmentByFileNameRequest($xero_tenant_id$receipt_id$file_name$content_type);
  44206.         try {
  44207.             $options $this->createHttpClientOption();
  44208.             try {
  44209.                 $response $this->client->send($request$options);
  44210.             } catch (RequestException $e) {
  44211.                 throw new ApiException(
  44212.                     "[{$e->getCode()}{$e->getMessage()}",
  44213.                     $e->getCode(),
  44214.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  44215.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  44216.                 );
  44217.             }
  44218.             $statusCode $response->getStatusCode();
  44219.             if ($statusCode 200 || $statusCode 299) {
  44220.                 throw new ApiException(
  44221.                     sprintf(
  44222.                         '[%d] Error connecting to the API (%s)',
  44223.                         $statusCode,
  44224.                         $request->getUri()
  44225.                     ),
  44226.                     $statusCode,
  44227.                     $response->getHeaders(),
  44228.                     $response->getBody()
  44229.                 );
  44230.             }
  44231.             $responseBody $response->getBody();
  44232.             switch($statusCode) {
  44233.                 case 200:
  44234.                     if ('\SplFileObject' === '\SplFileObject') {
  44235.                         $content $responseBody//stream goes to serializer
  44236.                     } else {
  44237.                         $content $responseBody->getContents();
  44238.                     }
  44239.                     return [
  44240.                         AccountingObjectSerializer::deserialize($content'\SplFileObject', []),
  44241.                         $response->getStatusCode(),
  44242.                         $response->getHeaders()
  44243.                     ];
  44244.             }
  44245.             $returnType '\SplFileObject';
  44246.             $responseBody $response->getBody();
  44247.             if ($returnType === '\SplFileObject') {
  44248.                 $content $responseBody//stream goes to serializer
  44249.             } else {
  44250.                 $content $responseBody->getContents();
  44251.             }
  44252.             return [
  44253.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  44254.                 $response->getStatusCode(),
  44255.                 $response->getHeaders()
  44256.             ];
  44257.         } catch (ApiException $e) {
  44258.             switch ($e->getCode()) {
  44259.                 case 200:
  44260.                     $data AccountingObjectSerializer::deserialize(
  44261.                         $e->getResponseBody(),
  44262.                         '\SplFileObject',
  44263.                         $e->getResponseHeaders()
  44264.                     );
  44265.                     $e->setResponseObject($data);
  44266.                     break;
  44267.             }
  44268.             throw $e;
  44269.         }
  44270.     }
  44271.     /**
  44272.      * Operation getReceiptAttachmentByFileNameAsync
  44273.      * Retrieves a specific attachment from a specific expense claim receipts by file name
  44274.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  44275.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  44276.      * @param  string $file_name Name of the attachment (required)
  44277.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  44278.      * @throws \InvalidArgumentException
  44279.      * @return \GuzzleHttp\Promise\PromiseInterface
  44280.      */
  44281.     public function getReceiptAttachmentByFileNameAsync($xero_tenant_id$receipt_id$file_name$content_type)
  44282.     {
  44283.         return $this->getReceiptAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$receipt_id$file_name$content_type)
  44284.             ->then(
  44285.                 function ($response) {
  44286.                     return $response[0];
  44287.                 }
  44288.             );
  44289.     }
  44290.     /**
  44291.      * Operation getReceiptAttachmentByFileNameAsyncWithHttpInfo
  44292.      * Retrieves a specific attachment from a specific expense claim receipts by file name
  44293.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  44294.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  44295.      * @param  string $file_name Name of the attachment (required)
  44296.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  44297.      * @throws \InvalidArgumentException
  44298.      * @return \GuzzleHttp\Promise\PromiseInterface */
  44299.     public function getReceiptAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$receipt_id$file_name$content_type)
  44300.     {
  44301.         $returnType '\SplFileObject';
  44302.         $request $this->getReceiptAttachmentByFileNameRequest($xero_tenant_id$receipt_id$file_name$content_type);
  44303.         return $this->client
  44304.             ->sendAsync($request$this->createHttpClientOption())
  44305.             ->then(
  44306.                 function ($response) use ($returnType) {
  44307.                     $responseBody $response->getBody();
  44308.                     if ($returnType === '\SplFileObject') {
  44309.                         $content $responseBody//stream goes to serializer
  44310.                     } else {
  44311.                         $content $responseBody->getContents();
  44312.                     }
  44313.                     return [
  44314.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  44315.                         $response->getStatusCode(),
  44316.                         $response->getHeaders()
  44317.                     ];
  44318.                 },
  44319.                 function ($exception) {
  44320.                     $response $exception->getResponse();
  44321.                     $statusCode $response->getStatusCode();
  44322.                     throw new ApiException(
  44323.                         sprintf(
  44324.                             '[%d] Error connecting to the API (%s)',
  44325.                             $statusCode,
  44326.                             $exception->getRequest()->getUri()
  44327.                         ),
  44328.                         $statusCode,
  44329.                         $response->getHeaders(),
  44330.                         $response->getBody()
  44331.                     );
  44332.                 }
  44333.             );
  44334.     }
  44335.     /**
  44336.      * Create request for operation 'getReceiptAttachmentByFileName'
  44337.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  44338.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  44339.      * @param  string $file_name Name of the attachment (required)
  44340.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  44341.      * @throws \InvalidArgumentException
  44342.      * @return \GuzzleHttp\Psr7\Request  */
  44343.     protected function getReceiptAttachmentByFileNameRequest($xero_tenant_id$receipt_id$file_name$content_type)
  44344.     {
  44345.         // verify the required parameter 'xero_tenant_id' is set
  44346.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  44347.             throw new \InvalidArgumentException(
  44348.                 'Missing the required parameter $xero_tenant_id when calling getReceiptAttachmentByFileName'
  44349.             );
  44350.         }
  44351.         // verify the required parameter 'receipt_id' is set
  44352.         if ($receipt_id === null || (is_array($receipt_id) && count($receipt_id) === 0)) {
  44353.             throw new \InvalidArgumentException(
  44354.                 'Missing the required parameter $receipt_id when calling getReceiptAttachmentByFileName'
  44355.             );
  44356.         }
  44357.         // verify the required parameter 'file_name' is set
  44358.         if ($file_name === null || (is_array($file_name) && count($file_name) === 0)) {
  44359.             throw new \InvalidArgumentException(
  44360.                 'Missing the required parameter $file_name when calling getReceiptAttachmentByFileName'
  44361.             );
  44362.         }
  44363.         // verify the required parameter 'content_type' is set
  44364.         if ($content_type === null || (is_array($content_type) && count($content_type) === 0)) {
  44365.             throw new \InvalidArgumentException(
  44366.                 'Missing the required parameter $content_type when calling getReceiptAttachmentByFileName'
  44367.             );
  44368.         }
  44369.         $resourcePath '/Receipts/{ReceiptID}/Attachments/{FileName}';
  44370.         $formParams = [];
  44371.         $queryParams = [];
  44372.         $headerParams = [];
  44373.         $httpBody '';
  44374.         $multipart false;
  44375.         // header params
  44376.         if ($xero_tenant_id !== null) {
  44377.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  44378.         }
  44379.         // header params
  44380.         if ($content_type !== null) {
  44381.             $headerParams['contentType'] = AccountingObjectSerializer::toHeaderValue($content_type);
  44382.         }
  44383.         // path params
  44384.         if ($receipt_id !== null) {
  44385.             $resourcePath str_replace(
  44386.                 '{' 'ReceiptID' '}',
  44387.                 AccountingObjectSerializer::toPathValue($receipt_id),
  44388.                 $resourcePath
  44389.             );
  44390.         }
  44391.         // path params
  44392.         if ($file_name !== null) {
  44393.             $resourcePath str_replace(
  44394.                 '{' 'FileName' '}',
  44395.                 AccountingObjectSerializer::toPathValue($file_name),
  44396.                 $resourcePath
  44397.             );
  44398.         }
  44399.         // body params
  44400.         $_tempBody null;
  44401.         if ($multipart) {
  44402.             $headers $this->headerSelector->selectHeadersForMultipart(
  44403.                 ['application/octet-stream']
  44404.             );
  44405.         } else {
  44406.             $headers $this->headerSelector->selectHeaders(
  44407.                 ['application/octet-stream'],
  44408.                 []
  44409.             );
  44410.         }
  44411.         // for model (json/xml)
  44412.         if (isset($_tempBody)) {
  44413.             // $_tempBody is the method argument, if present
  44414.             if ($headers['Content-Type'] === 'application/json') {
  44415.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  44416.             } else {
  44417.                 $httpBody $_tempBody;
  44418.             }
  44419.         } elseif (count($formParams) > 0) {
  44420.             if ($multipart) {
  44421.                 $multipartContents = [
  44422.                     [
  44423.                         'Content-type' => 'multipart/form-data',
  44424.                     ]
  44425.                 ];
  44426.                 
  44427.                 // for HTTP post (form)
  44428.                 $httpBody = new MultipartStream($multipartContents);
  44429.             } elseif ($headers['Content-Type'] === 'application/json') {
  44430.                 $httpBody \GuzzleHttp\json_encode($formParams);
  44431.             } else {
  44432.                 // for HTTP post (form)
  44433.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  44434.             }
  44435.         }
  44436.         // this endpoint requires OAuth (access token)
  44437.         if ($this->config->getAccessToken() !== null) {
  44438.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  44439.         }
  44440.         $defaultHeaders = [];
  44441.         if ($this->config->getUserAgent()) {
  44442.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  44443.         }
  44444.         $headers array_merge(
  44445.             $defaultHeaders,
  44446.             $headerParams,
  44447.             $headers
  44448.         );
  44449.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  44450.         return new Request(
  44451.             'GET',
  44452.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  44453.             $headers,
  44454.             $httpBody
  44455.         );
  44456.     }
  44457.     /**
  44458.      * Operation getReceiptAttachmentById
  44459.      * Retrieves a specific attachments from a specific expense claim receipts by using a unique attachment Id
  44460.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  44461.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  44462.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  44463.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  44464.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  44465.      * @throws \InvalidArgumentException
  44466.      * @return \SplFileObject
  44467.      */
  44468.     public function getReceiptAttachmentById($xero_tenant_id$receipt_id$attachment_id$content_type)
  44469.     {
  44470.         list($response) = $this->getReceiptAttachmentByIdWithHttpInfo($xero_tenant_id$receipt_id$attachment_id$content_type);
  44471.         return $response;
  44472.     }
  44473.     /**
  44474.      * Operation getReceiptAttachmentByIdWithHttpInfo
  44475.      * Retrieves a specific attachments from a specific expense claim receipts by using a unique attachment Id
  44476.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  44477.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  44478.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  44479.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  44480.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  44481.      * @throws \InvalidArgumentException
  44482.      * @return array of \SplFileObject, HTTP status code, HTTP response headers (array of strings)
  44483.      */
  44484.     public function getReceiptAttachmentByIdWithHttpInfo($xero_tenant_id$receipt_id$attachment_id$content_type)
  44485.     {
  44486.         $request $this->getReceiptAttachmentByIdRequest($xero_tenant_id$receipt_id$attachment_id$content_type);
  44487.         try {
  44488.             $options $this->createHttpClientOption();
  44489.             try {
  44490.                 $response $this->client->send($request$options);
  44491.             } catch (RequestException $e) {
  44492.                 throw new ApiException(
  44493.                     "[{$e->getCode()}{$e->getMessage()}",
  44494.                     $e->getCode(),
  44495.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  44496.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  44497.                 );
  44498.             }
  44499.             $statusCode $response->getStatusCode();
  44500.             if ($statusCode 200 || $statusCode 299) {
  44501.                 throw new ApiException(
  44502.                     sprintf(
  44503.                         '[%d] Error connecting to the API (%s)',
  44504.                         $statusCode,
  44505.                         $request->getUri()
  44506.                     ),
  44507.                     $statusCode,
  44508.                     $response->getHeaders(),
  44509.                     $response->getBody()
  44510.                 );
  44511.             }
  44512.             $responseBody $response->getBody();
  44513.             switch($statusCode) {
  44514.                 case 200:
  44515.                     if ('\SplFileObject' === '\SplFileObject') {
  44516.                         $content $responseBody//stream goes to serializer
  44517.                     } else {
  44518.                         $content $responseBody->getContents();
  44519.                     }
  44520.                     return [
  44521.                         AccountingObjectSerializer::deserialize($content'\SplFileObject', []),
  44522.                         $response->getStatusCode(),
  44523.                         $response->getHeaders()
  44524.                     ];
  44525.             }
  44526.             $returnType '\SplFileObject';
  44527.             $responseBody $response->getBody();
  44528.             if ($returnType === '\SplFileObject') {
  44529.                 $content $responseBody//stream goes to serializer
  44530.             } else {
  44531.                 $content $responseBody->getContents();
  44532.             }
  44533.             return [
  44534.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  44535.                 $response->getStatusCode(),
  44536.                 $response->getHeaders()
  44537.             ];
  44538.         } catch (ApiException $e) {
  44539.             switch ($e->getCode()) {
  44540.                 case 200:
  44541.                     $data AccountingObjectSerializer::deserialize(
  44542.                         $e->getResponseBody(),
  44543.                         '\SplFileObject',
  44544.                         $e->getResponseHeaders()
  44545.                     );
  44546.                     $e->setResponseObject($data);
  44547.                     break;
  44548.             }
  44549.             throw $e;
  44550.         }
  44551.     }
  44552.     /**
  44553.      * Operation getReceiptAttachmentByIdAsync
  44554.      * Retrieves a specific attachments from a specific expense claim receipts by using a unique attachment Id
  44555.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  44556.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  44557.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  44558.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  44559.      * @throws \InvalidArgumentException
  44560.      * @return \GuzzleHttp\Promise\PromiseInterface
  44561.      */
  44562.     public function getReceiptAttachmentByIdAsync($xero_tenant_id$receipt_id$attachment_id$content_type)
  44563.     {
  44564.         return $this->getReceiptAttachmentByIdAsyncWithHttpInfo($xero_tenant_id$receipt_id$attachment_id$content_type)
  44565.             ->then(
  44566.                 function ($response) {
  44567.                     return $response[0];
  44568.                 }
  44569.             );
  44570.     }
  44571.     /**
  44572.      * Operation getReceiptAttachmentByIdAsyncWithHttpInfo
  44573.      * Retrieves a specific attachments from a specific expense claim receipts by using a unique attachment Id
  44574.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  44575.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  44576.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  44577.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  44578.      * @throws \InvalidArgumentException
  44579.      * @return \GuzzleHttp\Promise\PromiseInterface */
  44580.     public function getReceiptAttachmentByIdAsyncWithHttpInfo($xero_tenant_id$receipt_id$attachment_id$content_type)
  44581.     {
  44582.         $returnType '\SplFileObject';
  44583.         $request $this->getReceiptAttachmentByIdRequest($xero_tenant_id$receipt_id$attachment_id$content_type);
  44584.         return $this->client
  44585.             ->sendAsync($request$this->createHttpClientOption())
  44586.             ->then(
  44587.                 function ($response) use ($returnType) {
  44588.                     $responseBody $response->getBody();
  44589.                     if ($returnType === '\SplFileObject') {
  44590.                         $content $responseBody//stream goes to serializer
  44591.                     } else {
  44592.                         $content $responseBody->getContents();
  44593.                     }
  44594.                     return [
  44595.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  44596.                         $response->getStatusCode(),
  44597.                         $response->getHeaders()
  44598.                     ];
  44599.                 },
  44600.                 function ($exception) {
  44601.                     $response $exception->getResponse();
  44602.                     $statusCode $response->getStatusCode();
  44603.                     throw new ApiException(
  44604.                         sprintf(
  44605.                             '[%d] Error connecting to the API (%s)',
  44606.                             $statusCode,
  44607.                             $exception->getRequest()->getUri()
  44608.                         ),
  44609.                         $statusCode,
  44610.                         $response->getHeaders(),
  44611.                         $response->getBody()
  44612.                     );
  44613.                 }
  44614.             );
  44615.     }
  44616.     /**
  44617.      * Create request for operation 'getReceiptAttachmentById'
  44618.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  44619.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  44620.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  44621.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  44622.      * @throws \InvalidArgumentException
  44623.      * @return \GuzzleHttp\Psr7\Request  */
  44624.     protected function getReceiptAttachmentByIdRequest($xero_tenant_id$receipt_id$attachment_id$content_type)
  44625.     {
  44626.         // verify the required parameter 'xero_tenant_id' is set
  44627.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  44628.             throw new \InvalidArgumentException(
  44629.                 'Missing the required parameter $xero_tenant_id when calling getReceiptAttachmentById'
  44630.             );
  44631.         }
  44632.         // verify the required parameter 'receipt_id' is set
  44633.         if ($receipt_id === null || (is_array($receipt_id) && count($receipt_id) === 0)) {
  44634.             throw new \InvalidArgumentException(
  44635.                 'Missing the required parameter $receipt_id when calling getReceiptAttachmentById'
  44636.             );
  44637.         }
  44638.         // verify the required parameter 'attachment_id' is set
  44639.         if ($attachment_id === null || (is_array($attachment_id) && count($attachment_id) === 0)) {
  44640.             throw new \InvalidArgumentException(
  44641.                 'Missing the required parameter $attachment_id when calling getReceiptAttachmentById'
  44642.             );
  44643.         }
  44644.         // verify the required parameter 'content_type' is set
  44645.         if ($content_type === null || (is_array($content_type) && count($content_type) === 0)) {
  44646.             throw new \InvalidArgumentException(
  44647.                 'Missing the required parameter $content_type when calling getReceiptAttachmentById'
  44648.             );
  44649.         }
  44650.         $resourcePath '/Receipts/{ReceiptID}/Attachments/{AttachmentID}';
  44651.         $formParams = [];
  44652.         $queryParams = [];
  44653.         $headerParams = [];
  44654.         $httpBody '';
  44655.         $multipart false;
  44656.         // header params
  44657.         if ($xero_tenant_id !== null) {
  44658.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  44659.         }
  44660.         // header params
  44661.         if ($content_type !== null) {
  44662.             $headerParams['contentType'] = AccountingObjectSerializer::toHeaderValue($content_type);
  44663.         }
  44664.         // path params
  44665.         if ($receipt_id !== null) {
  44666.             $resourcePath str_replace(
  44667.                 '{' 'ReceiptID' '}',
  44668.                 AccountingObjectSerializer::toPathValue($receipt_id),
  44669.                 $resourcePath
  44670.             );
  44671.         }
  44672.         // path params
  44673.         if ($attachment_id !== null) {
  44674.             $resourcePath str_replace(
  44675.                 '{' 'AttachmentID' '}',
  44676.                 AccountingObjectSerializer::toPathValue($attachment_id),
  44677.                 $resourcePath
  44678.             );
  44679.         }
  44680.         // body params
  44681.         $_tempBody null;
  44682.         if ($multipart) {
  44683.             $headers $this->headerSelector->selectHeadersForMultipart(
  44684.                 ['application/octet-stream']
  44685.             );
  44686.         } else {
  44687.             $headers $this->headerSelector->selectHeaders(
  44688.                 ['application/octet-stream'],
  44689.                 []
  44690.             );
  44691.         }
  44692.         // for model (json/xml)
  44693.         if (isset($_tempBody)) {
  44694.             // $_tempBody is the method argument, if present
  44695.             if ($headers['Content-Type'] === 'application/json') {
  44696.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  44697.             } else {
  44698.                 $httpBody $_tempBody;
  44699.             }
  44700.         } elseif (count($formParams) > 0) {
  44701.             if ($multipart) {
  44702.                 $multipartContents = [
  44703.                     [
  44704.                         'Content-type' => 'multipart/form-data',
  44705.                     ]
  44706.                 ];
  44707.                 
  44708.                 // for HTTP post (form)
  44709.                 $httpBody = new MultipartStream($multipartContents);
  44710.             } elseif ($headers['Content-Type'] === 'application/json') {
  44711.                 $httpBody \GuzzleHttp\json_encode($formParams);
  44712.             } else {
  44713.                 // for HTTP post (form)
  44714.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  44715.             }
  44716.         }
  44717.         // this endpoint requires OAuth (access token)
  44718.         if ($this->config->getAccessToken() !== null) {
  44719.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  44720.         }
  44721.         $defaultHeaders = [];
  44722.         if ($this->config->getUserAgent()) {
  44723.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  44724.         }
  44725.         $headers array_merge(
  44726.             $defaultHeaders,
  44727.             $headerParams,
  44728.             $headers
  44729.         );
  44730.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  44731.         return new Request(
  44732.             'GET',
  44733.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  44734.             $headers,
  44735.             $httpBody
  44736.         );
  44737.     }
  44738.     /**
  44739.      * Operation getReceiptAttachments
  44740.      * Retrieves attachments for a specific expense claim receipt
  44741.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  44742.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  44743.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  44744.      * @throws \InvalidArgumentException
  44745.      * @return \XeroAPI\XeroPHP\Models\Accounting\Attachments
  44746.      */
  44747.     public function getReceiptAttachments($xero_tenant_id$receipt_id)
  44748.     {
  44749.         list($response) = $this->getReceiptAttachmentsWithHttpInfo($xero_tenant_id$receipt_id);
  44750.         return $response;
  44751.     }
  44752.     /**
  44753.      * Operation getReceiptAttachmentsWithHttpInfo
  44754.      * Retrieves attachments for a specific expense claim receipt
  44755.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  44756.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  44757.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  44758.      * @throws \InvalidArgumentException
  44759.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Attachments, HTTP status code, HTTP response headers (array of strings)
  44760.      */
  44761.     public function getReceiptAttachmentsWithHttpInfo($xero_tenant_id$receipt_id)
  44762.     {
  44763.         $request $this->getReceiptAttachmentsRequest($xero_tenant_id$receipt_id);
  44764.         try {
  44765.             $options $this->createHttpClientOption();
  44766.             try {
  44767.                 $response $this->client->send($request$options);
  44768.             } catch (RequestException $e) {
  44769.                 throw new ApiException(
  44770.                     "[{$e->getCode()}{$e->getMessage()}",
  44771.                     $e->getCode(),
  44772.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  44773.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  44774.                 );
  44775.             }
  44776.             $statusCode $response->getStatusCode();
  44777.             if ($statusCode 200 || $statusCode 299) {
  44778.                 throw new ApiException(
  44779.                     sprintf(
  44780.                         '[%d] Error connecting to the API (%s)',
  44781.                         $statusCode,
  44782.                         $request->getUri()
  44783.                     ),
  44784.                     $statusCode,
  44785.                     $response->getHeaders(),
  44786.                     $response->getBody()
  44787.                 );
  44788.             }
  44789.             $responseBody $response->getBody();
  44790.             switch($statusCode) {
  44791.                 case 200:
  44792.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Attachments' === '\SplFileObject') {
  44793.                         $content $responseBody//stream goes to serializer
  44794.                     } else {
  44795.                         $content $responseBody->getContents();
  44796.                     }
  44797.                     return [
  44798.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Attachments', []),
  44799.                         $response->getStatusCode(),
  44800.                         $response->getHeaders()
  44801.                     ];
  44802.             }
  44803.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  44804.             $responseBody $response->getBody();
  44805.             if ($returnType === '\SplFileObject') {
  44806.                 $content $responseBody//stream goes to serializer
  44807.             } else {
  44808.                 $content $responseBody->getContents();
  44809.             }
  44810.             return [
  44811.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  44812.                 $response->getStatusCode(),
  44813.                 $response->getHeaders()
  44814.             ];
  44815.         } catch (ApiException $e) {
  44816.             switch ($e->getCode()) {
  44817.                 case 200:
  44818.                     $data AccountingObjectSerializer::deserialize(
  44819.                         $e->getResponseBody(),
  44820.                         '\XeroAPI\XeroPHP\Models\Accounting\Attachments',
  44821.                         $e->getResponseHeaders()
  44822.                     );
  44823.                     $e->setResponseObject($data);
  44824.                     break;
  44825.             }
  44826.             throw $e;
  44827.         }
  44828.     }
  44829.     /**
  44830.      * Operation getReceiptAttachmentsAsync
  44831.      * Retrieves attachments for a specific expense claim receipt
  44832.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  44833.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  44834.      * @throws \InvalidArgumentException
  44835.      * @return \GuzzleHttp\Promise\PromiseInterface
  44836.      */
  44837.     public function getReceiptAttachmentsAsync($xero_tenant_id$receipt_id)
  44838.     {
  44839.         return $this->getReceiptAttachmentsAsyncWithHttpInfo($xero_tenant_id$receipt_id)
  44840.             ->then(
  44841.                 function ($response) {
  44842.                     return $response[0];
  44843.                 }
  44844.             );
  44845.     }
  44846.     /**
  44847.      * Operation getReceiptAttachmentsAsyncWithHttpInfo
  44848.      * Retrieves attachments for a specific expense claim receipt
  44849.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  44850.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  44851.      * @throws \InvalidArgumentException
  44852.      * @return \GuzzleHttp\Promise\PromiseInterface */
  44853.     public function getReceiptAttachmentsAsyncWithHttpInfo($xero_tenant_id$receipt_id)
  44854.     {
  44855.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  44856.         $request $this->getReceiptAttachmentsRequest($xero_tenant_id$receipt_id);
  44857.         return $this->client
  44858.             ->sendAsync($request$this->createHttpClientOption())
  44859.             ->then(
  44860.                 function ($response) use ($returnType) {
  44861.                     $responseBody $response->getBody();
  44862.                     if ($returnType === '\SplFileObject') {
  44863.                         $content $responseBody//stream goes to serializer
  44864.                     } else {
  44865.                         $content $responseBody->getContents();
  44866.                     }
  44867.                     return [
  44868.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  44869.                         $response->getStatusCode(),
  44870.                         $response->getHeaders()
  44871.                     ];
  44872.                 },
  44873.                 function ($exception) {
  44874.                     $response $exception->getResponse();
  44875.                     $statusCode $response->getStatusCode();
  44876.                     throw new ApiException(
  44877.                         sprintf(
  44878.                             '[%d] Error connecting to the API (%s)',
  44879.                             $statusCode,
  44880.                             $exception->getRequest()->getUri()
  44881.                         ),
  44882.                         $statusCode,
  44883.                         $response->getHeaders(),
  44884.                         $response->getBody()
  44885.                     );
  44886.                 }
  44887.             );
  44888.     }
  44889.     /**
  44890.      * Create request for operation 'getReceiptAttachments'
  44891.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  44892.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  44893.      * @throws \InvalidArgumentException
  44894.      * @return \GuzzleHttp\Psr7\Request  */
  44895.     protected function getReceiptAttachmentsRequest($xero_tenant_id$receipt_id)
  44896.     {
  44897.         // verify the required parameter 'xero_tenant_id' is set
  44898.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  44899.             throw new \InvalidArgumentException(
  44900.                 'Missing the required parameter $xero_tenant_id when calling getReceiptAttachments'
  44901.             );
  44902.         }
  44903.         // verify the required parameter 'receipt_id' is set
  44904.         if ($receipt_id === null || (is_array($receipt_id) && count($receipt_id) === 0)) {
  44905.             throw new \InvalidArgumentException(
  44906.                 'Missing the required parameter $receipt_id when calling getReceiptAttachments'
  44907.             );
  44908.         }
  44909.         $resourcePath '/Receipts/{ReceiptID}/Attachments';
  44910.         $formParams = [];
  44911.         $queryParams = [];
  44912.         $headerParams = [];
  44913.         $httpBody '';
  44914.         $multipart false;
  44915.         // header params
  44916.         if ($xero_tenant_id !== null) {
  44917.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  44918.         }
  44919.         // path params
  44920.         if ($receipt_id !== null) {
  44921.             $resourcePath str_replace(
  44922.                 '{' 'ReceiptID' '}',
  44923.                 AccountingObjectSerializer::toPathValue($receipt_id),
  44924.                 $resourcePath
  44925.             );
  44926.         }
  44927.         // body params
  44928.         $_tempBody null;
  44929.         if ($multipart) {
  44930.             $headers $this->headerSelector->selectHeadersForMultipart(
  44931.                 ['application/json']
  44932.             );
  44933.         } else {
  44934.             $headers $this->headerSelector->selectHeaders(
  44935.                 ['application/json'],
  44936.                 []
  44937.             );
  44938.         }
  44939.         // for model (json/xml)
  44940.         if (isset($_tempBody)) {
  44941.             // $_tempBody is the method argument, if present
  44942.             if ($headers['Content-Type'] === 'application/json') {
  44943.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  44944.             } else {
  44945.                 $httpBody $_tempBody;
  44946.             }
  44947.         } elseif (count($formParams) > 0) {
  44948.             if ($multipart) {
  44949.                 $multipartContents = [
  44950.                     [
  44951.                         'Content-type' => 'multipart/form-data',
  44952.                     ]
  44953.                 ];
  44954.                 
  44955.                 // for HTTP post (form)
  44956.                 $httpBody = new MultipartStream($multipartContents);
  44957.             } elseif ($headers['Content-Type'] === 'application/json') {
  44958.                 $httpBody \GuzzleHttp\json_encode($formParams);
  44959.             } else {
  44960.                 // for HTTP post (form)
  44961.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  44962.             }
  44963.         }
  44964.         // this endpoint requires OAuth (access token)
  44965.         if ($this->config->getAccessToken() !== null) {
  44966.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  44967.         }
  44968.         $defaultHeaders = [];
  44969.         if ($this->config->getUserAgent()) {
  44970.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  44971.         }
  44972.         $headers array_merge(
  44973.             $defaultHeaders,
  44974.             $headerParams,
  44975.             $headers
  44976.         );
  44977.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  44978.         return new Request(
  44979.             'GET',
  44980.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  44981.             $headers,
  44982.             $httpBody
  44983.         );
  44984.     }
  44985.     /**
  44986.      * Operation getReceiptHistory
  44987.      * Retrieves a history record for a specific receipt
  44988.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  44989.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  44990.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  44991.      * @throws \InvalidArgumentException
  44992.      * @return \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords
  44993.      */
  44994.     public function getReceiptHistory($xero_tenant_id$receipt_id)
  44995.     {
  44996.         list($response) = $this->getReceiptHistoryWithHttpInfo($xero_tenant_id$receipt_id);
  44997.         return $response;
  44998.     }
  44999.     /**
  45000.      * Operation getReceiptHistoryWithHttpInfo
  45001.      * Retrieves a history record for a specific receipt
  45002.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  45003.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  45004.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  45005.      * @throws \InvalidArgumentException
  45006.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords, HTTP status code, HTTP response headers (array of strings)
  45007.      */
  45008.     public function getReceiptHistoryWithHttpInfo($xero_tenant_id$receipt_id)
  45009.     {
  45010.         $request $this->getReceiptHistoryRequest($xero_tenant_id$receipt_id);
  45011.         try {
  45012.             $options $this->createHttpClientOption();
  45013.             try {
  45014.                 $response $this->client->send($request$options);
  45015.             } catch (RequestException $e) {
  45016.                 throw new ApiException(
  45017.                     "[{$e->getCode()}{$e->getMessage()}",
  45018.                     $e->getCode(),
  45019.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  45020.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  45021.                 );
  45022.             }
  45023.             $statusCode $response->getStatusCode();
  45024.             if ($statusCode 200 || $statusCode 299) {
  45025.                 throw new ApiException(
  45026.                     sprintf(
  45027.                         '[%d] Error connecting to the API (%s)',
  45028.                         $statusCode,
  45029.                         $request->getUri()
  45030.                     ),
  45031.                     $statusCode,
  45032.                     $response->getHeaders(),
  45033.                     $response->getBody()
  45034.                 );
  45035.             }
  45036.             $responseBody $response->getBody();
  45037.             switch($statusCode) {
  45038.                 case 200:
  45039.                     if ('\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords' === '\SplFileObject') {
  45040.                         $content $responseBody//stream goes to serializer
  45041.                     } else {
  45042.                         $content $responseBody->getContents();
  45043.                     }
  45044.                     return [
  45045.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords', []),
  45046.                         $response->getStatusCode(),
  45047.                         $response->getHeaders()
  45048.                     ];
  45049.             }
  45050.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  45051.             $responseBody $response->getBody();
  45052.             if ($returnType === '\SplFileObject') {
  45053.                 $content $responseBody//stream goes to serializer
  45054.             } else {
  45055.                 $content $responseBody->getContents();
  45056.             }
  45057.             return [
  45058.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  45059.                 $response->getStatusCode(),
  45060.                 $response->getHeaders()
  45061.             ];
  45062.         } catch (ApiException $e) {
  45063.             switch ($e->getCode()) {
  45064.                 case 200:
  45065.                     $data AccountingObjectSerializer::deserialize(
  45066.                         $e->getResponseBody(),
  45067.                         '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords',
  45068.                         $e->getResponseHeaders()
  45069.                     );
  45070.                     $e->setResponseObject($data);
  45071.                     break;
  45072.             }
  45073.             throw $e;
  45074.         }
  45075.     }
  45076.     /**
  45077.      * Operation getReceiptHistoryAsync
  45078.      * Retrieves a history record for a specific receipt
  45079.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  45080.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  45081.      * @throws \InvalidArgumentException
  45082.      * @return \GuzzleHttp\Promise\PromiseInterface
  45083.      */
  45084.     public function getReceiptHistoryAsync($xero_tenant_id$receipt_id)
  45085.     {
  45086.         return $this->getReceiptHistoryAsyncWithHttpInfo($xero_tenant_id$receipt_id)
  45087.             ->then(
  45088.                 function ($response) {
  45089.                     return $response[0];
  45090.                 }
  45091.             );
  45092.     }
  45093.     /**
  45094.      * Operation getReceiptHistoryAsyncWithHttpInfo
  45095.      * Retrieves a history record for a specific receipt
  45096.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  45097.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  45098.      * @throws \InvalidArgumentException
  45099.      * @return \GuzzleHttp\Promise\PromiseInterface */
  45100.     public function getReceiptHistoryAsyncWithHttpInfo($xero_tenant_id$receipt_id)
  45101.     {
  45102.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  45103.         $request $this->getReceiptHistoryRequest($xero_tenant_id$receipt_id);
  45104.         return $this->client
  45105.             ->sendAsync($request$this->createHttpClientOption())
  45106.             ->then(
  45107.                 function ($response) use ($returnType) {
  45108.                     $responseBody $response->getBody();
  45109.                     if ($returnType === '\SplFileObject') {
  45110.                         $content $responseBody//stream goes to serializer
  45111.                     } else {
  45112.                         $content $responseBody->getContents();
  45113.                     }
  45114.                     return [
  45115.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  45116.                         $response->getStatusCode(),
  45117.                         $response->getHeaders()
  45118.                     ];
  45119.                 },
  45120.                 function ($exception) {
  45121.                     $response $exception->getResponse();
  45122.                     $statusCode $response->getStatusCode();
  45123.                     throw new ApiException(
  45124.                         sprintf(
  45125.                             '[%d] Error connecting to the API (%s)',
  45126.                             $statusCode,
  45127.                             $exception->getRequest()->getUri()
  45128.                         ),
  45129.                         $statusCode,
  45130.                         $response->getHeaders(),
  45131.                         $response->getBody()
  45132.                     );
  45133.                 }
  45134.             );
  45135.     }
  45136.     /**
  45137.      * Create request for operation 'getReceiptHistory'
  45138.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  45139.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  45140.      * @throws \InvalidArgumentException
  45141.      * @return \GuzzleHttp\Psr7\Request  */
  45142.     protected function getReceiptHistoryRequest($xero_tenant_id$receipt_id)
  45143.     {
  45144.         // verify the required parameter 'xero_tenant_id' is set
  45145.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  45146.             throw new \InvalidArgumentException(
  45147.                 'Missing the required parameter $xero_tenant_id when calling getReceiptHistory'
  45148.             );
  45149.         }
  45150.         // verify the required parameter 'receipt_id' is set
  45151.         if ($receipt_id === null || (is_array($receipt_id) && count($receipt_id) === 0)) {
  45152.             throw new \InvalidArgumentException(
  45153.                 'Missing the required parameter $receipt_id when calling getReceiptHistory'
  45154.             );
  45155.         }
  45156.         $resourcePath '/Receipts/{ReceiptID}/History';
  45157.         $formParams = [];
  45158.         $queryParams = [];
  45159.         $headerParams = [];
  45160.         $httpBody '';
  45161.         $multipart false;
  45162.         // header params
  45163.         if ($xero_tenant_id !== null) {
  45164.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  45165.         }
  45166.         // path params
  45167.         if ($receipt_id !== null) {
  45168.             $resourcePath str_replace(
  45169.                 '{' 'ReceiptID' '}',
  45170.                 AccountingObjectSerializer::toPathValue($receipt_id),
  45171.                 $resourcePath
  45172.             );
  45173.         }
  45174.         // body params
  45175.         $_tempBody null;
  45176.         if ($multipart) {
  45177.             $headers $this->headerSelector->selectHeadersForMultipart(
  45178.                 ['application/json']
  45179.             );
  45180.         } else {
  45181.             $headers $this->headerSelector->selectHeaders(
  45182.                 ['application/json'],
  45183.                 []
  45184.             );
  45185.         }
  45186.         // for model (json/xml)
  45187.         if (isset($_tempBody)) {
  45188.             // $_tempBody is the method argument, if present
  45189.             if ($headers['Content-Type'] === 'application/json') {
  45190.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  45191.             } else {
  45192.                 $httpBody $_tempBody;
  45193.             }
  45194.         } elseif (count($formParams) > 0) {
  45195.             if ($multipart) {
  45196.                 $multipartContents = [
  45197.                     [
  45198.                         'Content-type' => 'multipart/form-data',
  45199.                     ]
  45200.                 ];
  45201.                 
  45202.                 // for HTTP post (form)
  45203.                 $httpBody = new MultipartStream($multipartContents);
  45204.             } elseif ($headers['Content-Type'] === 'application/json') {
  45205.                 $httpBody \GuzzleHttp\json_encode($formParams);
  45206.             } else {
  45207.                 // for HTTP post (form)
  45208.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  45209.             }
  45210.         }
  45211.         // this endpoint requires OAuth (access token)
  45212.         if ($this->config->getAccessToken() !== null) {
  45213.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  45214.         }
  45215.         $defaultHeaders = [];
  45216.         if ($this->config->getUserAgent()) {
  45217.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  45218.         }
  45219.         $headers array_merge(
  45220.             $defaultHeaders,
  45221.             $headerParams,
  45222.             $headers
  45223.         );
  45224.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  45225.         return new Request(
  45226.             'GET',
  45227.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  45228.             $headers,
  45229.             $httpBody
  45230.         );
  45231.     }
  45232.     /**
  45233.      * Operation getReceipts
  45234.      * Retrieves draft expense claim receipts for any user
  45235.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  45236.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  45237.      * @param  string $where Filter by an any element (optional)
  45238.      * @param  string $order Order by an any element (optional)
  45239.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  45240.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  45241.      * @throws \InvalidArgumentException
  45242.      * @return \XeroAPI\XeroPHP\Models\Accounting\Receipts
  45243.      */
  45244.     public function getReceipts($xero_tenant_id$if_modified_since null$where null$order null$unitdp null)
  45245.     {
  45246.         list($response) = $this->getReceiptsWithHttpInfo($xero_tenant_id$if_modified_since$where$order$unitdp);
  45247.         return $response;
  45248.     }
  45249.     /**
  45250.      * Operation getReceiptsWithHttpInfo
  45251.      * Retrieves draft expense claim receipts for any user
  45252.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  45253.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  45254.      * @param  string $where Filter by an any element (optional)
  45255.      * @param  string $order Order by an any element (optional)
  45256.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  45257.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  45258.      * @throws \InvalidArgumentException
  45259.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Receipts, HTTP status code, HTTP response headers (array of strings)
  45260.      */
  45261.     public function getReceiptsWithHttpInfo($xero_tenant_id$if_modified_since null$where null$order null$unitdp null)
  45262.     {
  45263.         $request $this->getReceiptsRequest($xero_tenant_id$if_modified_since$where$order$unitdp);
  45264.         try {
  45265.             $options $this->createHttpClientOption();
  45266.             try {
  45267.                 $response $this->client->send($request$options);
  45268.             } catch (RequestException $e) {
  45269.                 throw new ApiException(
  45270.                     "[{$e->getCode()}{$e->getMessage()}",
  45271.                     $e->getCode(),
  45272.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  45273.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  45274.                 );
  45275.             }
  45276.             $statusCode $response->getStatusCode();
  45277.             if ($statusCode 200 || $statusCode 299) {
  45278.                 throw new ApiException(
  45279.                     sprintf(
  45280.                         '[%d] Error connecting to the API (%s)',
  45281.                         $statusCode,
  45282.                         $request->getUri()
  45283.                     ),
  45284.                     $statusCode,
  45285.                     $response->getHeaders(),
  45286.                     $response->getBody()
  45287.                 );
  45288.             }
  45289.             $responseBody $response->getBody();
  45290.             switch($statusCode) {
  45291.                 case 200:
  45292.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Receipts' === '\SplFileObject') {
  45293.                         $content $responseBody//stream goes to serializer
  45294.                     } else {
  45295.                         $content $responseBody->getContents();
  45296.                     }
  45297.                     return [
  45298.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Receipts', []),
  45299.                         $response->getStatusCode(),
  45300.                         $response->getHeaders()
  45301.                     ];
  45302.             }
  45303.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Receipts';
  45304.             $responseBody $response->getBody();
  45305.             if ($returnType === '\SplFileObject') {
  45306.                 $content $responseBody//stream goes to serializer
  45307.             } else {
  45308.                 $content $responseBody->getContents();
  45309.             }
  45310.             return [
  45311.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  45312.                 $response->getStatusCode(),
  45313.                 $response->getHeaders()
  45314.             ];
  45315.         } catch (ApiException $e) {
  45316.             switch ($e->getCode()) {
  45317.                 case 200:
  45318.                     $data AccountingObjectSerializer::deserialize(
  45319.                         $e->getResponseBody(),
  45320.                         '\XeroAPI\XeroPHP\Models\Accounting\Receipts',
  45321.                         $e->getResponseHeaders()
  45322.                     );
  45323.                     $e->setResponseObject($data);
  45324.                     break;
  45325.             }
  45326.             throw $e;
  45327.         }
  45328.     }
  45329.     /**
  45330.      * Operation getReceiptsAsync
  45331.      * Retrieves draft expense claim receipts for any user
  45332.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  45333.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  45334.      * @param  string $where Filter by an any element (optional)
  45335.      * @param  string $order Order by an any element (optional)
  45336.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  45337.      * @throws \InvalidArgumentException
  45338.      * @return \GuzzleHttp\Promise\PromiseInterface
  45339.      */
  45340.     public function getReceiptsAsync($xero_tenant_id$if_modified_since null$where null$order null$unitdp null)
  45341.     {
  45342.         return $this->getReceiptsAsyncWithHttpInfo($xero_tenant_id$if_modified_since$where$order$unitdp)
  45343.             ->then(
  45344.                 function ($response) {
  45345.                     return $response[0];
  45346.                 }
  45347.             );
  45348.     }
  45349.     /**
  45350.      * Operation getReceiptsAsyncWithHttpInfo
  45351.      * Retrieves draft expense claim receipts for any user
  45352.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  45353.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  45354.      * @param  string $where Filter by an any element (optional)
  45355.      * @param  string $order Order by an any element (optional)
  45356.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  45357.      * @throws \InvalidArgumentException
  45358.      * @return \GuzzleHttp\Promise\PromiseInterface */
  45359.     public function getReceiptsAsyncWithHttpInfo($xero_tenant_id$if_modified_since null$where null$order null$unitdp null)
  45360.     {
  45361.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Receipts';
  45362.         $request $this->getReceiptsRequest($xero_tenant_id$if_modified_since$where$order$unitdp);
  45363.         return $this->client
  45364.             ->sendAsync($request$this->createHttpClientOption())
  45365.             ->then(
  45366.                 function ($response) use ($returnType) {
  45367.                     $responseBody $response->getBody();
  45368.                     if ($returnType === '\SplFileObject') {
  45369.                         $content $responseBody//stream goes to serializer
  45370.                     } else {
  45371.                         $content $responseBody->getContents();
  45372.                     }
  45373.                     return [
  45374.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  45375.                         $response->getStatusCode(),
  45376.                         $response->getHeaders()
  45377.                     ];
  45378.                 },
  45379.                 function ($exception) {
  45380.                     $response $exception->getResponse();
  45381.                     $statusCode $response->getStatusCode();
  45382.                     throw new ApiException(
  45383.                         sprintf(
  45384.                             '[%d] Error connecting to the API (%s)',
  45385.                             $statusCode,
  45386.                             $exception->getRequest()->getUri()
  45387.                         ),
  45388.                         $statusCode,
  45389.                         $response->getHeaders(),
  45390.                         $response->getBody()
  45391.                     );
  45392.                 }
  45393.             );
  45394.     }
  45395.     /**
  45396.      * Create request for operation 'getReceipts'
  45397.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  45398.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  45399.      * @param  string $where Filter by an any element (optional)
  45400.      * @param  string $order Order by an any element (optional)
  45401.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  45402.      * @throws \InvalidArgumentException
  45403.      * @return \GuzzleHttp\Psr7\Request  */
  45404.     protected function getReceiptsRequest($xero_tenant_id$if_modified_since null$where null$order null$unitdp null)
  45405.     {
  45406.         // verify the required parameter 'xero_tenant_id' is set
  45407.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  45408.             throw new \InvalidArgumentException(
  45409.                 'Missing the required parameter $xero_tenant_id when calling getReceipts'
  45410.             );
  45411.         }
  45412.         $resourcePath '/Receipts';
  45413.         $formParams = [];
  45414.         $queryParams = [];
  45415.         $headerParams = [];
  45416.         $httpBody '';
  45417.         $multipart false;
  45418.         // query params
  45419.         if ($where !== null) {
  45420.             $queryParams['where'] = AccountingObjectSerializer::toQueryValue($where);
  45421.         }
  45422.         // query params
  45423.         if ($order !== null) {
  45424.             $queryParams['order'] = AccountingObjectSerializer::toQueryValue($order);
  45425.         }
  45426.         // query params
  45427.         if ($unitdp !== null) {
  45428.             $queryParams['unitdp'] = AccountingObjectSerializer::toQueryValue($unitdp);
  45429.         }
  45430.         // header params
  45431.         if ($xero_tenant_id !== null) {
  45432.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  45433.         }
  45434.         // header params
  45435.         if ($if_modified_since !== null) {
  45436.             $headerParams['If-Modified-Since'] = AccountingObjectSerializer::toHeaderValue($if_modified_since);
  45437.         }
  45438.         // body params
  45439.         $_tempBody null;
  45440.         if ($multipart) {
  45441.             $headers $this->headerSelector->selectHeadersForMultipart(
  45442.                 ['application/json']
  45443.             );
  45444.         } else {
  45445.             $headers $this->headerSelector->selectHeaders(
  45446.                 ['application/json'],
  45447.                 []
  45448.             );
  45449.         }
  45450.         // for model (json/xml)
  45451.         if (isset($_tempBody)) {
  45452.             // $_tempBody is the method argument, if present
  45453.             if ($headers['Content-Type'] === 'application/json') {
  45454.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  45455.             } else {
  45456.                 $httpBody $_tempBody;
  45457.             }
  45458.         } elseif (count($formParams) > 0) {
  45459.             if ($multipart) {
  45460.                 $multipartContents = [
  45461.                     [
  45462.                         'Content-type' => 'multipart/form-data',
  45463.                     ]
  45464.                 ];
  45465.                 
  45466.                 // for HTTP post (form)
  45467.                 $httpBody = new MultipartStream($multipartContents);
  45468.             } elseif ($headers['Content-Type'] === 'application/json') {
  45469.                 $httpBody \GuzzleHttp\json_encode($formParams);
  45470.             } else {
  45471.                 // for HTTP post (form)
  45472.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  45473.             }
  45474.         }
  45475.         // this endpoint requires OAuth (access token)
  45476.         if ($this->config->getAccessToken() !== null) {
  45477.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  45478.         }
  45479.         $defaultHeaders = [];
  45480.         if ($this->config->getUserAgent()) {
  45481.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  45482.         }
  45483.         $headers array_merge(
  45484.             $defaultHeaders,
  45485.             $headerParams,
  45486.             $headers
  45487.         );
  45488.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  45489.         return new Request(
  45490.             'GET',
  45491.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  45492.             $headers,
  45493.             $httpBody
  45494.         );
  45495.     }
  45496.     /**
  45497.      * Operation getRepeatingInvoice
  45498.      * Retrieves a specific repeating invoice by using a unique repeating invoice Id
  45499.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  45500.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  45501.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  45502.      * @throws \InvalidArgumentException
  45503.      * @return \XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices
  45504.      */
  45505.     public function getRepeatingInvoice($xero_tenant_id$repeating_invoice_id)
  45506.     {
  45507.         list($response) = $this->getRepeatingInvoiceWithHttpInfo($xero_tenant_id$repeating_invoice_id);
  45508.         return $response;
  45509.     }
  45510.     /**
  45511.      * Operation getRepeatingInvoiceWithHttpInfo
  45512.      * Retrieves a specific repeating invoice by using a unique repeating invoice Id
  45513.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  45514.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  45515.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  45516.      * @throws \InvalidArgumentException
  45517.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices, HTTP status code, HTTP response headers (array of strings)
  45518.      */
  45519.     public function getRepeatingInvoiceWithHttpInfo($xero_tenant_id$repeating_invoice_id)
  45520.     {
  45521.         $request $this->getRepeatingInvoiceRequest($xero_tenant_id$repeating_invoice_id);
  45522.         try {
  45523.             $options $this->createHttpClientOption();
  45524.             try {
  45525.                 $response $this->client->send($request$options);
  45526.             } catch (RequestException $e) {
  45527.                 throw new ApiException(
  45528.                     "[{$e->getCode()}{$e->getMessage()}",
  45529.                     $e->getCode(),
  45530.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  45531.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  45532.                 );
  45533.             }
  45534.             $statusCode $response->getStatusCode();
  45535.             if ($statusCode 200 || $statusCode 299) {
  45536.                 throw new ApiException(
  45537.                     sprintf(
  45538.                         '[%d] Error connecting to the API (%s)',
  45539.                         $statusCode,
  45540.                         $request->getUri()
  45541.                     ),
  45542.                     $statusCode,
  45543.                     $response->getHeaders(),
  45544.                     $response->getBody()
  45545.                 );
  45546.             }
  45547.             $responseBody $response->getBody();
  45548.             switch($statusCode) {
  45549.                 case 200:
  45550.                     if ('\XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices' === '\SplFileObject') {
  45551.                         $content $responseBody//stream goes to serializer
  45552.                     } else {
  45553.                         $content $responseBody->getContents();
  45554.                     }
  45555.                     return [
  45556.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices', []),
  45557.                         $response->getStatusCode(),
  45558.                         $response->getHeaders()
  45559.                     ];
  45560.             }
  45561.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices';
  45562.             $responseBody $response->getBody();
  45563.             if ($returnType === '\SplFileObject') {
  45564.                 $content $responseBody//stream goes to serializer
  45565.             } else {
  45566.                 $content $responseBody->getContents();
  45567.             }
  45568.             return [
  45569.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  45570.                 $response->getStatusCode(),
  45571.                 $response->getHeaders()
  45572.             ];
  45573.         } catch (ApiException $e) {
  45574.             switch ($e->getCode()) {
  45575.                 case 200:
  45576.                     $data AccountingObjectSerializer::deserialize(
  45577.                         $e->getResponseBody(),
  45578.                         '\XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices',
  45579.                         $e->getResponseHeaders()
  45580.                     );
  45581.                     $e->setResponseObject($data);
  45582.                     break;
  45583.             }
  45584.             throw $e;
  45585.         }
  45586.     }
  45587.     /**
  45588.      * Operation getRepeatingInvoiceAsync
  45589.      * Retrieves a specific repeating invoice by using a unique repeating invoice Id
  45590.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  45591.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  45592.      * @throws \InvalidArgumentException
  45593.      * @return \GuzzleHttp\Promise\PromiseInterface
  45594.      */
  45595.     public function getRepeatingInvoiceAsync($xero_tenant_id$repeating_invoice_id)
  45596.     {
  45597.         return $this->getRepeatingInvoiceAsyncWithHttpInfo($xero_tenant_id$repeating_invoice_id)
  45598.             ->then(
  45599.                 function ($response) {
  45600.                     return $response[0];
  45601.                 }
  45602.             );
  45603.     }
  45604.     /**
  45605.      * Operation getRepeatingInvoiceAsyncWithHttpInfo
  45606.      * Retrieves a specific repeating invoice by using a unique repeating invoice Id
  45607.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  45608.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  45609.      * @throws \InvalidArgumentException
  45610.      * @return \GuzzleHttp\Promise\PromiseInterface */
  45611.     public function getRepeatingInvoiceAsyncWithHttpInfo($xero_tenant_id$repeating_invoice_id)
  45612.     {
  45613.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices';
  45614.         $request $this->getRepeatingInvoiceRequest($xero_tenant_id$repeating_invoice_id);
  45615.         return $this->client
  45616.             ->sendAsync($request$this->createHttpClientOption())
  45617.             ->then(
  45618.                 function ($response) use ($returnType) {
  45619.                     $responseBody $response->getBody();
  45620.                     if ($returnType === '\SplFileObject') {
  45621.                         $content $responseBody//stream goes to serializer
  45622.                     } else {
  45623.                         $content $responseBody->getContents();
  45624.                     }
  45625.                     return [
  45626.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  45627.                         $response->getStatusCode(),
  45628.                         $response->getHeaders()
  45629.                     ];
  45630.                 },
  45631.                 function ($exception) {
  45632.                     $response $exception->getResponse();
  45633.                     $statusCode $response->getStatusCode();
  45634.                     throw new ApiException(
  45635.                         sprintf(
  45636.                             '[%d] Error connecting to the API (%s)',
  45637.                             $statusCode,
  45638.                             $exception->getRequest()->getUri()
  45639.                         ),
  45640.                         $statusCode,
  45641.                         $response->getHeaders(),
  45642.                         $response->getBody()
  45643.                     );
  45644.                 }
  45645.             );
  45646.     }
  45647.     /**
  45648.      * Create request for operation 'getRepeatingInvoice'
  45649.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  45650.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  45651.      * @throws \InvalidArgumentException
  45652.      * @return \GuzzleHttp\Psr7\Request  */
  45653.     protected function getRepeatingInvoiceRequest($xero_tenant_id$repeating_invoice_id)
  45654.     {
  45655.         // verify the required parameter 'xero_tenant_id' is set
  45656.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  45657.             throw new \InvalidArgumentException(
  45658.                 'Missing the required parameter $xero_tenant_id when calling getRepeatingInvoice'
  45659.             );
  45660.         }
  45661.         // verify the required parameter 'repeating_invoice_id' is set
  45662.         if ($repeating_invoice_id === null || (is_array($repeating_invoice_id) && count($repeating_invoice_id) === 0)) {
  45663.             throw new \InvalidArgumentException(
  45664.                 'Missing the required parameter $repeating_invoice_id when calling getRepeatingInvoice'
  45665.             );
  45666.         }
  45667.         $resourcePath '/RepeatingInvoices/{RepeatingInvoiceID}';
  45668.         $formParams = [];
  45669.         $queryParams = [];
  45670.         $headerParams = [];
  45671.         $httpBody '';
  45672.         $multipart false;
  45673.         // header params
  45674.         if ($xero_tenant_id !== null) {
  45675.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  45676.         }
  45677.         // path params
  45678.         if ($repeating_invoice_id !== null) {
  45679.             $resourcePath str_replace(
  45680.                 '{' 'RepeatingInvoiceID' '}',
  45681.                 AccountingObjectSerializer::toPathValue($repeating_invoice_id),
  45682.                 $resourcePath
  45683.             );
  45684.         }
  45685.         // body params
  45686.         $_tempBody null;
  45687.         if ($multipart) {
  45688.             $headers $this->headerSelector->selectHeadersForMultipart(
  45689.                 ['application/json']
  45690.             );
  45691.         } else {
  45692.             $headers $this->headerSelector->selectHeaders(
  45693.                 ['application/json'],
  45694.                 []
  45695.             );
  45696.         }
  45697.         // for model (json/xml)
  45698.         if (isset($_tempBody)) {
  45699.             // $_tempBody is the method argument, if present
  45700.             if ($headers['Content-Type'] === 'application/json') {
  45701.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  45702.             } else {
  45703.                 $httpBody $_tempBody;
  45704.             }
  45705.         } elseif (count($formParams) > 0) {
  45706.             if ($multipart) {
  45707.                 $multipartContents = [
  45708.                     [
  45709.                         'Content-type' => 'multipart/form-data',
  45710.                     ]
  45711.                 ];
  45712.                 
  45713.                 // for HTTP post (form)
  45714.                 $httpBody = new MultipartStream($multipartContents);
  45715.             } elseif ($headers['Content-Type'] === 'application/json') {
  45716.                 $httpBody \GuzzleHttp\json_encode($formParams);
  45717.             } else {
  45718.                 // for HTTP post (form)
  45719.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  45720.             }
  45721.         }
  45722.         // this endpoint requires OAuth (access token)
  45723.         if ($this->config->getAccessToken() !== null) {
  45724.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  45725.         }
  45726.         $defaultHeaders = [];
  45727.         if ($this->config->getUserAgent()) {
  45728.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  45729.         }
  45730.         $headers array_merge(
  45731.             $defaultHeaders,
  45732.             $headerParams,
  45733.             $headers
  45734.         );
  45735.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  45736.         return new Request(
  45737.             'GET',
  45738.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  45739.             $headers,
  45740.             $httpBody
  45741.         );
  45742.     }
  45743.     /**
  45744.      * Operation getRepeatingInvoiceAttachmentByFileName
  45745.      * Retrieves a specific attachment from a specific repeating invoices by file name
  45746.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  45747.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  45748.      * @param  string $file_name Name of the attachment (required)
  45749.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  45750.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  45751.      * @throws \InvalidArgumentException
  45752.      * @return \SplFileObject
  45753.      */
  45754.     public function getRepeatingInvoiceAttachmentByFileName($xero_tenant_id$repeating_invoice_id$file_name$content_type)
  45755.     {
  45756.         list($response) = $this->getRepeatingInvoiceAttachmentByFileNameWithHttpInfo($xero_tenant_id$repeating_invoice_id$file_name$content_type);
  45757.         return $response;
  45758.     }
  45759.     /**
  45760.      * Operation getRepeatingInvoiceAttachmentByFileNameWithHttpInfo
  45761.      * Retrieves a specific attachment from a specific repeating invoices by file name
  45762.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  45763.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  45764.      * @param  string $file_name Name of the attachment (required)
  45765.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  45766.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  45767.      * @throws \InvalidArgumentException
  45768.      * @return array of \SplFileObject, HTTP status code, HTTP response headers (array of strings)
  45769.      */
  45770.     public function getRepeatingInvoiceAttachmentByFileNameWithHttpInfo($xero_tenant_id$repeating_invoice_id$file_name$content_type)
  45771.     {
  45772.         $request $this->getRepeatingInvoiceAttachmentByFileNameRequest($xero_tenant_id$repeating_invoice_id$file_name$content_type);
  45773.         try {
  45774.             $options $this->createHttpClientOption();
  45775.             try {
  45776.                 $response $this->client->send($request$options);
  45777.             } catch (RequestException $e) {
  45778.                 throw new ApiException(
  45779.                     "[{$e->getCode()}{$e->getMessage()}",
  45780.                     $e->getCode(),
  45781.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  45782.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  45783.                 );
  45784.             }
  45785.             $statusCode $response->getStatusCode();
  45786.             if ($statusCode 200 || $statusCode 299) {
  45787.                 throw new ApiException(
  45788.                     sprintf(
  45789.                         '[%d] Error connecting to the API (%s)',
  45790.                         $statusCode,
  45791.                         $request->getUri()
  45792.                     ),
  45793.                     $statusCode,
  45794.                     $response->getHeaders(),
  45795.                     $response->getBody()
  45796.                 );
  45797.             }
  45798.             $responseBody $response->getBody();
  45799.             switch($statusCode) {
  45800.                 case 200:
  45801.                     if ('\SplFileObject' === '\SplFileObject') {
  45802.                         $content $responseBody//stream goes to serializer
  45803.                     } else {
  45804.                         $content $responseBody->getContents();
  45805.                     }
  45806.                     return [
  45807.                         AccountingObjectSerializer::deserialize($content'\SplFileObject', []),
  45808.                         $response->getStatusCode(),
  45809.                         $response->getHeaders()
  45810.                     ];
  45811.             }
  45812.             $returnType '\SplFileObject';
  45813.             $responseBody $response->getBody();
  45814.             if ($returnType === '\SplFileObject') {
  45815.                 $content $responseBody//stream goes to serializer
  45816.             } else {
  45817.                 $content $responseBody->getContents();
  45818.             }
  45819.             return [
  45820.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  45821.                 $response->getStatusCode(),
  45822.                 $response->getHeaders()
  45823.             ];
  45824.         } catch (ApiException $e) {
  45825.             switch ($e->getCode()) {
  45826.                 case 200:
  45827.                     $data AccountingObjectSerializer::deserialize(
  45828.                         $e->getResponseBody(),
  45829.                         '\SplFileObject',
  45830.                         $e->getResponseHeaders()
  45831.                     );
  45832.                     $e->setResponseObject($data);
  45833.                     break;
  45834.             }
  45835.             throw $e;
  45836.         }
  45837.     }
  45838.     /**
  45839.      * Operation getRepeatingInvoiceAttachmentByFileNameAsync
  45840.      * Retrieves a specific attachment from a specific repeating invoices by file name
  45841.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  45842.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  45843.      * @param  string $file_name Name of the attachment (required)
  45844.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  45845.      * @throws \InvalidArgumentException
  45846.      * @return \GuzzleHttp\Promise\PromiseInterface
  45847.      */
  45848.     public function getRepeatingInvoiceAttachmentByFileNameAsync($xero_tenant_id$repeating_invoice_id$file_name$content_type)
  45849.     {
  45850.         return $this->getRepeatingInvoiceAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$repeating_invoice_id$file_name$content_type)
  45851.             ->then(
  45852.                 function ($response) {
  45853.                     return $response[0];
  45854.                 }
  45855.             );
  45856.     }
  45857.     /**
  45858.      * Operation getRepeatingInvoiceAttachmentByFileNameAsyncWithHttpInfo
  45859.      * Retrieves a specific attachment from a specific repeating invoices by file name
  45860.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  45861.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  45862.      * @param  string $file_name Name of the attachment (required)
  45863.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  45864.      * @throws \InvalidArgumentException
  45865.      * @return \GuzzleHttp\Promise\PromiseInterface */
  45866.     public function getRepeatingInvoiceAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$repeating_invoice_id$file_name$content_type)
  45867.     {
  45868.         $returnType '\SplFileObject';
  45869.         $request $this->getRepeatingInvoiceAttachmentByFileNameRequest($xero_tenant_id$repeating_invoice_id$file_name$content_type);
  45870.         return $this->client
  45871.             ->sendAsync($request$this->createHttpClientOption())
  45872.             ->then(
  45873.                 function ($response) use ($returnType) {
  45874.                     $responseBody $response->getBody();
  45875.                     if ($returnType === '\SplFileObject') {
  45876.                         $content $responseBody//stream goes to serializer
  45877.                     } else {
  45878.                         $content $responseBody->getContents();
  45879.                     }
  45880.                     return [
  45881.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  45882.                         $response->getStatusCode(),
  45883.                         $response->getHeaders()
  45884.                     ];
  45885.                 },
  45886.                 function ($exception) {
  45887.                     $response $exception->getResponse();
  45888.                     $statusCode $response->getStatusCode();
  45889.                     throw new ApiException(
  45890.                         sprintf(
  45891.                             '[%d] Error connecting to the API (%s)',
  45892.                             $statusCode,
  45893.                             $exception->getRequest()->getUri()
  45894.                         ),
  45895.                         $statusCode,
  45896.                         $response->getHeaders(),
  45897.                         $response->getBody()
  45898.                     );
  45899.                 }
  45900.             );
  45901.     }
  45902.     /**
  45903.      * Create request for operation 'getRepeatingInvoiceAttachmentByFileName'
  45904.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  45905.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  45906.      * @param  string $file_name Name of the attachment (required)
  45907.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  45908.      * @throws \InvalidArgumentException
  45909.      * @return \GuzzleHttp\Psr7\Request  */
  45910.     protected function getRepeatingInvoiceAttachmentByFileNameRequest($xero_tenant_id$repeating_invoice_id$file_name$content_type)
  45911.     {
  45912.         // verify the required parameter 'xero_tenant_id' is set
  45913.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  45914.             throw new \InvalidArgumentException(
  45915.                 'Missing the required parameter $xero_tenant_id when calling getRepeatingInvoiceAttachmentByFileName'
  45916.             );
  45917.         }
  45918.         // verify the required parameter 'repeating_invoice_id' is set
  45919.         if ($repeating_invoice_id === null || (is_array($repeating_invoice_id) && count($repeating_invoice_id) === 0)) {
  45920.             throw new \InvalidArgumentException(
  45921.                 'Missing the required parameter $repeating_invoice_id when calling getRepeatingInvoiceAttachmentByFileName'
  45922.             );
  45923.         }
  45924.         // verify the required parameter 'file_name' is set
  45925.         if ($file_name === null || (is_array($file_name) && count($file_name) === 0)) {
  45926.             throw new \InvalidArgumentException(
  45927.                 'Missing the required parameter $file_name when calling getRepeatingInvoiceAttachmentByFileName'
  45928.             );
  45929.         }
  45930.         // verify the required parameter 'content_type' is set
  45931.         if ($content_type === null || (is_array($content_type) && count($content_type) === 0)) {
  45932.             throw new \InvalidArgumentException(
  45933.                 'Missing the required parameter $content_type when calling getRepeatingInvoiceAttachmentByFileName'
  45934.             );
  45935.         }
  45936.         $resourcePath '/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}';
  45937.         $formParams = [];
  45938.         $queryParams = [];
  45939.         $headerParams = [];
  45940.         $httpBody '';
  45941.         $multipart false;
  45942.         // header params
  45943.         if ($xero_tenant_id !== null) {
  45944.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  45945.         }
  45946.         // header params
  45947.         if ($content_type !== null) {
  45948.             $headerParams['contentType'] = AccountingObjectSerializer::toHeaderValue($content_type);
  45949.         }
  45950.         // path params
  45951.         if ($repeating_invoice_id !== null) {
  45952.             $resourcePath str_replace(
  45953.                 '{' 'RepeatingInvoiceID' '}',
  45954.                 AccountingObjectSerializer::toPathValue($repeating_invoice_id),
  45955.                 $resourcePath
  45956.             );
  45957.         }
  45958.         // path params
  45959.         if ($file_name !== null) {
  45960.             $resourcePath str_replace(
  45961.                 '{' 'FileName' '}',
  45962.                 AccountingObjectSerializer::toPathValue($file_name),
  45963.                 $resourcePath
  45964.             );
  45965.         }
  45966.         // body params
  45967.         $_tempBody null;
  45968.         if ($multipart) {
  45969.             $headers $this->headerSelector->selectHeadersForMultipart(
  45970.                 ['application/octet-stream']
  45971.             );
  45972.         } else {
  45973.             $headers $this->headerSelector->selectHeaders(
  45974.                 ['application/octet-stream'],
  45975.                 []
  45976.             );
  45977.         }
  45978.         // for model (json/xml)
  45979.         if (isset($_tempBody)) {
  45980.             // $_tempBody is the method argument, if present
  45981.             if ($headers['Content-Type'] === 'application/json') {
  45982.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  45983.             } else {
  45984.                 $httpBody $_tempBody;
  45985.             }
  45986.         } elseif (count($formParams) > 0) {
  45987.             if ($multipart) {
  45988.                 $multipartContents = [
  45989.                     [
  45990.                         'Content-type' => 'multipart/form-data',
  45991.                     ]
  45992.                 ];
  45993.                 
  45994.                 // for HTTP post (form)
  45995.                 $httpBody = new MultipartStream($multipartContents);
  45996.             } elseif ($headers['Content-Type'] === 'application/json') {
  45997.                 $httpBody \GuzzleHttp\json_encode($formParams);
  45998.             } else {
  45999.                 // for HTTP post (form)
  46000.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  46001.             }
  46002.         }
  46003.         // this endpoint requires OAuth (access token)
  46004.         if ($this->config->getAccessToken() !== null) {
  46005.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  46006.         }
  46007.         $defaultHeaders = [];
  46008.         if ($this->config->getUserAgent()) {
  46009.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  46010.         }
  46011.         $headers array_merge(
  46012.             $defaultHeaders,
  46013.             $headerParams,
  46014.             $headers
  46015.         );
  46016.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  46017.         return new Request(
  46018.             'GET',
  46019.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  46020.             $headers,
  46021.             $httpBody
  46022.         );
  46023.     }
  46024.     /**
  46025.      * Operation getRepeatingInvoiceAttachmentById
  46026.      * Retrieves a specific attachment from a specific repeating invoice
  46027.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  46028.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  46029.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  46030.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  46031.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  46032.      * @throws \InvalidArgumentException
  46033.      * @return \SplFileObject
  46034.      */
  46035.     public function getRepeatingInvoiceAttachmentById($xero_tenant_id$repeating_invoice_id$attachment_id$content_type)
  46036.     {
  46037.         list($response) = $this->getRepeatingInvoiceAttachmentByIdWithHttpInfo($xero_tenant_id$repeating_invoice_id$attachment_id$content_type);
  46038.         return $response;
  46039.     }
  46040.     /**
  46041.      * Operation getRepeatingInvoiceAttachmentByIdWithHttpInfo
  46042.      * Retrieves a specific attachment from a specific repeating invoice
  46043.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  46044.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  46045.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  46046.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  46047.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  46048.      * @throws \InvalidArgumentException
  46049.      * @return array of \SplFileObject, HTTP status code, HTTP response headers (array of strings)
  46050.      */
  46051.     public function getRepeatingInvoiceAttachmentByIdWithHttpInfo($xero_tenant_id$repeating_invoice_id$attachment_id$content_type)
  46052.     {
  46053.         $request $this->getRepeatingInvoiceAttachmentByIdRequest($xero_tenant_id$repeating_invoice_id$attachment_id$content_type);
  46054.         try {
  46055.             $options $this->createHttpClientOption();
  46056.             try {
  46057.                 $response $this->client->send($request$options);
  46058.             } catch (RequestException $e) {
  46059.                 throw new ApiException(
  46060.                     "[{$e->getCode()}{$e->getMessage()}",
  46061.                     $e->getCode(),
  46062.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  46063.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  46064.                 );
  46065.             }
  46066.             $statusCode $response->getStatusCode();
  46067.             if ($statusCode 200 || $statusCode 299) {
  46068.                 throw new ApiException(
  46069.                     sprintf(
  46070.                         '[%d] Error connecting to the API (%s)',
  46071.                         $statusCode,
  46072.                         $request->getUri()
  46073.                     ),
  46074.                     $statusCode,
  46075.                     $response->getHeaders(),
  46076.                     $response->getBody()
  46077.                 );
  46078.             }
  46079.             $responseBody $response->getBody();
  46080.             switch($statusCode) {
  46081.                 case 200:
  46082.                     if ('\SplFileObject' === '\SplFileObject') {
  46083.                         $content $responseBody//stream goes to serializer
  46084.                     } else {
  46085.                         $content $responseBody->getContents();
  46086.                     }
  46087.                     return [
  46088.                         AccountingObjectSerializer::deserialize($content'\SplFileObject', []),
  46089.                         $response->getStatusCode(),
  46090.                         $response->getHeaders()
  46091.                     ];
  46092.             }
  46093.             $returnType '\SplFileObject';
  46094.             $responseBody $response->getBody();
  46095.             if ($returnType === '\SplFileObject') {
  46096.                 $content $responseBody//stream goes to serializer
  46097.             } else {
  46098.                 $content $responseBody->getContents();
  46099.             }
  46100.             return [
  46101.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  46102.                 $response->getStatusCode(),
  46103.                 $response->getHeaders()
  46104.             ];
  46105.         } catch (ApiException $e) {
  46106.             switch ($e->getCode()) {
  46107.                 case 200:
  46108.                     $data AccountingObjectSerializer::deserialize(
  46109.                         $e->getResponseBody(),
  46110.                         '\SplFileObject',
  46111.                         $e->getResponseHeaders()
  46112.                     );
  46113.                     $e->setResponseObject($data);
  46114.                     break;
  46115.             }
  46116.             throw $e;
  46117.         }
  46118.     }
  46119.     /**
  46120.      * Operation getRepeatingInvoiceAttachmentByIdAsync
  46121.      * Retrieves a specific attachment from a specific repeating invoice
  46122.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  46123.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  46124.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  46125.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  46126.      * @throws \InvalidArgumentException
  46127.      * @return \GuzzleHttp\Promise\PromiseInterface
  46128.      */
  46129.     public function getRepeatingInvoiceAttachmentByIdAsync($xero_tenant_id$repeating_invoice_id$attachment_id$content_type)
  46130.     {
  46131.         return $this->getRepeatingInvoiceAttachmentByIdAsyncWithHttpInfo($xero_tenant_id$repeating_invoice_id$attachment_id$content_type)
  46132.             ->then(
  46133.                 function ($response) {
  46134.                     return $response[0];
  46135.                 }
  46136.             );
  46137.     }
  46138.     /**
  46139.      * Operation getRepeatingInvoiceAttachmentByIdAsyncWithHttpInfo
  46140.      * Retrieves a specific attachment from a specific repeating invoice
  46141.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  46142.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  46143.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  46144.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  46145.      * @throws \InvalidArgumentException
  46146.      * @return \GuzzleHttp\Promise\PromiseInterface */
  46147.     public function getRepeatingInvoiceAttachmentByIdAsyncWithHttpInfo($xero_tenant_id$repeating_invoice_id$attachment_id$content_type)
  46148.     {
  46149.         $returnType '\SplFileObject';
  46150.         $request $this->getRepeatingInvoiceAttachmentByIdRequest($xero_tenant_id$repeating_invoice_id$attachment_id$content_type);
  46151.         return $this->client
  46152.             ->sendAsync($request$this->createHttpClientOption())
  46153.             ->then(
  46154.                 function ($response) use ($returnType) {
  46155.                     $responseBody $response->getBody();
  46156.                     if ($returnType === '\SplFileObject') {
  46157.                         $content $responseBody//stream goes to serializer
  46158.                     } else {
  46159.                         $content $responseBody->getContents();
  46160.                     }
  46161.                     return [
  46162.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  46163.                         $response->getStatusCode(),
  46164.                         $response->getHeaders()
  46165.                     ];
  46166.                 },
  46167.                 function ($exception) {
  46168.                     $response $exception->getResponse();
  46169.                     $statusCode $response->getStatusCode();
  46170.                     throw new ApiException(
  46171.                         sprintf(
  46172.                             '[%d] Error connecting to the API (%s)',
  46173.                             $statusCode,
  46174.                             $exception->getRequest()->getUri()
  46175.                         ),
  46176.                         $statusCode,
  46177.                         $response->getHeaders(),
  46178.                         $response->getBody()
  46179.                     );
  46180.                 }
  46181.             );
  46182.     }
  46183.     /**
  46184.      * Create request for operation 'getRepeatingInvoiceAttachmentById'
  46185.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  46186.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  46187.      * @param  string $attachment_id Unique identifier for Attachment object (required)
  46188.      * @param  string $content_type The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (required)
  46189.      * @throws \InvalidArgumentException
  46190.      * @return \GuzzleHttp\Psr7\Request  */
  46191.     protected function getRepeatingInvoiceAttachmentByIdRequest($xero_tenant_id$repeating_invoice_id$attachment_id$content_type)
  46192.     {
  46193.         // verify the required parameter 'xero_tenant_id' is set
  46194.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  46195.             throw new \InvalidArgumentException(
  46196.                 'Missing the required parameter $xero_tenant_id when calling getRepeatingInvoiceAttachmentById'
  46197.             );
  46198.         }
  46199.         // verify the required parameter 'repeating_invoice_id' is set
  46200.         if ($repeating_invoice_id === null || (is_array($repeating_invoice_id) && count($repeating_invoice_id) === 0)) {
  46201.             throw new \InvalidArgumentException(
  46202.                 'Missing the required parameter $repeating_invoice_id when calling getRepeatingInvoiceAttachmentById'
  46203.             );
  46204.         }
  46205.         // verify the required parameter 'attachment_id' is set
  46206.         if ($attachment_id === null || (is_array($attachment_id) && count($attachment_id) === 0)) {
  46207.             throw new \InvalidArgumentException(
  46208.                 'Missing the required parameter $attachment_id when calling getRepeatingInvoiceAttachmentById'
  46209.             );
  46210.         }
  46211.         // verify the required parameter 'content_type' is set
  46212.         if ($content_type === null || (is_array($content_type) && count($content_type) === 0)) {
  46213.             throw new \InvalidArgumentException(
  46214.                 'Missing the required parameter $content_type when calling getRepeatingInvoiceAttachmentById'
  46215.             );
  46216.         }
  46217.         $resourcePath '/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{AttachmentID}';
  46218.         $formParams = [];
  46219.         $queryParams = [];
  46220.         $headerParams = [];
  46221.         $httpBody '';
  46222.         $multipart false;
  46223.         // header params
  46224.         if ($xero_tenant_id !== null) {
  46225.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  46226.         }
  46227.         // header params
  46228.         if ($content_type !== null) {
  46229.             $headerParams['contentType'] = AccountingObjectSerializer::toHeaderValue($content_type);
  46230.         }
  46231.         // path params
  46232.         if ($repeating_invoice_id !== null) {
  46233.             $resourcePath str_replace(
  46234.                 '{' 'RepeatingInvoiceID' '}',
  46235.                 AccountingObjectSerializer::toPathValue($repeating_invoice_id),
  46236.                 $resourcePath
  46237.             );
  46238.         }
  46239.         // path params
  46240.         if ($attachment_id !== null) {
  46241.             $resourcePath str_replace(
  46242.                 '{' 'AttachmentID' '}',
  46243.                 AccountingObjectSerializer::toPathValue($attachment_id),
  46244.                 $resourcePath
  46245.             );
  46246.         }
  46247.         // body params
  46248.         $_tempBody null;
  46249.         if ($multipart) {
  46250.             $headers $this->headerSelector->selectHeadersForMultipart(
  46251.                 ['application/octet-stream']
  46252.             );
  46253.         } else {
  46254.             $headers $this->headerSelector->selectHeaders(
  46255.                 ['application/octet-stream'],
  46256.                 []
  46257.             );
  46258.         }
  46259.         // for model (json/xml)
  46260.         if (isset($_tempBody)) {
  46261.             // $_tempBody is the method argument, if present
  46262.             if ($headers['Content-Type'] === 'application/json') {
  46263.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  46264.             } else {
  46265.                 $httpBody $_tempBody;
  46266.             }
  46267.         } elseif (count($formParams) > 0) {
  46268.             if ($multipart) {
  46269.                 $multipartContents = [
  46270.                     [
  46271.                         'Content-type' => 'multipart/form-data',
  46272.                     ]
  46273.                 ];
  46274.                 
  46275.                 // for HTTP post (form)
  46276.                 $httpBody = new MultipartStream($multipartContents);
  46277.             } elseif ($headers['Content-Type'] === 'application/json') {
  46278.                 $httpBody \GuzzleHttp\json_encode($formParams);
  46279.             } else {
  46280.                 // for HTTP post (form)
  46281.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  46282.             }
  46283.         }
  46284.         // this endpoint requires OAuth (access token)
  46285.         if ($this->config->getAccessToken() !== null) {
  46286.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  46287.         }
  46288.         $defaultHeaders = [];
  46289.         if ($this->config->getUserAgent()) {
  46290.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  46291.         }
  46292.         $headers array_merge(
  46293.             $defaultHeaders,
  46294.             $headerParams,
  46295.             $headers
  46296.         );
  46297.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  46298.         return new Request(
  46299.             'GET',
  46300.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  46301.             $headers,
  46302.             $httpBody
  46303.         );
  46304.     }
  46305.     /**
  46306.      * Operation getRepeatingInvoiceAttachments
  46307.      * Retrieves attachments from a specific repeating invoice
  46308.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  46309.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  46310.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  46311.      * @throws \InvalidArgumentException
  46312.      * @return \XeroAPI\XeroPHP\Models\Accounting\Attachments
  46313.      */
  46314.     public function getRepeatingInvoiceAttachments($xero_tenant_id$repeating_invoice_id)
  46315.     {
  46316.         list($response) = $this->getRepeatingInvoiceAttachmentsWithHttpInfo($xero_tenant_id$repeating_invoice_id);
  46317.         return $response;
  46318.     }
  46319.     /**
  46320.      * Operation getRepeatingInvoiceAttachmentsWithHttpInfo
  46321.      * Retrieves attachments from a specific repeating invoice
  46322.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  46323.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  46324.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  46325.      * @throws \InvalidArgumentException
  46326.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Attachments, HTTP status code, HTTP response headers (array of strings)
  46327.      */
  46328.     public function getRepeatingInvoiceAttachmentsWithHttpInfo($xero_tenant_id$repeating_invoice_id)
  46329.     {
  46330.         $request $this->getRepeatingInvoiceAttachmentsRequest($xero_tenant_id$repeating_invoice_id);
  46331.         try {
  46332.             $options $this->createHttpClientOption();
  46333.             try {
  46334.                 $response $this->client->send($request$options);
  46335.             } catch (RequestException $e) {
  46336.                 throw new ApiException(
  46337.                     "[{$e->getCode()}{$e->getMessage()}",
  46338.                     $e->getCode(),
  46339.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  46340.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  46341.                 );
  46342.             }
  46343.             $statusCode $response->getStatusCode();
  46344.             if ($statusCode 200 || $statusCode 299) {
  46345.                 throw new ApiException(
  46346.                     sprintf(
  46347.                         '[%d] Error connecting to the API (%s)',
  46348.                         $statusCode,
  46349.                         $request->getUri()
  46350.                     ),
  46351.                     $statusCode,
  46352.                     $response->getHeaders(),
  46353.                     $response->getBody()
  46354.                 );
  46355.             }
  46356.             $responseBody $response->getBody();
  46357.             switch($statusCode) {
  46358.                 case 200:
  46359.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Attachments' === '\SplFileObject') {
  46360.                         $content $responseBody//stream goes to serializer
  46361.                     } else {
  46362.                         $content $responseBody->getContents();
  46363.                     }
  46364.                     return [
  46365.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Attachments', []),
  46366.                         $response->getStatusCode(),
  46367.                         $response->getHeaders()
  46368.                     ];
  46369.             }
  46370.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  46371.             $responseBody $response->getBody();
  46372.             if ($returnType === '\SplFileObject') {
  46373.                 $content $responseBody//stream goes to serializer
  46374.             } else {
  46375.                 $content $responseBody->getContents();
  46376.             }
  46377.             return [
  46378.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  46379.                 $response->getStatusCode(),
  46380.                 $response->getHeaders()
  46381.             ];
  46382.         } catch (ApiException $e) {
  46383.             switch ($e->getCode()) {
  46384.                 case 200:
  46385.                     $data AccountingObjectSerializer::deserialize(
  46386.                         $e->getResponseBody(),
  46387.                         '\XeroAPI\XeroPHP\Models\Accounting\Attachments',
  46388.                         $e->getResponseHeaders()
  46389.                     );
  46390.                     $e->setResponseObject($data);
  46391.                     break;
  46392.             }
  46393.             throw $e;
  46394.         }
  46395.     }
  46396.     /**
  46397.      * Operation getRepeatingInvoiceAttachmentsAsync
  46398.      * Retrieves attachments from a specific repeating invoice
  46399.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  46400.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  46401.      * @throws \InvalidArgumentException
  46402.      * @return \GuzzleHttp\Promise\PromiseInterface
  46403.      */
  46404.     public function getRepeatingInvoiceAttachmentsAsync($xero_tenant_id$repeating_invoice_id)
  46405.     {
  46406.         return $this->getRepeatingInvoiceAttachmentsAsyncWithHttpInfo($xero_tenant_id$repeating_invoice_id)
  46407.             ->then(
  46408.                 function ($response) {
  46409.                     return $response[0];
  46410.                 }
  46411.             );
  46412.     }
  46413.     /**
  46414.      * Operation getRepeatingInvoiceAttachmentsAsyncWithHttpInfo
  46415.      * Retrieves attachments from a specific repeating invoice
  46416.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  46417.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  46418.      * @throws \InvalidArgumentException
  46419.      * @return \GuzzleHttp\Promise\PromiseInterface */
  46420.     public function getRepeatingInvoiceAttachmentsAsyncWithHttpInfo($xero_tenant_id$repeating_invoice_id)
  46421.     {
  46422.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  46423.         $request $this->getRepeatingInvoiceAttachmentsRequest($xero_tenant_id$repeating_invoice_id);
  46424.         return $this->client
  46425.             ->sendAsync($request$this->createHttpClientOption())
  46426.             ->then(
  46427.                 function ($response) use ($returnType) {
  46428.                     $responseBody $response->getBody();
  46429.                     if ($returnType === '\SplFileObject') {
  46430.                         $content $responseBody//stream goes to serializer
  46431.                     } else {
  46432.                         $content $responseBody->getContents();
  46433.                     }
  46434.                     return [
  46435.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  46436.                         $response->getStatusCode(),
  46437.                         $response->getHeaders()
  46438.                     ];
  46439.                 },
  46440.                 function ($exception) {
  46441.                     $response $exception->getResponse();
  46442.                     $statusCode $response->getStatusCode();
  46443.                     throw new ApiException(
  46444.                         sprintf(
  46445.                             '[%d] Error connecting to the API (%s)',
  46446.                             $statusCode,
  46447.                             $exception->getRequest()->getUri()
  46448.                         ),
  46449.                         $statusCode,
  46450.                         $response->getHeaders(),
  46451.                         $response->getBody()
  46452.                     );
  46453.                 }
  46454.             );
  46455.     }
  46456.     /**
  46457.      * Create request for operation 'getRepeatingInvoiceAttachments'
  46458.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  46459.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  46460.      * @throws \InvalidArgumentException
  46461.      * @return \GuzzleHttp\Psr7\Request  */
  46462.     protected function getRepeatingInvoiceAttachmentsRequest($xero_tenant_id$repeating_invoice_id)
  46463.     {
  46464.         // verify the required parameter 'xero_tenant_id' is set
  46465.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  46466.             throw new \InvalidArgumentException(
  46467.                 'Missing the required parameter $xero_tenant_id when calling getRepeatingInvoiceAttachments'
  46468.             );
  46469.         }
  46470.         // verify the required parameter 'repeating_invoice_id' is set
  46471.         if ($repeating_invoice_id === null || (is_array($repeating_invoice_id) && count($repeating_invoice_id) === 0)) {
  46472.             throw new \InvalidArgumentException(
  46473.                 'Missing the required parameter $repeating_invoice_id when calling getRepeatingInvoiceAttachments'
  46474.             );
  46475.         }
  46476.         $resourcePath '/RepeatingInvoices/{RepeatingInvoiceID}/Attachments';
  46477.         $formParams = [];
  46478.         $queryParams = [];
  46479.         $headerParams = [];
  46480.         $httpBody '';
  46481.         $multipart false;
  46482.         // header params
  46483.         if ($xero_tenant_id !== null) {
  46484.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  46485.         }
  46486.         // path params
  46487.         if ($repeating_invoice_id !== null) {
  46488.             $resourcePath str_replace(
  46489.                 '{' 'RepeatingInvoiceID' '}',
  46490.                 AccountingObjectSerializer::toPathValue($repeating_invoice_id),
  46491.                 $resourcePath
  46492.             );
  46493.         }
  46494.         // body params
  46495.         $_tempBody null;
  46496.         if ($multipart) {
  46497.             $headers $this->headerSelector->selectHeadersForMultipart(
  46498.                 ['application/json']
  46499.             );
  46500.         } else {
  46501.             $headers $this->headerSelector->selectHeaders(
  46502.                 ['application/json'],
  46503.                 []
  46504.             );
  46505.         }
  46506.         // for model (json/xml)
  46507.         if (isset($_tempBody)) {
  46508.             // $_tempBody is the method argument, if present
  46509.             if ($headers['Content-Type'] === 'application/json') {
  46510.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  46511.             } else {
  46512.                 $httpBody $_tempBody;
  46513.             }
  46514.         } elseif (count($formParams) > 0) {
  46515.             if ($multipart) {
  46516.                 $multipartContents = [
  46517.                     [
  46518.                         'Content-type' => 'multipart/form-data',
  46519.                     ]
  46520.                 ];
  46521.                 
  46522.                 // for HTTP post (form)
  46523.                 $httpBody = new MultipartStream($multipartContents);
  46524.             } elseif ($headers['Content-Type'] === 'application/json') {
  46525.                 $httpBody \GuzzleHttp\json_encode($formParams);
  46526.             } else {
  46527.                 // for HTTP post (form)
  46528.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  46529.             }
  46530.         }
  46531.         // this endpoint requires OAuth (access token)
  46532.         if ($this->config->getAccessToken() !== null) {
  46533.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  46534.         }
  46535.         $defaultHeaders = [];
  46536.         if ($this->config->getUserAgent()) {
  46537.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  46538.         }
  46539.         $headers array_merge(
  46540.             $defaultHeaders,
  46541.             $headerParams,
  46542.             $headers
  46543.         );
  46544.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  46545.         return new Request(
  46546.             'GET',
  46547.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  46548.             $headers,
  46549.             $httpBody
  46550.         );
  46551.     }
  46552.     /**
  46553.      * Operation getRepeatingInvoiceHistory
  46554.      * Retrieves history record for a specific repeating invoice
  46555.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  46556.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  46557.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  46558.      * @throws \InvalidArgumentException
  46559.      * @return \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords
  46560.      */
  46561.     public function getRepeatingInvoiceHistory($xero_tenant_id$repeating_invoice_id)
  46562.     {
  46563.         list($response) = $this->getRepeatingInvoiceHistoryWithHttpInfo($xero_tenant_id$repeating_invoice_id);
  46564.         return $response;
  46565.     }
  46566.     /**
  46567.      * Operation getRepeatingInvoiceHistoryWithHttpInfo
  46568.      * Retrieves history record for a specific repeating invoice
  46569.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  46570.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  46571.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  46572.      * @throws \InvalidArgumentException
  46573.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\HistoryRecords, HTTP status code, HTTP response headers (array of strings)
  46574.      */
  46575.     public function getRepeatingInvoiceHistoryWithHttpInfo($xero_tenant_id$repeating_invoice_id)
  46576.     {
  46577.         $request $this->getRepeatingInvoiceHistoryRequest($xero_tenant_id$repeating_invoice_id);
  46578.         try {
  46579.             $options $this->createHttpClientOption();
  46580.             try {
  46581.                 $response $this->client->send($request$options);
  46582.             } catch (RequestException $e) {
  46583.                 throw new ApiException(
  46584.                     "[{$e->getCode()}{$e->getMessage()}",
  46585.                     $e->getCode(),
  46586.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  46587.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  46588.                 );
  46589.             }
  46590.             $statusCode $response->getStatusCode();
  46591.             if ($statusCode 200 || $statusCode 299) {
  46592.                 throw new ApiException(
  46593.                     sprintf(
  46594.                         '[%d] Error connecting to the API (%s)',
  46595.                         $statusCode,
  46596.                         $request->getUri()
  46597.                     ),
  46598.                     $statusCode,
  46599.                     $response->getHeaders(),
  46600.                     $response->getBody()
  46601.                 );
  46602.             }
  46603.             $responseBody $response->getBody();
  46604.             switch($statusCode) {
  46605.                 case 200:
  46606.                     if ('\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords' === '\SplFileObject') {
  46607.                         $content $responseBody//stream goes to serializer
  46608.                     } else {
  46609.                         $content $responseBody->getContents();
  46610.                     }
  46611.                     return [
  46612.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords', []),
  46613.                         $response->getStatusCode(),
  46614.                         $response->getHeaders()
  46615.                     ];
  46616.             }
  46617.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  46618.             $responseBody $response->getBody();
  46619.             if ($returnType === '\SplFileObject') {
  46620.                 $content $responseBody//stream goes to serializer
  46621.             } else {
  46622.                 $content $responseBody->getContents();
  46623.             }
  46624.             return [
  46625.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  46626.                 $response->getStatusCode(),
  46627.                 $response->getHeaders()
  46628.             ];
  46629.         } catch (ApiException $e) {
  46630.             switch ($e->getCode()) {
  46631.                 case 200:
  46632.                     $data AccountingObjectSerializer::deserialize(
  46633.                         $e->getResponseBody(),
  46634.                         '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords',
  46635.                         $e->getResponseHeaders()
  46636.                     );
  46637.                     $e->setResponseObject($data);
  46638.                     break;
  46639.             }
  46640.             throw $e;
  46641.         }
  46642.     }
  46643.     /**
  46644.      * Operation getRepeatingInvoiceHistoryAsync
  46645.      * Retrieves history record for a specific repeating invoice
  46646.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  46647.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  46648.      * @throws \InvalidArgumentException
  46649.      * @return \GuzzleHttp\Promise\PromiseInterface
  46650.      */
  46651.     public function getRepeatingInvoiceHistoryAsync($xero_tenant_id$repeating_invoice_id)
  46652.     {
  46653.         return $this->getRepeatingInvoiceHistoryAsyncWithHttpInfo($xero_tenant_id$repeating_invoice_id)
  46654.             ->then(
  46655.                 function ($response) {
  46656.                     return $response[0];
  46657.                 }
  46658.             );
  46659.     }
  46660.     /**
  46661.      * Operation getRepeatingInvoiceHistoryAsyncWithHttpInfo
  46662.      * Retrieves history record for a specific repeating invoice
  46663.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  46664.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  46665.      * @throws \InvalidArgumentException
  46666.      * @return \GuzzleHttp\Promise\PromiseInterface */
  46667.     public function getRepeatingInvoiceHistoryAsyncWithHttpInfo($xero_tenant_id$repeating_invoice_id)
  46668.     {
  46669.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\HistoryRecords';
  46670.         $request $this->getRepeatingInvoiceHistoryRequest($xero_tenant_id$repeating_invoice_id);
  46671.         return $this->client
  46672.             ->sendAsync($request$this->createHttpClientOption())
  46673.             ->then(
  46674.                 function ($response) use ($returnType) {
  46675.                     $responseBody $response->getBody();
  46676.                     if ($returnType === '\SplFileObject') {
  46677.                         $content $responseBody//stream goes to serializer
  46678.                     } else {
  46679.                         $content $responseBody->getContents();
  46680.                     }
  46681.                     return [
  46682.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  46683.                         $response->getStatusCode(),
  46684.                         $response->getHeaders()
  46685.                     ];
  46686.                 },
  46687.                 function ($exception) {
  46688.                     $response $exception->getResponse();
  46689.                     $statusCode $response->getStatusCode();
  46690.                     throw new ApiException(
  46691.                         sprintf(
  46692.                             '[%d] Error connecting to the API (%s)',
  46693.                             $statusCode,
  46694.                             $exception->getRequest()->getUri()
  46695.                         ),
  46696.                         $statusCode,
  46697.                         $response->getHeaders(),
  46698.                         $response->getBody()
  46699.                     );
  46700.                 }
  46701.             );
  46702.     }
  46703.     /**
  46704.      * Create request for operation 'getRepeatingInvoiceHistory'
  46705.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  46706.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  46707.      * @throws \InvalidArgumentException
  46708.      * @return \GuzzleHttp\Psr7\Request  */
  46709.     protected function getRepeatingInvoiceHistoryRequest($xero_tenant_id$repeating_invoice_id)
  46710.     {
  46711.         // verify the required parameter 'xero_tenant_id' is set
  46712.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  46713.             throw new \InvalidArgumentException(
  46714.                 'Missing the required parameter $xero_tenant_id when calling getRepeatingInvoiceHistory'
  46715.             );
  46716.         }
  46717.         // verify the required parameter 'repeating_invoice_id' is set
  46718.         if ($repeating_invoice_id === null || (is_array($repeating_invoice_id) && count($repeating_invoice_id) === 0)) {
  46719.             throw new \InvalidArgumentException(
  46720.                 'Missing the required parameter $repeating_invoice_id when calling getRepeatingInvoiceHistory'
  46721.             );
  46722.         }
  46723.         $resourcePath '/RepeatingInvoices/{RepeatingInvoiceID}/History';
  46724.         $formParams = [];
  46725.         $queryParams = [];
  46726.         $headerParams = [];
  46727.         $httpBody '';
  46728.         $multipart false;
  46729.         // header params
  46730.         if ($xero_tenant_id !== null) {
  46731.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  46732.         }
  46733.         // path params
  46734.         if ($repeating_invoice_id !== null) {
  46735.             $resourcePath str_replace(
  46736.                 '{' 'RepeatingInvoiceID' '}',
  46737.                 AccountingObjectSerializer::toPathValue($repeating_invoice_id),
  46738.                 $resourcePath
  46739.             );
  46740.         }
  46741.         // body params
  46742.         $_tempBody null;
  46743.         if ($multipart) {
  46744.             $headers $this->headerSelector->selectHeadersForMultipart(
  46745.                 ['application/json']
  46746.             );
  46747.         } else {
  46748.             $headers $this->headerSelector->selectHeaders(
  46749.                 ['application/json'],
  46750.                 []
  46751.             );
  46752.         }
  46753.         // for model (json/xml)
  46754.         if (isset($_tempBody)) {
  46755.             // $_tempBody is the method argument, if present
  46756.             if ($headers['Content-Type'] === 'application/json') {
  46757.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  46758.             } else {
  46759.                 $httpBody $_tempBody;
  46760.             }
  46761.         } elseif (count($formParams) > 0) {
  46762.             if ($multipart) {
  46763.                 $multipartContents = [
  46764.                     [
  46765.                         'Content-type' => 'multipart/form-data',
  46766.                     ]
  46767.                 ];
  46768.                 
  46769.                 // for HTTP post (form)
  46770.                 $httpBody = new MultipartStream($multipartContents);
  46771.             } elseif ($headers['Content-Type'] === 'application/json') {
  46772.                 $httpBody \GuzzleHttp\json_encode($formParams);
  46773.             } else {
  46774.                 // for HTTP post (form)
  46775.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  46776.             }
  46777.         }
  46778.         // this endpoint requires OAuth (access token)
  46779.         if ($this->config->getAccessToken() !== null) {
  46780.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  46781.         }
  46782.         $defaultHeaders = [];
  46783.         if ($this->config->getUserAgent()) {
  46784.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  46785.         }
  46786.         $headers array_merge(
  46787.             $defaultHeaders,
  46788.             $headerParams,
  46789.             $headers
  46790.         );
  46791.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  46792.         return new Request(
  46793.             'GET',
  46794.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  46795.             $headers,
  46796.             $httpBody
  46797.         );
  46798.     }
  46799.     /**
  46800.      * Operation getRepeatingInvoices
  46801.      * Retrieves repeating invoices
  46802.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  46803.      * @param  string $where Filter by an any element (optional)
  46804.      * @param  string $order Order by an any element (optional)
  46805.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  46806.      * @throws \InvalidArgumentException
  46807.      * @return \XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices
  46808.      */
  46809.     public function getRepeatingInvoices($xero_tenant_id$where null$order null)
  46810.     {
  46811.         list($response) = $this->getRepeatingInvoicesWithHttpInfo($xero_tenant_id$where$order);
  46812.         return $response;
  46813.     }
  46814.     /**
  46815.      * Operation getRepeatingInvoicesWithHttpInfo
  46816.      * Retrieves repeating invoices
  46817.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  46818.      * @param  string $where Filter by an any element (optional)
  46819.      * @param  string $order Order by an any element (optional)
  46820.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  46821.      * @throws \InvalidArgumentException
  46822.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices, HTTP status code, HTTP response headers (array of strings)
  46823.      */
  46824.     public function getRepeatingInvoicesWithHttpInfo($xero_tenant_id$where null$order null)
  46825.     {
  46826.         $request $this->getRepeatingInvoicesRequest($xero_tenant_id$where$order);
  46827.         try {
  46828.             $options $this->createHttpClientOption();
  46829.             try {
  46830.                 $response $this->client->send($request$options);
  46831.             } catch (RequestException $e) {
  46832.                 throw new ApiException(
  46833.                     "[{$e->getCode()}{$e->getMessage()}",
  46834.                     $e->getCode(),
  46835.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  46836.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  46837.                 );
  46838.             }
  46839.             $statusCode $response->getStatusCode();
  46840.             if ($statusCode 200 || $statusCode 299) {
  46841.                 throw new ApiException(
  46842.                     sprintf(
  46843.                         '[%d] Error connecting to the API (%s)',
  46844.                         $statusCode,
  46845.                         $request->getUri()
  46846.                     ),
  46847.                     $statusCode,
  46848.                     $response->getHeaders(),
  46849.                     $response->getBody()
  46850.                 );
  46851.             }
  46852.             $responseBody $response->getBody();
  46853.             switch($statusCode) {
  46854.                 case 200:
  46855.                     if ('\XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices' === '\SplFileObject') {
  46856.                         $content $responseBody//stream goes to serializer
  46857.                     } else {
  46858.                         $content $responseBody->getContents();
  46859.                     }
  46860.                     return [
  46861.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices', []),
  46862.                         $response->getStatusCode(),
  46863.                         $response->getHeaders()
  46864.                     ];
  46865.             }
  46866.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices';
  46867.             $responseBody $response->getBody();
  46868.             if ($returnType === '\SplFileObject') {
  46869.                 $content $responseBody//stream goes to serializer
  46870.             } else {
  46871.                 $content $responseBody->getContents();
  46872.             }
  46873.             return [
  46874.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  46875.                 $response->getStatusCode(),
  46876.                 $response->getHeaders()
  46877.             ];
  46878.         } catch (ApiException $e) {
  46879.             switch ($e->getCode()) {
  46880.                 case 200:
  46881.                     $data AccountingObjectSerializer::deserialize(
  46882.                         $e->getResponseBody(),
  46883.                         '\XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices',
  46884.                         $e->getResponseHeaders()
  46885.                     );
  46886.                     $e->setResponseObject($data);
  46887.                     break;
  46888.             }
  46889.             throw $e;
  46890.         }
  46891.     }
  46892.     /**
  46893.      * Operation getRepeatingInvoicesAsync
  46894.      * Retrieves repeating invoices
  46895.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  46896.      * @param  string $where Filter by an any element (optional)
  46897.      * @param  string $order Order by an any element (optional)
  46898.      * @throws \InvalidArgumentException
  46899.      * @return \GuzzleHttp\Promise\PromiseInterface
  46900.      */
  46901.     public function getRepeatingInvoicesAsync($xero_tenant_id$where null$order null)
  46902.     {
  46903.         return $this->getRepeatingInvoicesAsyncWithHttpInfo($xero_tenant_id$where$order)
  46904.             ->then(
  46905.                 function ($response) {
  46906.                     return $response[0];
  46907.                 }
  46908.             );
  46909.     }
  46910.     /**
  46911.      * Operation getRepeatingInvoicesAsyncWithHttpInfo
  46912.      * Retrieves repeating invoices
  46913.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  46914.      * @param  string $where Filter by an any element (optional)
  46915.      * @param  string $order Order by an any element (optional)
  46916.      * @throws \InvalidArgumentException
  46917.      * @return \GuzzleHttp\Promise\PromiseInterface */
  46918.     public function getRepeatingInvoicesAsyncWithHttpInfo($xero_tenant_id$where null$order null)
  46919.     {
  46920.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices';
  46921.         $request $this->getRepeatingInvoicesRequest($xero_tenant_id$where$order);
  46922.         return $this->client
  46923.             ->sendAsync($request$this->createHttpClientOption())
  46924.             ->then(
  46925.                 function ($response) use ($returnType) {
  46926.                     $responseBody $response->getBody();
  46927.                     if ($returnType === '\SplFileObject') {
  46928.                         $content $responseBody//stream goes to serializer
  46929.                     } else {
  46930.                         $content $responseBody->getContents();
  46931.                     }
  46932.                     return [
  46933.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  46934.                         $response->getStatusCode(),
  46935.                         $response->getHeaders()
  46936.                     ];
  46937.                 },
  46938.                 function ($exception) {
  46939.                     $response $exception->getResponse();
  46940.                     $statusCode $response->getStatusCode();
  46941.                     throw new ApiException(
  46942.                         sprintf(
  46943.                             '[%d] Error connecting to the API (%s)',
  46944.                             $statusCode,
  46945.                             $exception->getRequest()->getUri()
  46946.                         ),
  46947.                         $statusCode,
  46948.                         $response->getHeaders(),
  46949.                         $response->getBody()
  46950.                     );
  46951.                 }
  46952.             );
  46953.     }
  46954.     /**
  46955.      * Create request for operation 'getRepeatingInvoices'
  46956.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  46957.      * @param  string $where Filter by an any element (optional)
  46958.      * @param  string $order Order by an any element (optional)
  46959.      * @throws \InvalidArgumentException
  46960.      * @return \GuzzleHttp\Psr7\Request  */
  46961.     protected function getRepeatingInvoicesRequest($xero_tenant_id$where null$order null)
  46962.     {
  46963.         // verify the required parameter 'xero_tenant_id' is set
  46964.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  46965.             throw new \InvalidArgumentException(
  46966.                 'Missing the required parameter $xero_tenant_id when calling getRepeatingInvoices'
  46967.             );
  46968.         }
  46969.         $resourcePath '/RepeatingInvoices';
  46970.         $formParams = [];
  46971.         $queryParams = [];
  46972.         $headerParams = [];
  46973.         $httpBody '';
  46974.         $multipart false;
  46975.         // query params
  46976.         if ($where !== null) {
  46977.             $queryParams['where'] = AccountingObjectSerializer::toQueryValue($where);
  46978.         }
  46979.         // query params
  46980.         if ($order !== null) {
  46981.             $queryParams['order'] = AccountingObjectSerializer::toQueryValue($order);
  46982.         }
  46983.         // header params
  46984.         if ($xero_tenant_id !== null) {
  46985.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  46986.         }
  46987.         // body params
  46988.         $_tempBody null;
  46989.         if ($multipart) {
  46990.             $headers $this->headerSelector->selectHeadersForMultipart(
  46991.                 ['application/json']
  46992.             );
  46993.         } else {
  46994.             $headers $this->headerSelector->selectHeaders(
  46995.                 ['application/json'],
  46996.                 []
  46997.             );
  46998.         }
  46999.         // for model (json/xml)
  47000.         if (isset($_tempBody)) {
  47001.             // $_tempBody is the method argument, if present
  47002.             if ($headers['Content-Type'] === 'application/json') {
  47003.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  47004.             } else {
  47005.                 $httpBody $_tempBody;
  47006.             }
  47007.         } elseif (count($formParams) > 0) {
  47008.             if ($multipart) {
  47009.                 $multipartContents = [
  47010.                     [
  47011.                         'Content-type' => 'multipart/form-data',
  47012.                     ]
  47013.                 ];
  47014.                 
  47015.                 // for HTTP post (form)
  47016.                 $httpBody = new MultipartStream($multipartContents);
  47017.             } elseif ($headers['Content-Type'] === 'application/json') {
  47018.                 $httpBody \GuzzleHttp\json_encode($formParams);
  47019.             } else {
  47020.                 // for HTTP post (form)
  47021.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  47022.             }
  47023.         }
  47024.         // this endpoint requires OAuth (access token)
  47025.         if ($this->config->getAccessToken() !== null) {
  47026.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  47027.         }
  47028.         $defaultHeaders = [];
  47029.         if ($this->config->getUserAgent()) {
  47030.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  47031.         }
  47032.         $headers array_merge(
  47033.             $defaultHeaders,
  47034.             $headerParams,
  47035.             $headers
  47036.         );
  47037.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  47038.         return new Request(
  47039.             'GET',
  47040.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  47041.             $headers,
  47042.             $httpBody
  47043.         );
  47044.     }
  47045.     /**
  47046.      * Operation getReportAgedPayablesByContact
  47047.      * Retrieves report for aged payables by contact
  47048.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  47049.      * @param  string $contact_id Unique identifier for a Contact (required)
  47050.      * @param  \DateTime $date The date of the Aged Payables By Contact report (optional)
  47051.      * @param  \DateTime $from_date filter by the from date of the report e.g. 2021-02-01 (optional)
  47052.      * @param  \DateTime $to_date filter by the to date of the report e.g. 2021-02-28 (optional)
  47053.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  47054.      * @throws \InvalidArgumentException
  47055.      * @return \XeroAPI\XeroPHP\Models\Accounting\ReportWithRows
  47056.      */
  47057.     public function getReportAgedPayablesByContact($xero_tenant_id$contact_id$date null$from_date null$to_date null)
  47058.     {
  47059.         list($response) = $this->getReportAgedPayablesByContactWithHttpInfo($xero_tenant_id$contact_id$date$from_date$to_date);
  47060.         return $response;
  47061.     }
  47062.     /**
  47063.      * Operation getReportAgedPayablesByContactWithHttpInfo
  47064.      * Retrieves report for aged payables by contact
  47065.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  47066.      * @param  string $contact_id Unique identifier for a Contact (required)
  47067.      * @param  \DateTime $date The date of the Aged Payables By Contact report (optional)
  47068.      * @param  \DateTime $from_date filter by the from date of the report e.g. 2021-02-01 (optional)
  47069.      * @param  \DateTime $to_date filter by the to date of the report e.g. 2021-02-28 (optional)
  47070.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  47071.      * @throws \InvalidArgumentException
  47072.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\ReportWithRows, HTTP status code, HTTP response headers (array of strings)
  47073.      */
  47074.     public function getReportAgedPayablesByContactWithHttpInfo($xero_tenant_id$contact_id$date null$from_date null$to_date null)
  47075.     {
  47076.         $request $this->getReportAgedPayablesByContactRequest($xero_tenant_id$contact_id$date$from_date$to_date);
  47077.         try {
  47078.             $options $this->createHttpClientOption();
  47079.             try {
  47080.                 $response $this->client->send($request$options);
  47081.             } catch (RequestException $e) {
  47082.                 throw new ApiException(
  47083.                     "[{$e->getCode()}{$e->getMessage()}",
  47084.                     $e->getCode(),
  47085.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  47086.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  47087.                 );
  47088.             }
  47089.             $statusCode $response->getStatusCode();
  47090.             if ($statusCode 200 || $statusCode 299) {
  47091.                 throw new ApiException(
  47092.                     sprintf(
  47093.                         '[%d] Error connecting to the API (%s)',
  47094.                         $statusCode,
  47095.                         $request->getUri()
  47096.                     ),
  47097.                     $statusCode,
  47098.                     $response->getHeaders(),
  47099.                     $response->getBody()
  47100.                 );
  47101.             }
  47102.             $responseBody $response->getBody();
  47103.             switch($statusCode) {
  47104.                 case 200:
  47105.                     if ('\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows' === '\SplFileObject') {
  47106.                         $content $responseBody//stream goes to serializer
  47107.                     } else {
  47108.                         $content $responseBody->getContents();
  47109.                     }
  47110.                     return [
  47111.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows', []),
  47112.                         $response->getStatusCode(),
  47113.                         $response->getHeaders()
  47114.                     ];
  47115.             }
  47116.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows';
  47117.             $responseBody $response->getBody();
  47118.             if ($returnType === '\SplFileObject') {
  47119.                 $content $responseBody//stream goes to serializer
  47120.             } else {
  47121.                 $content $responseBody->getContents();
  47122.             }
  47123.             return [
  47124.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  47125.                 $response->getStatusCode(),
  47126.                 $response->getHeaders()
  47127.             ];
  47128.         } catch (ApiException $e) {
  47129.             switch ($e->getCode()) {
  47130.                 case 200:
  47131.                     $data AccountingObjectSerializer::deserialize(
  47132.                         $e->getResponseBody(),
  47133.                         '\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows',
  47134.                         $e->getResponseHeaders()
  47135.                     );
  47136.                     $e->setResponseObject($data);
  47137.                     break;
  47138.             }
  47139.             throw $e;
  47140.         }
  47141.     }
  47142.     /**
  47143.      * Operation getReportAgedPayablesByContactAsync
  47144.      * Retrieves report for aged payables by contact
  47145.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  47146.      * @param  string $contact_id Unique identifier for a Contact (required)
  47147.      * @param  \DateTime $date The date of the Aged Payables By Contact report (optional)
  47148.      * @param  \DateTime $from_date filter by the from date of the report e.g. 2021-02-01 (optional)
  47149.      * @param  \DateTime $to_date filter by the to date of the report e.g. 2021-02-28 (optional)
  47150.      * @throws \InvalidArgumentException
  47151.      * @return \GuzzleHttp\Promise\PromiseInterface
  47152.      */
  47153.     public function getReportAgedPayablesByContactAsync($xero_tenant_id$contact_id$date null$from_date null$to_date null)
  47154.     {
  47155.         return $this->getReportAgedPayablesByContactAsyncWithHttpInfo($xero_tenant_id$contact_id$date$from_date$to_date)
  47156.             ->then(
  47157.                 function ($response) {
  47158.                     return $response[0];
  47159.                 }
  47160.             );
  47161.     }
  47162.     /**
  47163.      * Operation getReportAgedPayablesByContactAsyncWithHttpInfo
  47164.      * Retrieves report for aged payables by contact
  47165.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  47166.      * @param  string $contact_id Unique identifier for a Contact (required)
  47167.      * @param  \DateTime $date The date of the Aged Payables By Contact report (optional)
  47168.      * @param  \DateTime $from_date filter by the from date of the report e.g. 2021-02-01 (optional)
  47169.      * @param  \DateTime $to_date filter by the to date of the report e.g. 2021-02-28 (optional)
  47170.      * @throws \InvalidArgumentException
  47171.      * @return \GuzzleHttp\Promise\PromiseInterface */
  47172.     public function getReportAgedPayablesByContactAsyncWithHttpInfo($xero_tenant_id$contact_id$date null$from_date null$to_date null)
  47173.     {
  47174.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows';
  47175.         $request $this->getReportAgedPayablesByContactRequest($xero_tenant_id$contact_id$date$from_date$to_date);
  47176.         return $this->client
  47177.             ->sendAsync($request$this->createHttpClientOption())
  47178.             ->then(
  47179.                 function ($response) use ($returnType) {
  47180.                     $responseBody $response->getBody();
  47181.                     if ($returnType === '\SplFileObject') {
  47182.                         $content $responseBody//stream goes to serializer
  47183.                     } else {
  47184.                         $content $responseBody->getContents();
  47185.                     }
  47186.                     return [
  47187.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  47188.                         $response->getStatusCode(),
  47189.                         $response->getHeaders()
  47190.                     ];
  47191.                 },
  47192.                 function ($exception) {
  47193.                     $response $exception->getResponse();
  47194.                     $statusCode $response->getStatusCode();
  47195.                     throw new ApiException(
  47196.                         sprintf(
  47197.                             '[%d] Error connecting to the API (%s)',
  47198.                             $statusCode,
  47199.                             $exception->getRequest()->getUri()
  47200.                         ),
  47201.                         $statusCode,
  47202.                         $response->getHeaders(),
  47203.                         $response->getBody()
  47204.                     );
  47205.                 }
  47206.             );
  47207.     }
  47208.     /**
  47209.      * Create request for operation 'getReportAgedPayablesByContact'
  47210.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  47211.      * @param  string $contact_id Unique identifier for a Contact (required)
  47212.      * @param  \DateTime $date The date of the Aged Payables By Contact report (optional)
  47213.      * @param  \DateTime $from_date filter by the from date of the report e.g. 2021-02-01 (optional)
  47214.      * @param  \DateTime $to_date filter by the to date of the report e.g. 2021-02-28 (optional)
  47215.      * @throws \InvalidArgumentException
  47216.      * @return \GuzzleHttp\Psr7\Request  */
  47217.     protected function getReportAgedPayablesByContactRequest($xero_tenant_id$contact_id$date null$from_date null$to_date null)
  47218.     {
  47219.         // verify the required parameter 'xero_tenant_id' is set
  47220.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  47221.             throw new \InvalidArgumentException(
  47222.                 'Missing the required parameter $xero_tenant_id when calling getReportAgedPayablesByContact'
  47223.             );
  47224.         }
  47225.         // verify the required parameter 'contact_id' is set
  47226.         if ($contact_id === null || (is_array($contact_id) && count($contact_id) === 0)) {
  47227.             throw new \InvalidArgumentException(
  47228.                 'Missing the required parameter $contact_id when calling getReportAgedPayablesByContact'
  47229.             );
  47230.         }
  47231.         $resourcePath '/Reports/AgedPayablesByContact';
  47232.         $formParams = [];
  47233.         $queryParams = [];
  47234.         $headerParams = [];
  47235.         $httpBody '';
  47236.         $multipart false;
  47237.         // query params
  47238.         if ($contact_id !== null) {
  47239.             $queryParams['contactId'] = AccountingObjectSerializer::toQueryValue($contact_id);
  47240.         }
  47241.         // query params
  47242.         if ($date !== null) {
  47243.             $queryParams['date'] = AccountingObjectSerializer::toQueryValue($date);
  47244.         }
  47245.         // query params
  47246.         if ($from_date !== null) {
  47247.             $queryParams['fromDate'] = AccountingObjectSerializer::toQueryValue($from_date);
  47248.         }
  47249.         // query params
  47250.         if ($to_date !== null) {
  47251.             $queryParams['toDate'] = AccountingObjectSerializer::toQueryValue($to_date);
  47252.         }
  47253.         // header params
  47254.         if ($xero_tenant_id !== null) {
  47255.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  47256.         }
  47257.         // body params
  47258.         $_tempBody null;
  47259.         if ($multipart) {
  47260.             $headers $this->headerSelector->selectHeadersForMultipart(
  47261.                 ['application/json']
  47262.             );
  47263.         } else {
  47264.             $headers $this->headerSelector->selectHeaders(
  47265.                 ['application/json'],
  47266.                 []
  47267.             );
  47268.         }
  47269.         // for model (json/xml)
  47270.         if (isset($_tempBody)) {
  47271.             // $_tempBody is the method argument, if present
  47272.             if ($headers['Content-Type'] === 'application/json') {
  47273.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  47274.             } else {
  47275.                 $httpBody $_tempBody;
  47276.             }
  47277.         } elseif (count($formParams) > 0) {
  47278.             if ($multipart) {
  47279.                 $multipartContents = [
  47280.                     [
  47281.                         'Content-type' => 'multipart/form-data',
  47282.                     ]
  47283.                 ];
  47284.                 
  47285.                 // for HTTP post (form)
  47286.                 $httpBody = new MultipartStream($multipartContents);
  47287.             } elseif ($headers['Content-Type'] === 'application/json') {
  47288.                 $httpBody \GuzzleHttp\json_encode($formParams);
  47289.             } else {
  47290.                 // for HTTP post (form)
  47291.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  47292.             }
  47293.         }
  47294.         // this endpoint requires OAuth (access token)
  47295.         if ($this->config->getAccessToken() !== null) {
  47296.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  47297.         }
  47298.         $defaultHeaders = [];
  47299.         if ($this->config->getUserAgent()) {
  47300.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  47301.         }
  47302.         $headers array_merge(
  47303.             $defaultHeaders,
  47304.             $headerParams,
  47305.             $headers
  47306.         );
  47307.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  47308.         return new Request(
  47309.             'GET',
  47310.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  47311.             $headers,
  47312.             $httpBody
  47313.         );
  47314.     }
  47315.     /**
  47316.      * Operation getReportAgedReceivablesByContact
  47317.      * Retrieves report for aged receivables by contact
  47318.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  47319.      * @param  string $contact_id Unique identifier for a Contact (required)
  47320.      * @param  \DateTime $date The date of the Aged Receivables By Contact report (optional)
  47321.      * @param  \DateTime $from_date filter by the from date of the report e.g. 2021-02-01 (optional)
  47322.      * @param  \DateTime $to_date filter by the to date of the report e.g. 2021-02-28 (optional)
  47323.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  47324.      * @throws \InvalidArgumentException
  47325.      * @return \XeroAPI\XeroPHP\Models\Accounting\ReportWithRows
  47326.      */
  47327.     public function getReportAgedReceivablesByContact($xero_tenant_id$contact_id$date null$from_date null$to_date null)
  47328.     {
  47329.         list($response) = $this->getReportAgedReceivablesByContactWithHttpInfo($xero_tenant_id$contact_id$date$from_date$to_date);
  47330.         return $response;
  47331.     }
  47332.     /**
  47333.      * Operation getReportAgedReceivablesByContactWithHttpInfo
  47334.      * Retrieves report for aged receivables by contact
  47335.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  47336.      * @param  string $contact_id Unique identifier for a Contact (required)
  47337.      * @param  \DateTime $date The date of the Aged Receivables By Contact report (optional)
  47338.      * @param  \DateTime $from_date filter by the from date of the report e.g. 2021-02-01 (optional)
  47339.      * @param  \DateTime $to_date filter by the to date of the report e.g. 2021-02-28 (optional)
  47340.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  47341.      * @throws \InvalidArgumentException
  47342.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\ReportWithRows, HTTP status code, HTTP response headers (array of strings)
  47343.      */
  47344.     public function getReportAgedReceivablesByContactWithHttpInfo($xero_tenant_id$contact_id$date null$from_date null$to_date null)
  47345.     {
  47346.         $request $this->getReportAgedReceivablesByContactRequest($xero_tenant_id$contact_id$date$from_date$to_date);
  47347.         try {
  47348.             $options $this->createHttpClientOption();
  47349.             try {
  47350.                 $response $this->client->send($request$options);
  47351.             } catch (RequestException $e) {
  47352.                 throw new ApiException(
  47353.                     "[{$e->getCode()}{$e->getMessage()}",
  47354.                     $e->getCode(),
  47355.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  47356.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  47357.                 );
  47358.             }
  47359.             $statusCode $response->getStatusCode();
  47360.             if ($statusCode 200 || $statusCode 299) {
  47361.                 throw new ApiException(
  47362.                     sprintf(
  47363.                         '[%d] Error connecting to the API (%s)',
  47364.                         $statusCode,
  47365.                         $request->getUri()
  47366.                     ),
  47367.                     $statusCode,
  47368.                     $response->getHeaders(),
  47369.                     $response->getBody()
  47370.                 );
  47371.             }
  47372.             $responseBody $response->getBody();
  47373.             switch($statusCode) {
  47374.                 case 200:
  47375.                     if ('\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows' === '\SplFileObject') {
  47376.                         $content $responseBody//stream goes to serializer
  47377.                     } else {
  47378.                         $content $responseBody->getContents();
  47379.                     }
  47380.                     return [
  47381.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows', []),
  47382.                         $response->getStatusCode(),
  47383.                         $response->getHeaders()
  47384.                     ];
  47385.             }
  47386.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows';
  47387.             $responseBody $response->getBody();
  47388.             if ($returnType === '\SplFileObject') {
  47389.                 $content $responseBody//stream goes to serializer
  47390.             } else {
  47391.                 $content $responseBody->getContents();
  47392.             }
  47393.             return [
  47394.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  47395.                 $response->getStatusCode(),
  47396.                 $response->getHeaders()
  47397.             ];
  47398.         } catch (ApiException $e) {
  47399.             switch ($e->getCode()) {
  47400.                 case 200:
  47401.                     $data AccountingObjectSerializer::deserialize(
  47402.                         $e->getResponseBody(),
  47403.                         '\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows',
  47404.                         $e->getResponseHeaders()
  47405.                     );
  47406.                     $e->setResponseObject($data);
  47407.                     break;
  47408.             }
  47409.             throw $e;
  47410.         }
  47411.     }
  47412.     /**
  47413.      * Operation getReportAgedReceivablesByContactAsync
  47414.      * Retrieves report for aged receivables by contact
  47415.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  47416.      * @param  string $contact_id Unique identifier for a Contact (required)
  47417.      * @param  \DateTime $date The date of the Aged Receivables By Contact report (optional)
  47418.      * @param  \DateTime $from_date filter by the from date of the report e.g. 2021-02-01 (optional)
  47419.      * @param  \DateTime $to_date filter by the to date of the report e.g. 2021-02-28 (optional)
  47420.      * @throws \InvalidArgumentException
  47421.      * @return \GuzzleHttp\Promise\PromiseInterface
  47422.      */
  47423.     public function getReportAgedReceivablesByContactAsync($xero_tenant_id$contact_id$date null$from_date null$to_date null)
  47424.     {
  47425.         return $this->getReportAgedReceivablesByContactAsyncWithHttpInfo($xero_tenant_id$contact_id$date$from_date$to_date)
  47426.             ->then(
  47427.                 function ($response) {
  47428.                     return $response[0];
  47429.                 }
  47430.             );
  47431.     }
  47432.     /**
  47433.      * Operation getReportAgedReceivablesByContactAsyncWithHttpInfo
  47434.      * Retrieves report for aged receivables by contact
  47435.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  47436.      * @param  string $contact_id Unique identifier for a Contact (required)
  47437.      * @param  \DateTime $date The date of the Aged Receivables By Contact report (optional)
  47438.      * @param  \DateTime $from_date filter by the from date of the report e.g. 2021-02-01 (optional)
  47439.      * @param  \DateTime $to_date filter by the to date of the report e.g. 2021-02-28 (optional)
  47440.      * @throws \InvalidArgumentException
  47441.      * @return \GuzzleHttp\Promise\PromiseInterface */
  47442.     public function getReportAgedReceivablesByContactAsyncWithHttpInfo($xero_tenant_id$contact_id$date null$from_date null$to_date null)
  47443.     {
  47444.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows';
  47445.         $request $this->getReportAgedReceivablesByContactRequest($xero_tenant_id$contact_id$date$from_date$to_date);
  47446.         return $this->client
  47447.             ->sendAsync($request$this->createHttpClientOption())
  47448.             ->then(
  47449.                 function ($response) use ($returnType) {
  47450.                     $responseBody $response->getBody();
  47451.                     if ($returnType === '\SplFileObject') {
  47452.                         $content $responseBody//stream goes to serializer
  47453.                     } else {
  47454.                         $content $responseBody->getContents();
  47455.                     }
  47456.                     return [
  47457.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  47458.                         $response->getStatusCode(),
  47459.                         $response->getHeaders()
  47460.                     ];
  47461.                 },
  47462.                 function ($exception) {
  47463.                     $response $exception->getResponse();
  47464.                     $statusCode $response->getStatusCode();
  47465.                     throw new ApiException(
  47466.                         sprintf(
  47467.                             '[%d] Error connecting to the API (%s)',
  47468.                             $statusCode,
  47469.                             $exception->getRequest()->getUri()
  47470.                         ),
  47471.                         $statusCode,
  47472.                         $response->getHeaders(),
  47473.                         $response->getBody()
  47474.                     );
  47475.                 }
  47476.             );
  47477.     }
  47478.     /**
  47479.      * Create request for operation 'getReportAgedReceivablesByContact'
  47480.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  47481.      * @param  string $contact_id Unique identifier for a Contact (required)
  47482.      * @param  \DateTime $date The date of the Aged Receivables By Contact report (optional)
  47483.      * @param  \DateTime $from_date filter by the from date of the report e.g. 2021-02-01 (optional)
  47484.      * @param  \DateTime $to_date filter by the to date of the report e.g. 2021-02-28 (optional)
  47485.      * @throws \InvalidArgumentException
  47486.      * @return \GuzzleHttp\Psr7\Request  */
  47487.     protected function getReportAgedReceivablesByContactRequest($xero_tenant_id$contact_id$date null$from_date null$to_date null)
  47488.     {
  47489.         // verify the required parameter 'xero_tenant_id' is set
  47490.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  47491.             throw new \InvalidArgumentException(
  47492.                 'Missing the required parameter $xero_tenant_id when calling getReportAgedReceivablesByContact'
  47493.             );
  47494.         }
  47495.         // verify the required parameter 'contact_id' is set
  47496.         if ($contact_id === null || (is_array($contact_id) && count($contact_id) === 0)) {
  47497.             throw new \InvalidArgumentException(
  47498.                 'Missing the required parameter $contact_id when calling getReportAgedReceivablesByContact'
  47499.             );
  47500.         }
  47501.         $resourcePath '/Reports/AgedReceivablesByContact';
  47502.         $formParams = [];
  47503.         $queryParams = [];
  47504.         $headerParams = [];
  47505.         $httpBody '';
  47506.         $multipart false;
  47507.         // query params
  47508.         if ($contact_id !== null) {
  47509.             $queryParams['contactId'] = AccountingObjectSerializer::toQueryValue($contact_id);
  47510.         }
  47511.         // query params
  47512.         if ($date !== null) {
  47513.             $queryParams['date'] = AccountingObjectSerializer::toQueryValue($date);
  47514.         }
  47515.         // query params
  47516.         if ($from_date !== null) {
  47517.             $queryParams['fromDate'] = AccountingObjectSerializer::toQueryValue($from_date);
  47518.         }
  47519.         // query params
  47520.         if ($to_date !== null) {
  47521.             $queryParams['toDate'] = AccountingObjectSerializer::toQueryValue($to_date);
  47522.         }
  47523.         // header params
  47524.         if ($xero_tenant_id !== null) {
  47525.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  47526.         }
  47527.         // body params
  47528.         $_tempBody null;
  47529.         if ($multipart) {
  47530.             $headers $this->headerSelector->selectHeadersForMultipart(
  47531.                 ['application/json']
  47532.             );
  47533.         } else {
  47534.             $headers $this->headerSelector->selectHeaders(
  47535.                 ['application/json'],
  47536.                 []
  47537.             );
  47538.         }
  47539.         // for model (json/xml)
  47540.         if (isset($_tempBody)) {
  47541.             // $_tempBody is the method argument, if present
  47542.             if ($headers['Content-Type'] === 'application/json') {
  47543.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  47544.             } else {
  47545.                 $httpBody $_tempBody;
  47546.             }
  47547.         } elseif (count($formParams) > 0) {
  47548.             if ($multipart) {
  47549.                 $multipartContents = [
  47550.                     [
  47551.                         'Content-type' => 'multipart/form-data',
  47552.                     ]
  47553.                 ];
  47554.                 
  47555.                 // for HTTP post (form)
  47556.                 $httpBody = new MultipartStream($multipartContents);
  47557.             } elseif ($headers['Content-Type'] === 'application/json') {
  47558.                 $httpBody \GuzzleHttp\json_encode($formParams);
  47559.             } else {
  47560.                 // for HTTP post (form)
  47561.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  47562.             }
  47563.         }
  47564.         // this endpoint requires OAuth (access token)
  47565.         if ($this->config->getAccessToken() !== null) {
  47566.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  47567.         }
  47568.         $defaultHeaders = [];
  47569.         if ($this->config->getUserAgent()) {
  47570.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  47571.         }
  47572.         $headers array_merge(
  47573.             $defaultHeaders,
  47574.             $headerParams,
  47575.             $headers
  47576.         );
  47577.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  47578.         return new Request(
  47579.             'GET',
  47580.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  47581.             $headers,
  47582.             $httpBody
  47583.         );
  47584.     }
  47585.     /**
  47586.      * Operation getReportBalanceSheet
  47587.      * Retrieves report for balancesheet
  47588.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  47589.      * @param  \DateTime $date The date of the Balance Sheet report (optional)
  47590.      * @param  int $periods The number of periods for the Balance Sheet report (optional)
  47591.      * @param  string $timeframe The period size to compare to (MONTH, QUARTER, YEAR) (optional)
  47592.      * @param  string $tracking_option_id1 The tracking option 1 for the Balance Sheet report (optional)
  47593.      * @param  string $tracking_option_id2 The tracking option 2 for the Balance Sheet report (optional)
  47594.      * @param  bool $standard_layout The standard layout boolean for the Balance Sheet report (optional)
  47595.      * @param  bool $payments_only return a cash basis for the Balance Sheet report (optional)
  47596.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  47597.      * @throws \InvalidArgumentException
  47598.      * @return \XeroAPI\XeroPHP\Models\Accounting\ReportWithRows
  47599.      */
  47600.     public function getReportBalanceSheet($xero_tenant_id$date null$periods null$timeframe null$tracking_option_id1 null$tracking_option_id2 null$standard_layout null$payments_only null)
  47601.     {
  47602.         list($response) = $this->getReportBalanceSheetWithHttpInfo($xero_tenant_id$date$periods$timeframe$tracking_option_id1$tracking_option_id2$standard_layout$payments_only);
  47603.         return $response;
  47604.     }
  47605.     /**
  47606.      * Operation getReportBalanceSheetWithHttpInfo
  47607.      * Retrieves report for balancesheet
  47608.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  47609.      * @param  \DateTime $date The date of the Balance Sheet report (optional)
  47610.      * @param  int $periods The number of periods for the Balance Sheet report (optional)
  47611.      * @param  string $timeframe The period size to compare to (MONTH, QUARTER, YEAR) (optional)
  47612.      * @param  string $tracking_option_id1 The tracking option 1 for the Balance Sheet report (optional)
  47613.      * @param  string $tracking_option_id2 The tracking option 2 for the Balance Sheet report (optional)
  47614.      * @param  bool $standard_layout The standard layout boolean for the Balance Sheet report (optional)
  47615.      * @param  bool $payments_only return a cash basis for the Balance Sheet report (optional)
  47616.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  47617.      * @throws \InvalidArgumentException
  47618.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\ReportWithRows, HTTP status code, HTTP response headers (array of strings)
  47619.      */
  47620.     public function getReportBalanceSheetWithHttpInfo($xero_tenant_id$date null$periods null$timeframe null$tracking_option_id1 null$tracking_option_id2 null$standard_layout null$payments_only null)
  47621.     {
  47622.         $request $this->getReportBalanceSheetRequest($xero_tenant_id$date$periods$timeframe$tracking_option_id1$tracking_option_id2$standard_layout$payments_only);
  47623.         try {
  47624.             $options $this->createHttpClientOption();
  47625.             try {
  47626.                 $response $this->client->send($request$options);
  47627.             } catch (RequestException $e) {
  47628.                 throw new ApiException(
  47629.                     "[{$e->getCode()}{$e->getMessage()}",
  47630.                     $e->getCode(),
  47631.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  47632.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  47633.                 );
  47634.             }
  47635.             $statusCode $response->getStatusCode();
  47636.             if ($statusCode 200 || $statusCode 299) {
  47637.                 throw new ApiException(
  47638.                     sprintf(
  47639.                         '[%d] Error connecting to the API (%s)',
  47640.                         $statusCode,
  47641.                         $request->getUri()
  47642.                     ),
  47643.                     $statusCode,
  47644.                     $response->getHeaders(),
  47645.                     $response->getBody()
  47646.                 );
  47647.             }
  47648.             $responseBody $response->getBody();
  47649.             switch($statusCode) {
  47650.                 case 200:
  47651.                     if ('\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows' === '\SplFileObject') {
  47652.                         $content $responseBody//stream goes to serializer
  47653.                     } else {
  47654.                         $content $responseBody->getContents();
  47655.                     }
  47656.                     return [
  47657.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows', []),
  47658.                         $response->getStatusCode(),
  47659.                         $response->getHeaders()
  47660.                     ];
  47661.             }
  47662.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows';
  47663.             $responseBody $response->getBody();
  47664.             if ($returnType === '\SplFileObject') {
  47665.                 $content $responseBody//stream goes to serializer
  47666.             } else {
  47667.                 $content $responseBody->getContents();
  47668.             }
  47669.             return [
  47670.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  47671.                 $response->getStatusCode(),
  47672.                 $response->getHeaders()
  47673.             ];
  47674.         } catch (ApiException $e) {
  47675.             switch ($e->getCode()) {
  47676.                 case 200:
  47677.                     $data AccountingObjectSerializer::deserialize(
  47678.                         $e->getResponseBody(),
  47679.                         '\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows',
  47680.                         $e->getResponseHeaders()
  47681.                     );
  47682.                     $e->setResponseObject($data);
  47683.                     break;
  47684.             }
  47685.             throw $e;
  47686.         }
  47687.     }
  47688.     /**
  47689.      * Operation getReportBalanceSheetAsync
  47690.      * Retrieves report for balancesheet
  47691.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  47692.      * @param  \DateTime $date The date of the Balance Sheet report (optional)
  47693.      * @param  int $periods The number of periods for the Balance Sheet report (optional)
  47694.      * @param  string $timeframe The period size to compare to (MONTH, QUARTER, YEAR) (optional)
  47695.      * @param  string $tracking_option_id1 The tracking option 1 for the Balance Sheet report (optional)
  47696.      * @param  string $tracking_option_id2 The tracking option 2 for the Balance Sheet report (optional)
  47697.      * @param  bool $standard_layout The standard layout boolean for the Balance Sheet report (optional)
  47698.      * @param  bool $payments_only return a cash basis for the Balance Sheet report (optional)
  47699.      * @throws \InvalidArgumentException
  47700.      * @return \GuzzleHttp\Promise\PromiseInterface
  47701.      */
  47702.     public function getReportBalanceSheetAsync($xero_tenant_id$date null$periods null$timeframe null$tracking_option_id1 null$tracking_option_id2 null$standard_layout null$payments_only null)
  47703.     {
  47704.         return $this->getReportBalanceSheetAsyncWithHttpInfo($xero_tenant_id$date$periods$timeframe$tracking_option_id1$tracking_option_id2$standard_layout$payments_only)
  47705.             ->then(
  47706.                 function ($response) {
  47707.                     return $response[0];
  47708.                 }
  47709.             );
  47710.     }
  47711.     /**
  47712.      * Operation getReportBalanceSheetAsyncWithHttpInfo
  47713.      * Retrieves report for balancesheet
  47714.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  47715.      * @param  \DateTime $date The date of the Balance Sheet report (optional)
  47716.      * @param  int $periods The number of periods for the Balance Sheet report (optional)
  47717.      * @param  string $timeframe The period size to compare to (MONTH, QUARTER, YEAR) (optional)
  47718.      * @param  string $tracking_option_id1 The tracking option 1 for the Balance Sheet report (optional)
  47719.      * @param  string $tracking_option_id2 The tracking option 2 for the Balance Sheet report (optional)
  47720.      * @param  bool $standard_layout The standard layout boolean for the Balance Sheet report (optional)
  47721.      * @param  bool $payments_only return a cash basis for the Balance Sheet report (optional)
  47722.      * @throws \InvalidArgumentException
  47723.      * @return \GuzzleHttp\Promise\PromiseInterface */
  47724.     public function getReportBalanceSheetAsyncWithHttpInfo($xero_tenant_id$date null$periods null$timeframe null$tracking_option_id1 null$tracking_option_id2 null$standard_layout null$payments_only null)
  47725.     {
  47726.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows';
  47727.         $request $this->getReportBalanceSheetRequest($xero_tenant_id$date$periods$timeframe$tracking_option_id1$tracking_option_id2$standard_layout$payments_only);
  47728.         return $this->client
  47729.             ->sendAsync($request$this->createHttpClientOption())
  47730.             ->then(
  47731.                 function ($response) use ($returnType) {
  47732.                     $responseBody $response->getBody();
  47733.                     if ($returnType === '\SplFileObject') {
  47734.                         $content $responseBody//stream goes to serializer
  47735.                     } else {
  47736.                         $content $responseBody->getContents();
  47737.                     }
  47738.                     return [
  47739.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  47740.                         $response->getStatusCode(),
  47741.                         $response->getHeaders()
  47742.                     ];
  47743.                 },
  47744.                 function ($exception) {
  47745.                     $response $exception->getResponse();
  47746.                     $statusCode $response->getStatusCode();
  47747.                     throw new ApiException(
  47748.                         sprintf(
  47749.                             '[%d] Error connecting to the API (%s)',
  47750.                             $statusCode,
  47751.                             $exception->getRequest()->getUri()
  47752.                         ),
  47753.                         $statusCode,
  47754.                         $response->getHeaders(),
  47755.                         $response->getBody()
  47756.                     );
  47757.                 }
  47758.             );
  47759.     }
  47760.     /**
  47761.      * Create request for operation 'getReportBalanceSheet'
  47762.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  47763.      * @param  \DateTime $date The date of the Balance Sheet report (optional)
  47764.      * @param  int $periods The number of periods for the Balance Sheet report (optional)
  47765.      * @param  string $timeframe The period size to compare to (MONTH, QUARTER, YEAR) (optional)
  47766.      * @param  string $tracking_option_id1 The tracking option 1 for the Balance Sheet report (optional)
  47767.      * @param  string $tracking_option_id2 The tracking option 2 for the Balance Sheet report (optional)
  47768.      * @param  bool $standard_layout The standard layout boolean for the Balance Sheet report (optional)
  47769.      * @param  bool $payments_only return a cash basis for the Balance Sheet report (optional)
  47770.      * @throws \InvalidArgumentException
  47771.      * @return \GuzzleHttp\Psr7\Request  */
  47772.     protected function getReportBalanceSheetRequest($xero_tenant_id$date null$periods null$timeframe null$tracking_option_id1 null$tracking_option_id2 null$standard_layout null$payments_only null)
  47773.     {
  47774.         // verify the required parameter 'xero_tenant_id' is set
  47775.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  47776.             throw new \InvalidArgumentException(
  47777.                 'Missing the required parameter $xero_tenant_id when calling getReportBalanceSheet'
  47778.             );
  47779.         }
  47780.         $resourcePath '/Reports/BalanceSheet';
  47781.         $formParams = [];
  47782.         $queryParams = [];
  47783.         $headerParams = [];
  47784.         $httpBody '';
  47785.         $multipart false;
  47786.         // query params
  47787.         if ($date !== null) {
  47788.             $queryParams['date'] = AccountingObjectSerializer::toQueryValue($date);
  47789.         }
  47790.         // query params
  47791.         if ($periods !== null) {
  47792.             $queryParams['periods'] = AccountingObjectSerializer::toQueryValue($periods);
  47793.         }
  47794.         // query params
  47795.         if ($timeframe !== null) {
  47796.             $queryParams['timeframe'] = AccountingObjectSerializer::toQueryValue($timeframe);
  47797.         }
  47798.         // query params
  47799.         if ($tracking_option_id1 !== null) {
  47800.             $queryParams['trackingOptionID1'] = AccountingObjectSerializer::toQueryValue($tracking_option_id1);
  47801.         }
  47802.         // query params
  47803.         if ($tracking_option_id2 !== null) {
  47804.             $queryParams['trackingOptionID2'] = AccountingObjectSerializer::toQueryValue($tracking_option_id2);
  47805.         }
  47806.         // query params
  47807.         if ($standard_layout !== null) {
  47808.             $queryParams['standardLayout'] = $standard_layout 'true' 'false';
  47809.         }
  47810.         // query params
  47811.         if ($payments_only !== null) {
  47812.             $queryParams['paymentsOnly'] = $payments_only 'true' 'false';
  47813.         }
  47814.         // header params
  47815.         if ($xero_tenant_id !== null) {
  47816.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  47817.         }
  47818.         // body params
  47819.         $_tempBody null;
  47820.         if ($multipart) {
  47821.             $headers $this->headerSelector->selectHeadersForMultipart(
  47822.                 ['application/json']
  47823.             );
  47824.         } else {
  47825.             $headers $this->headerSelector->selectHeaders(
  47826.                 ['application/json'],
  47827.                 []
  47828.             );
  47829.         }
  47830.         // for model (json/xml)
  47831.         if (isset($_tempBody)) {
  47832.             // $_tempBody is the method argument, if present
  47833.             if ($headers['Content-Type'] === 'application/json') {
  47834.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  47835.             } else {
  47836.                 $httpBody $_tempBody;
  47837.             }
  47838.         } elseif (count($formParams) > 0) {
  47839.             if ($multipart) {
  47840.                 $multipartContents = [
  47841.                     [
  47842.                         'Content-type' => 'multipart/form-data',
  47843.                     ]
  47844.                 ];
  47845.                 
  47846.                 // for HTTP post (form)
  47847.                 $httpBody = new MultipartStream($multipartContents);
  47848.             } elseif ($headers['Content-Type'] === 'application/json') {
  47849.                 $httpBody \GuzzleHttp\json_encode($formParams);
  47850.             } else {
  47851.                 // for HTTP post (form)
  47852.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  47853.             }
  47854.         }
  47855.         // this endpoint requires OAuth (access token)
  47856.         if ($this->config->getAccessToken() !== null) {
  47857.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  47858.         }
  47859.         $defaultHeaders = [];
  47860.         if ($this->config->getUserAgent()) {
  47861.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  47862.         }
  47863.         $headers array_merge(
  47864.             $defaultHeaders,
  47865.             $headerParams,
  47866.             $headers
  47867.         );
  47868.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  47869.         return new Request(
  47870.             'GET',
  47871.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  47872.             $headers,
  47873.             $httpBody
  47874.         );
  47875.     }
  47876.     /**
  47877.      * Operation getReportBankSummary
  47878.      * Retrieves report for bank summary
  47879.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  47880.      * @param  \DateTime $from_date filter by the from date of the report e.g. 2021-02-01 (optional)
  47881.      * @param  \DateTime $to_date filter by the to date of the report e.g. 2021-02-28 (optional)
  47882.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  47883.      * @throws \InvalidArgumentException
  47884.      * @return \XeroAPI\XeroPHP\Models\Accounting\ReportWithRows
  47885.      */
  47886.     public function getReportBankSummary($xero_tenant_id$from_date null$to_date null)
  47887.     {
  47888.         list($response) = $this->getReportBankSummaryWithHttpInfo($xero_tenant_id$from_date$to_date);
  47889.         return $response;
  47890.     }
  47891.     /**
  47892.      * Operation getReportBankSummaryWithHttpInfo
  47893.      * Retrieves report for bank summary
  47894.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  47895.      * @param  \DateTime $from_date filter by the from date of the report e.g. 2021-02-01 (optional)
  47896.      * @param  \DateTime $to_date filter by the to date of the report e.g. 2021-02-28 (optional)
  47897.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  47898.      * @throws \InvalidArgumentException
  47899.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\ReportWithRows, HTTP status code, HTTP response headers (array of strings)
  47900.      */
  47901.     public function getReportBankSummaryWithHttpInfo($xero_tenant_id$from_date null$to_date null)
  47902.     {
  47903.         $request $this->getReportBankSummaryRequest($xero_tenant_id$from_date$to_date);
  47904.         try {
  47905.             $options $this->createHttpClientOption();
  47906.             try {
  47907.                 $response $this->client->send($request$options);
  47908.             } catch (RequestException $e) {
  47909.                 throw new ApiException(
  47910.                     "[{$e->getCode()}{$e->getMessage()}",
  47911.                     $e->getCode(),
  47912.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  47913.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  47914.                 );
  47915.             }
  47916.             $statusCode $response->getStatusCode();
  47917.             if ($statusCode 200 || $statusCode 299) {
  47918.                 throw new ApiException(
  47919.                     sprintf(
  47920.                         '[%d] Error connecting to the API (%s)',
  47921.                         $statusCode,
  47922.                         $request->getUri()
  47923.                     ),
  47924.                     $statusCode,
  47925.                     $response->getHeaders(),
  47926.                     $response->getBody()
  47927.                 );
  47928.             }
  47929.             $responseBody $response->getBody();
  47930.             switch($statusCode) {
  47931.                 case 200:
  47932.                     if ('\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows' === '\SplFileObject') {
  47933.                         $content $responseBody//stream goes to serializer
  47934.                     } else {
  47935.                         $content $responseBody->getContents();
  47936.                     }
  47937.                     return [
  47938.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows', []),
  47939.                         $response->getStatusCode(),
  47940.                         $response->getHeaders()
  47941.                     ];
  47942.             }
  47943.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows';
  47944.             $responseBody $response->getBody();
  47945.             if ($returnType === '\SplFileObject') {
  47946.                 $content $responseBody//stream goes to serializer
  47947.             } else {
  47948.                 $content $responseBody->getContents();
  47949.             }
  47950.             return [
  47951.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  47952.                 $response->getStatusCode(),
  47953.                 $response->getHeaders()
  47954.             ];
  47955.         } catch (ApiException $e) {
  47956.             switch ($e->getCode()) {
  47957.                 case 200:
  47958.                     $data AccountingObjectSerializer::deserialize(
  47959.                         $e->getResponseBody(),
  47960.                         '\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows',
  47961.                         $e->getResponseHeaders()
  47962.                     );
  47963.                     $e->setResponseObject($data);
  47964.                     break;
  47965.             }
  47966.             throw $e;
  47967.         }
  47968.     }
  47969.     /**
  47970.      * Operation getReportBankSummaryAsync
  47971.      * Retrieves report for bank summary
  47972.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  47973.      * @param  \DateTime $from_date filter by the from date of the report e.g. 2021-02-01 (optional)
  47974.      * @param  \DateTime $to_date filter by the to date of the report e.g. 2021-02-28 (optional)
  47975.      * @throws \InvalidArgumentException
  47976.      * @return \GuzzleHttp\Promise\PromiseInterface
  47977.      */
  47978.     public function getReportBankSummaryAsync($xero_tenant_id$from_date null$to_date null)
  47979.     {
  47980.         return $this->getReportBankSummaryAsyncWithHttpInfo($xero_tenant_id$from_date$to_date)
  47981.             ->then(
  47982.                 function ($response) {
  47983.                     return $response[0];
  47984.                 }
  47985.             );
  47986.     }
  47987.     /**
  47988.      * Operation getReportBankSummaryAsyncWithHttpInfo
  47989.      * Retrieves report for bank summary
  47990.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  47991.      * @param  \DateTime $from_date filter by the from date of the report e.g. 2021-02-01 (optional)
  47992.      * @param  \DateTime $to_date filter by the to date of the report e.g. 2021-02-28 (optional)
  47993.      * @throws \InvalidArgumentException
  47994.      * @return \GuzzleHttp\Promise\PromiseInterface */
  47995.     public function getReportBankSummaryAsyncWithHttpInfo($xero_tenant_id$from_date null$to_date null)
  47996.     {
  47997.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows';
  47998.         $request $this->getReportBankSummaryRequest($xero_tenant_id$from_date$to_date);
  47999.         return $this->client
  48000.             ->sendAsync($request$this->createHttpClientOption())
  48001.             ->then(
  48002.                 function ($response) use ($returnType) {
  48003.                     $responseBody $response->getBody();
  48004.                     if ($returnType === '\SplFileObject') {
  48005.                         $content $responseBody//stream goes to serializer
  48006.                     } else {
  48007.                         $content $responseBody->getContents();
  48008.                     }
  48009.                     return [
  48010.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  48011.                         $response->getStatusCode(),
  48012.                         $response->getHeaders()
  48013.                     ];
  48014.                 },
  48015.                 function ($exception) {
  48016.                     $response $exception->getResponse();
  48017.                     $statusCode $response->getStatusCode();
  48018.                     throw new ApiException(
  48019.                         sprintf(
  48020.                             '[%d] Error connecting to the API (%s)',
  48021.                             $statusCode,
  48022.                             $exception->getRequest()->getUri()
  48023.                         ),
  48024.                         $statusCode,
  48025.                         $response->getHeaders(),
  48026.                         $response->getBody()
  48027.                     );
  48028.                 }
  48029.             );
  48030.     }
  48031.     /**
  48032.      * Create request for operation 'getReportBankSummary'
  48033.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  48034.      * @param  \DateTime $from_date filter by the from date of the report e.g. 2021-02-01 (optional)
  48035.      * @param  \DateTime $to_date filter by the to date of the report e.g. 2021-02-28 (optional)
  48036.      * @throws \InvalidArgumentException
  48037.      * @return \GuzzleHttp\Psr7\Request  */
  48038.     protected function getReportBankSummaryRequest($xero_tenant_id$from_date null$to_date null)
  48039.     {
  48040.         // verify the required parameter 'xero_tenant_id' is set
  48041.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  48042.             throw new \InvalidArgumentException(
  48043.                 'Missing the required parameter $xero_tenant_id when calling getReportBankSummary'
  48044.             );
  48045.         }
  48046.         $resourcePath '/Reports/BankSummary';
  48047.         $formParams = [];
  48048.         $queryParams = [];
  48049.         $headerParams = [];
  48050.         $httpBody '';
  48051.         $multipart false;
  48052.         // query params
  48053.         if ($from_date !== null) {
  48054.             $queryParams['fromDate'] = AccountingObjectSerializer::toQueryValue($from_date);
  48055.         }
  48056.         // query params
  48057.         if ($to_date !== null) {
  48058.             $queryParams['toDate'] = AccountingObjectSerializer::toQueryValue($to_date);
  48059.         }
  48060.         // header params
  48061.         if ($xero_tenant_id !== null) {
  48062.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  48063.         }
  48064.         // body params
  48065.         $_tempBody null;
  48066.         if ($multipart) {
  48067.             $headers $this->headerSelector->selectHeadersForMultipart(
  48068.                 ['application/json']
  48069.             );
  48070.         } else {
  48071.             $headers $this->headerSelector->selectHeaders(
  48072.                 ['application/json'],
  48073.                 []
  48074.             );
  48075.         }
  48076.         // for model (json/xml)
  48077.         if (isset($_tempBody)) {
  48078.             // $_tempBody is the method argument, if present
  48079.             if ($headers['Content-Type'] === 'application/json') {
  48080.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  48081.             } else {
  48082.                 $httpBody $_tempBody;
  48083.             }
  48084.         } elseif (count($formParams) > 0) {
  48085.             if ($multipart) {
  48086.                 $multipartContents = [
  48087.                     [
  48088.                         'Content-type' => 'multipart/form-data',
  48089.                     ]
  48090.                 ];
  48091.                 
  48092.                 // for HTTP post (form)
  48093.                 $httpBody = new MultipartStream($multipartContents);
  48094.             } elseif ($headers['Content-Type'] === 'application/json') {
  48095.                 $httpBody \GuzzleHttp\json_encode($formParams);
  48096.             } else {
  48097.                 // for HTTP post (form)
  48098.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  48099.             }
  48100.         }
  48101.         // this endpoint requires OAuth (access token)
  48102.         if ($this->config->getAccessToken() !== null) {
  48103.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  48104.         }
  48105.         $defaultHeaders = [];
  48106.         if ($this->config->getUserAgent()) {
  48107.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  48108.         }
  48109.         $headers array_merge(
  48110.             $defaultHeaders,
  48111.             $headerParams,
  48112.             $headers
  48113.         );
  48114.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  48115.         return new Request(
  48116.             'GET',
  48117.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  48118.             $headers,
  48119.             $httpBody
  48120.         );
  48121.     }
  48122.     /**
  48123.      * Operation getReportBudgetSummary
  48124.      * Retrieves report for budget summary
  48125.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  48126.      * @param  \DateTime $date The date for the Bank Summary report e.g. 2018-03-31 (optional)
  48127.      * @param  int $periods The number of periods to compare (integer between 1 and 12) (optional)
  48128.      * @param  int $timeframe The period size to compare to (1&#x3D;month, 3&#x3D;quarter, 12&#x3D;year) (optional)
  48129.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  48130.      * @throws \InvalidArgumentException
  48131.      * @return \XeroAPI\XeroPHP\Models\Accounting\ReportWithRows
  48132.      */
  48133.     public function getReportBudgetSummary($xero_tenant_id$date null$periods null$timeframe null)
  48134.     {
  48135.         list($response) = $this->getReportBudgetSummaryWithHttpInfo($xero_tenant_id$date$periods$timeframe);
  48136.         return $response;
  48137.     }
  48138.     /**
  48139.      * Operation getReportBudgetSummaryWithHttpInfo
  48140.      * Retrieves report for budget summary
  48141.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  48142.      * @param  \DateTime $date The date for the Bank Summary report e.g. 2018-03-31 (optional)
  48143.      * @param  int $periods The number of periods to compare (integer between 1 and 12) (optional)
  48144.      * @param  int $timeframe The period size to compare to (1&#x3D;month, 3&#x3D;quarter, 12&#x3D;year) (optional)
  48145.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  48146.      * @throws \InvalidArgumentException
  48147.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\ReportWithRows, HTTP status code, HTTP response headers (array of strings)
  48148.      */
  48149.     public function getReportBudgetSummaryWithHttpInfo($xero_tenant_id$date null$periods null$timeframe null)
  48150.     {
  48151.         $request $this->getReportBudgetSummaryRequest($xero_tenant_id$date$periods$timeframe);
  48152.         try {
  48153.             $options $this->createHttpClientOption();
  48154.             try {
  48155.                 $response $this->client->send($request$options);
  48156.             } catch (RequestException $e) {
  48157.                 throw new ApiException(
  48158.                     "[{$e->getCode()}{$e->getMessage()}",
  48159.                     $e->getCode(),
  48160.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  48161.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  48162.                 );
  48163.             }
  48164.             $statusCode $response->getStatusCode();
  48165.             if ($statusCode 200 || $statusCode 299) {
  48166.                 throw new ApiException(
  48167.                     sprintf(
  48168.                         '[%d] Error connecting to the API (%s)',
  48169.                         $statusCode,
  48170.                         $request->getUri()
  48171.                     ),
  48172.                     $statusCode,
  48173.                     $response->getHeaders(),
  48174.                     $response->getBody()
  48175.                 );
  48176.             }
  48177.             $responseBody $response->getBody();
  48178.             switch($statusCode) {
  48179.                 case 200:
  48180.                     if ('\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows' === '\SplFileObject') {
  48181.                         $content $responseBody//stream goes to serializer
  48182.                     } else {
  48183.                         $content $responseBody->getContents();
  48184.                     }
  48185.                     return [
  48186.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows', []),
  48187.                         $response->getStatusCode(),
  48188.                         $response->getHeaders()
  48189.                     ];
  48190.             }
  48191.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows';
  48192.             $responseBody $response->getBody();
  48193.             if ($returnType === '\SplFileObject') {
  48194.                 $content $responseBody//stream goes to serializer
  48195.             } else {
  48196.                 $content $responseBody->getContents();
  48197.             }
  48198.             return [
  48199.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  48200.                 $response->getStatusCode(),
  48201.                 $response->getHeaders()
  48202.             ];
  48203.         } catch (ApiException $e) {
  48204.             switch ($e->getCode()) {
  48205.                 case 200:
  48206.                     $data AccountingObjectSerializer::deserialize(
  48207.                         $e->getResponseBody(),
  48208.                         '\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows',
  48209.                         $e->getResponseHeaders()
  48210.                     );
  48211.                     $e->setResponseObject($data);
  48212.                     break;
  48213.             }
  48214.             throw $e;
  48215.         }
  48216.     }
  48217.     /**
  48218.      * Operation getReportBudgetSummaryAsync
  48219.      * Retrieves report for budget summary
  48220.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  48221.      * @param  \DateTime $date The date for the Bank Summary report e.g. 2018-03-31 (optional)
  48222.      * @param  int $periods The number of periods to compare (integer between 1 and 12) (optional)
  48223.      * @param  int $timeframe The period size to compare to (1&#x3D;month, 3&#x3D;quarter, 12&#x3D;year) (optional)
  48224.      * @throws \InvalidArgumentException
  48225.      * @return \GuzzleHttp\Promise\PromiseInterface
  48226.      */
  48227.     public function getReportBudgetSummaryAsync($xero_tenant_id$date null$periods null$timeframe null)
  48228.     {
  48229.         return $this->getReportBudgetSummaryAsyncWithHttpInfo($xero_tenant_id$date$periods$timeframe)
  48230.             ->then(
  48231.                 function ($response) {
  48232.                     return $response[0];
  48233.                 }
  48234.             );
  48235.     }
  48236.     /**
  48237.      * Operation getReportBudgetSummaryAsyncWithHttpInfo
  48238.      * Retrieves report for budget summary
  48239.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  48240.      * @param  \DateTime $date The date for the Bank Summary report e.g. 2018-03-31 (optional)
  48241.      * @param  int $periods The number of periods to compare (integer between 1 and 12) (optional)
  48242.      * @param  int $timeframe The period size to compare to (1&#x3D;month, 3&#x3D;quarter, 12&#x3D;year) (optional)
  48243.      * @throws \InvalidArgumentException
  48244.      * @return \GuzzleHttp\Promise\PromiseInterface */
  48245.     public function getReportBudgetSummaryAsyncWithHttpInfo($xero_tenant_id$date null$periods null$timeframe null)
  48246.     {
  48247.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows';
  48248.         $request $this->getReportBudgetSummaryRequest($xero_tenant_id$date$periods$timeframe);
  48249.         return $this->client
  48250.             ->sendAsync($request$this->createHttpClientOption())
  48251.             ->then(
  48252.                 function ($response) use ($returnType) {
  48253.                     $responseBody $response->getBody();
  48254.                     if ($returnType === '\SplFileObject') {
  48255.                         $content $responseBody//stream goes to serializer
  48256.                     } else {
  48257.                         $content $responseBody->getContents();
  48258.                     }
  48259.                     return [
  48260.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  48261.                         $response->getStatusCode(),
  48262.                         $response->getHeaders()
  48263.                     ];
  48264.                 },
  48265.                 function ($exception) {
  48266.                     $response $exception->getResponse();
  48267.                     $statusCode $response->getStatusCode();
  48268.                     throw new ApiException(
  48269.                         sprintf(
  48270.                             '[%d] Error connecting to the API (%s)',
  48271.                             $statusCode,
  48272.                             $exception->getRequest()->getUri()
  48273.                         ),
  48274.                         $statusCode,
  48275.                         $response->getHeaders(),
  48276.                         $response->getBody()
  48277.                     );
  48278.                 }
  48279.             );
  48280.     }
  48281.     /**
  48282.      * Create request for operation 'getReportBudgetSummary'
  48283.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  48284.      * @param  \DateTime $date The date for the Bank Summary report e.g. 2018-03-31 (optional)
  48285.      * @param  int $periods The number of periods to compare (integer between 1 and 12) (optional)
  48286.      * @param  int $timeframe The period size to compare to (1&#x3D;month, 3&#x3D;quarter, 12&#x3D;year) (optional)
  48287.      * @throws \InvalidArgumentException
  48288.      * @return \GuzzleHttp\Psr7\Request  */
  48289.     protected function getReportBudgetSummaryRequest($xero_tenant_id$date null$periods null$timeframe null)
  48290.     {
  48291.         // verify the required parameter 'xero_tenant_id' is set
  48292.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  48293.             throw new \InvalidArgumentException(
  48294.                 'Missing the required parameter $xero_tenant_id when calling getReportBudgetSummary'
  48295.             );
  48296.         }
  48297.         $resourcePath '/Reports/BudgetSummary';
  48298.         $formParams = [];
  48299.         $queryParams = [];
  48300.         $headerParams = [];
  48301.         $httpBody '';
  48302.         $multipart false;
  48303.         // query params
  48304.         if ($date !== null) {
  48305.             $queryParams['date'] = AccountingObjectSerializer::toQueryValue($date);
  48306.         }
  48307.         // query params
  48308.         if ($periods !== null) {
  48309.             $queryParams['periods'] = AccountingObjectSerializer::toQueryValue($periods);
  48310.         }
  48311.         // query params
  48312.         if ($timeframe !== null) {
  48313.             $queryParams['timeframe'] = AccountingObjectSerializer::toQueryValue($timeframe);
  48314.         }
  48315.         // header params
  48316.         if ($xero_tenant_id !== null) {
  48317.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  48318.         }
  48319.         // body params
  48320.         $_tempBody null;
  48321.         if ($multipart) {
  48322.             $headers $this->headerSelector->selectHeadersForMultipart(
  48323.                 ['application/json']
  48324.             );
  48325.         } else {
  48326.             $headers $this->headerSelector->selectHeaders(
  48327.                 ['application/json'],
  48328.                 []
  48329.             );
  48330.         }
  48331.         // for model (json/xml)
  48332.         if (isset($_tempBody)) {
  48333.             // $_tempBody is the method argument, if present
  48334.             if ($headers['Content-Type'] === 'application/json') {
  48335.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  48336.             } else {
  48337.                 $httpBody $_tempBody;
  48338.             }
  48339.         } elseif (count($formParams) > 0) {
  48340.             if ($multipart) {
  48341.                 $multipartContents = [
  48342.                     [
  48343.                         'Content-type' => 'multipart/form-data',
  48344.                     ]
  48345.                 ];
  48346.                 
  48347.                 // for HTTP post (form)
  48348.                 $httpBody = new MultipartStream($multipartContents);
  48349.             } elseif ($headers['Content-Type'] === 'application/json') {
  48350.                 $httpBody \GuzzleHttp\json_encode($formParams);
  48351.             } else {
  48352.                 // for HTTP post (form)
  48353.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  48354.             }
  48355.         }
  48356.         // this endpoint requires OAuth (access token)
  48357.         if ($this->config->getAccessToken() !== null) {
  48358.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  48359.         }
  48360.         $defaultHeaders = [];
  48361.         if ($this->config->getUserAgent()) {
  48362.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  48363.         }
  48364.         $headers array_merge(
  48365.             $defaultHeaders,
  48366.             $headerParams,
  48367.             $headers
  48368.         );
  48369.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  48370.         return new Request(
  48371.             'GET',
  48372.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  48373.             $headers,
  48374.             $httpBody
  48375.         );
  48376.     }
  48377.     /**
  48378.      * Operation getReportExecutiveSummary
  48379.      * Retrieves report for executive summary
  48380.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  48381.      * @param  \DateTime $date The date for the Bank Summary report e.g. 2018-03-31 (optional)
  48382.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  48383.      * @throws \InvalidArgumentException
  48384.      * @return \XeroAPI\XeroPHP\Models\Accounting\ReportWithRows
  48385.      */
  48386.     public function getReportExecutiveSummary($xero_tenant_id$date null)
  48387.     {
  48388.         list($response) = $this->getReportExecutiveSummaryWithHttpInfo($xero_tenant_id$date);
  48389.         return $response;
  48390.     }
  48391.     /**
  48392.      * Operation getReportExecutiveSummaryWithHttpInfo
  48393.      * Retrieves report for executive summary
  48394.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  48395.      * @param  \DateTime $date The date for the Bank Summary report e.g. 2018-03-31 (optional)
  48396.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  48397.      * @throws \InvalidArgumentException
  48398.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\ReportWithRows, HTTP status code, HTTP response headers (array of strings)
  48399.      */
  48400.     public function getReportExecutiveSummaryWithHttpInfo($xero_tenant_id$date null)
  48401.     {
  48402.         $request $this->getReportExecutiveSummaryRequest($xero_tenant_id$date);
  48403.         try {
  48404.             $options $this->createHttpClientOption();
  48405.             try {
  48406.                 $response $this->client->send($request$options);
  48407.             } catch (RequestException $e) {
  48408.                 throw new ApiException(
  48409.                     "[{$e->getCode()}{$e->getMessage()}",
  48410.                     $e->getCode(),
  48411.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  48412.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  48413.                 );
  48414.             }
  48415.             $statusCode $response->getStatusCode();
  48416.             if ($statusCode 200 || $statusCode 299) {
  48417.                 throw new ApiException(
  48418.                     sprintf(
  48419.                         '[%d] Error connecting to the API (%s)',
  48420.                         $statusCode,
  48421.                         $request->getUri()
  48422.                     ),
  48423.                     $statusCode,
  48424.                     $response->getHeaders(),
  48425.                     $response->getBody()
  48426.                 );
  48427.             }
  48428.             $responseBody $response->getBody();
  48429.             switch($statusCode) {
  48430.                 case 200:
  48431.                     if ('\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows' === '\SplFileObject') {
  48432.                         $content $responseBody//stream goes to serializer
  48433.                     } else {
  48434.                         $content $responseBody->getContents();
  48435.                     }
  48436.                     return [
  48437.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows', []),
  48438.                         $response->getStatusCode(),
  48439.                         $response->getHeaders()
  48440.                     ];
  48441.             }
  48442.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows';
  48443.             $responseBody $response->getBody();
  48444.             if ($returnType === '\SplFileObject') {
  48445.                 $content $responseBody//stream goes to serializer
  48446.             } else {
  48447.                 $content $responseBody->getContents();
  48448.             }
  48449.             return [
  48450.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  48451.                 $response->getStatusCode(),
  48452.                 $response->getHeaders()
  48453.             ];
  48454.         } catch (ApiException $e) {
  48455.             switch ($e->getCode()) {
  48456.                 case 200:
  48457.                     $data AccountingObjectSerializer::deserialize(
  48458.                         $e->getResponseBody(),
  48459.                         '\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows',
  48460.                         $e->getResponseHeaders()
  48461.                     );
  48462.                     $e->setResponseObject($data);
  48463.                     break;
  48464.             }
  48465.             throw $e;
  48466.         }
  48467.     }
  48468.     /**
  48469.      * Operation getReportExecutiveSummaryAsync
  48470.      * Retrieves report for executive summary
  48471.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  48472.      * @param  \DateTime $date The date for the Bank Summary report e.g. 2018-03-31 (optional)
  48473.      * @throws \InvalidArgumentException
  48474.      * @return \GuzzleHttp\Promise\PromiseInterface
  48475.      */
  48476.     public function getReportExecutiveSummaryAsync($xero_tenant_id$date null)
  48477.     {
  48478.         return $this->getReportExecutiveSummaryAsyncWithHttpInfo($xero_tenant_id$date)
  48479.             ->then(
  48480.                 function ($response) {
  48481.                     return $response[0];
  48482.                 }
  48483.             );
  48484.     }
  48485.     /**
  48486.      * Operation getReportExecutiveSummaryAsyncWithHttpInfo
  48487.      * Retrieves report for executive summary
  48488.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  48489.      * @param  \DateTime $date The date for the Bank Summary report e.g. 2018-03-31 (optional)
  48490.      * @throws \InvalidArgumentException
  48491.      * @return \GuzzleHttp\Promise\PromiseInterface */
  48492.     public function getReportExecutiveSummaryAsyncWithHttpInfo($xero_tenant_id$date null)
  48493.     {
  48494.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows';
  48495.         $request $this->getReportExecutiveSummaryRequest($xero_tenant_id$date);
  48496.         return $this->client
  48497.             ->sendAsync($request$this->createHttpClientOption())
  48498.             ->then(
  48499.                 function ($response) use ($returnType) {
  48500.                     $responseBody $response->getBody();
  48501.                     if ($returnType === '\SplFileObject') {
  48502.                         $content $responseBody//stream goes to serializer
  48503.                     } else {
  48504.                         $content $responseBody->getContents();
  48505.                     }
  48506.                     return [
  48507.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  48508.                         $response->getStatusCode(),
  48509.                         $response->getHeaders()
  48510.                     ];
  48511.                 },
  48512.                 function ($exception) {
  48513.                     $response $exception->getResponse();
  48514.                     $statusCode $response->getStatusCode();
  48515.                     throw new ApiException(
  48516.                         sprintf(
  48517.                             '[%d] Error connecting to the API (%s)',
  48518.                             $statusCode,
  48519.                             $exception->getRequest()->getUri()
  48520.                         ),
  48521.                         $statusCode,
  48522.                         $response->getHeaders(),
  48523.                         $response->getBody()
  48524.                     );
  48525.                 }
  48526.             );
  48527.     }
  48528.     /**
  48529.      * Create request for operation 'getReportExecutiveSummary'
  48530.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  48531.      * @param  \DateTime $date The date for the Bank Summary report e.g. 2018-03-31 (optional)
  48532.      * @throws \InvalidArgumentException
  48533.      * @return \GuzzleHttp\Psr7\Request  */
  48534.     protected function getReportExecutiveSummaryRequest($xero_tenant_id$date null)
  48535.     {
  48536.         // verify the required parameter 'xero_tenant_id' is set
  48537.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  48538.             throw new \InvalidArgumentException(
  48539.                 'Missing the required parameter $xero_tenant_id when calling getReportExecutiveSummary'
  48540.             );
  48541.         }
  48542.         $resourcePath '/Reports/ExecutiveSummary';
  48543.         $formParams = [];
  48544.         $queryParams = [];
  48545.         $headerParams = [];
  48546.         $httpBody '';
  48547.         $multipart false;
  48548.         // query params
  48549.         if ($date !== null) {
  48550.             $queryParams['date'] = AccountingObjectSerializer::toQueryValue($date);
  48551.         }
  48552.         // header params
  48553.         if ($xero_tenant_id !== null) {
  48554.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  48555.         }
  48556.         // body params
  48557.         $_tempBody null;
  48558.         if ($multipart) {
  48559.             $headers $this->headerSelector->selectHeadersForMultipart(
  48560.                 ['application/json']
  48561.             );
  48562.         } else {
  48563.             $headers $this->headerSelector->selectHeaders(
  48564.                 ['application/json'],
  48565.                 []
  48566.             );
  48567.         }
  48568.         // for model (json/xml)
  48569.         if (isset($_tempBody)) {
  48570.             // $_tempBody is the method argument, if present
  48571.             if ($headers['Content-Type'] === 'application/json') {
  48572.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  48573.             } else {
  48574.                 $httpBody $_tempBody;
  48575.             }
  48576.         } elseif (count($formParams) > 0) {
  48577.             if ($multipart) {
  48578.                 $multipartContents = [
  48579.                     [
  48580.                         'Content-type' => 'multipart/form-data',
  48581.                     ]
  48582.                 ];
  48583.                 
  48584.                 // for HTTP post (form)
  48585.                 $httpBody = new MultipartStream($multipartContents);
  48586.             } elseif ($headers['Content-Type'] === 'application/json') {
  48587.                 $httpBody \GuzzleHttp\json_encode($formParams);
  48588.             } else {
  48589.                 // for HTTP post (form)
  48590.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  48591.             }
  48592.         }
  48593.         // this endpoint requires OAuth (access token)
  48594.         if ($this->config->getAccessToken() !== null) {
  48595.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  48596.         }
  48597.         $defaultHeaders = [];
  48598.         if ($this->config->getUserAgent()) {
  48599.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  48600.         }
  48601.         $headers array_merge(
  48602.             $defaultHeaders,
  48603.             $headerParams,
  48604.             $headers
  48605.         );
  48606.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  48607.         return new Request(
  48608.             'GET',
  48609.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  48610.             $headers,
  48611.             $httpBody
  48612.         );
  48613.     }
  48614.     /**
  48615.      * Operation getReportFromId
  48616.      * Retrieves a specific report using a unique ReportID
  48617.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  48618.      * @param  string $report_id Unique identifier for a Report (required)
  48619.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  48620.      * @throws \InvalidArgumentException
  48621.      * @return \XeroAPI\XeroPHP\Models\Accounting\ReportWithRows
  48622.      */
  48623.     public function getReportFromId($xero_tenant_id$report_id)
  48624.     {
  48625.         list($response) = $this->getReportFromIdWithHttpInfo($xero_tenant_id$report_id);
  48626.         return $response;
  48627.     }
  48628.     /**
  48629.      * Operation getReportFromIdWithHttpInfo
  48630.      * Retrieves a specific report using a unique ReportID
  48631.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  48632.      * @param  string $report_id Unique identifier for a Report (required)
  48633.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  48634.      * @throws \InvalidArgumentException
  48635.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\ReportWithRows, HTTP status code, HTTP response headers (array of strings)
  48636.      */
  48637.     public function getReportFromIdWithHttpInfo($xero_tenant_id$report_id)
  48638.     {
  48639.         $request $this->getReportFromIdRequest($xero_tenant_id$report_id);
  48640.         try {
  48641.             $options $this->createHttpClientOption();
  48642.             try {
  48643.                 $response $this->client->send($request$options);
  48644.             } catch (RequestException $e) {
  48645.                 throw new ApiException(
  48646.                     "[{$e->getCode()}{$e->getMessage()}",
  48647.                     $e->getCode(),
  48648.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  48649.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  48650.                 );
  48651.             }
  48652.             $statusCode $response->getStatusCode();
  48653.             if ($statusCode 200 || $statusCode 299) {
  48654.                 throw new ApiException(
  48655.                     sprintf(
  48656.                         '[%d] Error connecting to the API (%s)',
  48657.                         $statusCode,
  48658.                         $request->getUri()
  48659.                     ),
  48660.                     $statusCode,
  48661.                     $response->getHeaders(),
  48662.                     $response->getBody()
  48663.                 );
  48664.             }
  48665.             $responseBody $response->getBody();
  48666.             switch($statusCode) {
  48667.                 case 200:
  48668.                     if ('\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows' === '\SplFileObject') {
  48669.                         $content $responseBody//stream goes to serializer
  48670.                     } else {
  48671.                         $content $responseBody->getContents();
  48672.                     }
  48673.                     return [
  48674.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows', []),
  48675.                         $response->getStatusCode(),
  48676.                         $response->getHeaders()
  48677.                     ];
  48678.             }
  48679.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows';
  48680.             $responseBody $response->getBody();
  48681.             if ($returnType === '\SplFileObject') {
  48682.                 $content $responseBody//stream goes to serializer
  48683.             } else {
  48684.                 $content $responseBody->getContents();
  48685.             }
  48686.             return [
  48687.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  48688.                 $response->getStatusCode(),
  48689.                 $response->getHeaders()
  48690.             ];
  48691.         } catch (ApiException $e) {
  48692.             switch ($e->getCode()) {
  48693.                 case 200:
  48694.                     $data AccountingObjectSerializer::deserialize(
  48695.                         $e->getResponseBody(),
  48696.                         '\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows',
  48697.                         $e->getResponseHeaders()
  48698.                     );
  48699.                     $e->setResponseObject($data);
  48700.                     break;
  48701.             }
  48702.             throw $e;
  48703.         }
  48704.     }
  48705.     /**
  48706.      * Operation getReportFromIdAsync
  48707.      * Retrieves a specific report using a unique ReportID
  48708.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  48709.      * @param  string $report_id Unique identifier for a Report (required)
  48710.      * @throws \InvalidArgumentException
  48711.      * @return \GuzzleHttp\Promise\PromiseInterface
  48712.      */
  48713.     public function getReportFromIdAsync($xero_tenant_id$report_id)
  48714.     {
  48715.         return $this->getReportFromIdAsyncWithHttpInfo($xero_tenant_id$report_id)
  48716.             ->then(
  48717.                 function ($response) {
  48718.                     return $response[0];
  48719.                 }
  48720.             );
  48721.     }
  48722.     /**
  48723.      * Operation getReportFromIdAsyncWithHttpInfo
  48724.      * Retrieves a specific report using a unique ReportID
  48725.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  48726.      * @param  string $report_id Unique identifier for a Report (required)
  48727.      * @throws \InvalidArgumentException
  48728.      * @return \GuzzleHttp\Promise\PromiseInterface */
  48729.     public function getReportFromIdAsyncWithHttpInfo($xero_tenant_id$report_id)
  48730.     {
  48731.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows';
  48732.         $request $this->getReportFromIdRequest($xero_tenant_id$report_id);
  48733.         return $this->client
  48734.             ->sendAsync($request$this->createHttpClientOption())
  48735.             ->then(
  48736.                 function ($response) use ($returnType) {
  48737.                     $responseBody $response->getBody();
  48738.                     if ($returnType === '\SplFileObject') {
  48739.                         $content $responseBody//stream goes to serializer
  48740.                     } else {
  48741.                         $content $responseBody->getContents();
  48742.                     }
  48743.                     return [
  48744.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  48745.                         $response->getStatusCode(),
  48746.                         $response->getHeaders()
  48747.                     ];
  48748.                 },
  48749.                 function ($exception) {
  48750.                     $response $exception->getResponse();
  48751.                     $statusCode $response->getStatusCode();
  48752.                     throw new ApiException(
  48753.                         sprintf(
  48754.                             '[%d] Error connecting to the API (%s)',
  48755.                             $statusCode,
  48756.                             $exception->getRequest()->getUri()
  48757.                         ),
  48758.                         $statusCode,
  48759.                         $response->getHeaders(),
  48760.                         $response->getBody()
  48761.                     );
  48762.                 }
  48763.             );
  48764.     }
  48765.     /**
  48766.      * Create request for operation 'getReportFromId'
  48767.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  48768.      * @param  string $report_id Unique identifier for a Report (required)
  48769.      * @throws \InvalidArgumentException
  48770.      * @return \GuzzleHttp\Psr7\Request  */
  48771.     protected function getReportFromIdRequest($xero_tenant_id$report_id)
  48772.     {
  48773.         // verify the required parameter 'xero_tenant_id' is set
  48774.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  48775.             throw new \InvalidArgumentException(
  48776.                 'Missing the required parameter $xero_tenant_id when calling getReportFromId'
  48777.             );
  48778.         }
  48779.         // verify the required parameter 'report_id' is set
  48780.         if ($report_id === null || (is_array($report_id) && count($report_id) === 0)) {
  48781.             throw new \InvalidArgumentException(
  48782.                 'Missing the required parameter $report_id when calling getReportFromId'
  48783.             );
  48784.         }
  48785.         $resourcePath '/Reports/{ReportID}';
  48786.         $formParams = [];
  48787.         $queryParams = [];
  48788.         $headerParams = [];
  48789.         $httpBody '';
  48790.         $multipart false;
  48791.         // header params
  48792.         if ($xero_tenant_id !== null) {
  48793.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  48794.         }
  48795.         // path params
  48796.         if ($report_id !== null) {
  48797.             $resourcePath str_replace(
  48798.                 '{' 'ReportID' '}',
  48799.                 AccountingObjectSerializer::toPathValue($report_id),
  48800.                 $resourcePath
  48801.             );
  48802.         }
  48803.         // body params
  48804.         $_tempBody null;
  48805.         if ($multipart) {
  48806.             $headers $this->headerSelector->selectHeadersForMultipart(
  48807.                 ['application/json']
  48808.             );
  48809.         } else {
  48810.             $headers $this->headerSelector->selectHeaders(
  48811.                 ['application/json'],
  48812.                 []
  48813.             );
  48814.         }
  48815.         // for model (json/xml)
  48816.         if (isset($_tempBody)) {
  48817.             // $_tempBody is the method argument, if present
  48818.             if ($headers['Content-Type'] === 'application/json') {
  48819.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  48820.             } else {
  48821.                 $httpBody $_tempBody;
  48822.             }
  48823.         } elseif (count($formParams) > 0) {
  48824.             if ($multipart) {
  48825.                 $multipartContents = [
  48826.                     [
  48827.                         'Content-type' => 'multipart/form-data',
  48828.                     ]
  48829.                 ];
  48830.                 
  48831.                 // for HTTP post (form)
  48832.                 $httpBody = new MultipartStream($multipartContents);
  48833.             } elseif ($headers['Content-Type'] === 'application/json') {
  48834.                 $httpBody \GuzzleHttp\json_encode($formParams);
  48835.             } else {
  48836.                 // for HTTP post (form)
  48837.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  48838.             }
  48839.         }
  48840.         // this endpoint requires OAuth (access token)
  48841.         if ($this->config->getAccessToken() !== null) {
  48842.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  48843.         }
  48844.         $defaultHeaders = [];
  48845.         if ($this->config->getUserAgent()) {
  48846.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  48847.         }
  48848.         $headers array_merge(
  48849.             $defaultHeaders,
  48850.             $headerParams,
  48851.             $headers
  48852.         );
  48853.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  48854.         return new Request(
  48855.             'GET',
  48856.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  48857.             $headers,
  48858.             $httpBody
  48859.         );
  48860.     }
  48861.     /**
  48862.      * Operation getReportProfitAndLoss
  48863.      * Retrieves report for profit and loss
  48864.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  48865.      * @param  \DateTime $from_date filter by the from date of the report e.g. 2021-02-01 (optional)
  48866.      * @param  \DateTime $to_date filter by the to date of the report e.g. 2021-02-28 (optional)
  48867.      * @param  int $periods The number of periods to compare (integer between 1 and 12) (optional)
  48868.      * @param  string $timeframe The period size to compare to (MONTH, QUARTER, YEAR) (optional)
  48869.      * @param  string $tracking_category_id The trackingCategory 1 for the ProfitAndLoss report (optional)
  48870.      * @param  string $tracking_category_id2 The trackingCategory 2 for the ProfitAndLoss report (optional)
  48871.      * @param  string $tracking_option_id The tracking option 1 for the ProfitAndLoss report (optional)
  48872.      * @param  string $tracking_option_id2 The tracking option 2 for the ProfitAndLoss report (optional)
  48873.      * @param  bool $standard_layout Return the standard layout for the ProfitAndLoss report (optional)
  48874.      * @param  bool $payments_only Return cash only basis for the ProfitAndLoss report (optional)
  48875.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  48876.      * @throws \InvalidArgumentException
  48877.      * @return \XeroAPI\XeroPHP\Models\Accounting\ReportWithRows
  48878.      */
  48879.     public function getReportProfitAndLoss($xero_tenant_id$from_date null$to_date null$periods null$timeframe null$tracking_category_id null$tracking_category_id2 null$tracking_option_id null$tracking_option_id2 null$standard_layout null$payments_only null)
  48880.     {
  48881.         list($response) = $this->getReportProfitAndLossWithHttpInfo($xero_tenant_id$from_date$to_date$periods$timeframe$tracking_category_id$tracking_category_id2$tracking_option_id$tracking_option_id2$standard_layout$payments_only);
  48882.         return $response;
  48883.     }
  48884.     /**
  48885.      * Operation getReportProfitAndLossWithHttpInfo
  48886.      * Retrieves report for profit and loss
  48887.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  48888.      * @param  \DateTime $from_date filter by the from date of the report e.g. 2021-02-01 (optional)
  48889.      * @param  \DateTime $to_date filter by the to date of the report e.g. 2021-02-28 (optional)
  48890.      * @param  int $periods The number of periods to compare (integer between 1 and 12) (optional)
  48891.      * @param  string $timeframe The period size to compare to (MONTH, QUARTER, YEAR) (optional)
  48892.      * @param  string $tracking_category_id The trackingCategory 1 for the ProfitAndLoss report (optional)
  48893.      * @param  string $tracking_category_id2 The trackingCategory 2 for the ProfitAndLoss report (optional)
  48894.      * @param  string $tracking_option_id The tracking option 1 for the ProfitAndLoss report (optional)
  48895.      * @param  string $tracking_option_id2 The tracking option 2 for the ProfitAndLoss report (optional)
  48896.      * @param  bool $standard_layout Return the standard layout for the ProfitAndLoss report (optional)
  48897.      * @param  bool $payments_only Return cash only basis for the ProfitAndLoss report (optional)
  48898.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  48899.      * @throws \InvalidArgumentException
  48900.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\ReportWithRows, HTTP status code, HTTP response headers (array of strings)
  48901.      */
  48902.     public function getReportProfitAndLossWithHttpInfo($xero_tenant_id$from_date null$to_date null$periods null$timeframe null$tracking_category_id null$tracking_category_id2 null$tracking_option_id null$tracking_option_id2 null$standard_layout null$payments_only null)
  48903.     {
  48904.         $request $this->getReportProfitAndLossRequest($xero_tenant_id$from_date$to_date$periods$timeframe$tracking_category_id$tracking_category_id2$tracking_option_id$tracking_option_id2$standard_layout$payments_only);
  48905.         try {
  48906.             $options $this->createHttpClientOption();
  48907.             try {
  48908.                 $response $this->client->send($request$options);
  48909.             } catch (RequestException $e) {
  48910.                 throw new ApiException(
  48911.                     "[{$e->getCode()}{$e->getMessage()}",
  48912.                     $e->getCode(),
  48913.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  48914.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  48915.                 );
  48916.             }
  48917.             $statusCode $response->getStatusCode();
  48918.             if ($statusCode 200 || $statusCode 299) {
  48919.                 throw new ApiException(
  48920.                     sprintf(
  48921.                         '[%d] Error connecting to the API (%s)',
  48922.                         $statusCode,
  48923.                         $request->getUri()
  48924.                     ),
  48925.                     $statusCode,
  48926.                     $response->getHeaders(),
  48927.                     $response->getBody()
  48928.                 );
  48929.             }
  48930.             $responseBody $response->getBody();
  48931.             switch($statusCode) {
  48932.                 case 200:
  48933.                     if ('\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows' === '\SplFileObject') {
  48934.                         $content $responseBody//stream goes to serializer
  48935.                     } else {
  48936.                         $content $responseBody->getContents();
  48937.                     }
  48938.                     return [
  48939.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows', []),
  48940.                         $response->getStatusCode(),
  48941.                         $response->getHeaders()
  48942.                     ];
  48943.             }
  48944.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows';
  48945.             $responseBody $response->getBody();
  48946.             if ($returnType === '\SplFileObject') {
  48947.                 $content $responseBody//stream goes to serializer
  48948.             } else {
  48949.                 $content $responseBody->getContents();
  48950.             }
  48951.             return [
  48952.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  48953.                 $response->getStatusCode(),
  48954.                 $response->getHeaders()
  48955.             ];
  48956.         } catch (ApiException $e) {
  48957.             switch ($e->getCode()) {
  48958.                 case 200:
  48959.                     $data AccountingObjectSerializer::deserialize(
  48960.                         $e->getResponseBody(),
  48961.                         '\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows',
  48962.                         $e->getResponseHeaders()
  48963.                     );
  48964.                     $e->setResponseObject($data);
  48965.                     break;
  48966.             }
  48967.             throw $e;
  48968.         }
  48969.     }
  48970.     /**
  48971.      * Operation getReportProfitAndLossAsync
  48972.      * Retrieves report for profit and loss
  48973.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  48974.      * @param  \DateTime $from_date filter by the from date of the report e.g. 2021-02-01 (optional)
  48975.      * @param  \DateTime $to_date filter by the to date of the report e.g. 2021-02-28 (optional)
  48976.      * @param  int $periods The number of periods to compare (integer between 1 and 12) (optional)
  48977.      * @param  string $timeframe The period size to compare to (MONTH, QUARTER, YEAR) (optional)
  48978.      * @param  string $tracking_category_id The trackingCategory 1 for the ProfitAndLoss report (optional)
  48979.      * @param  string $tracking_category_id2 The trackingCategory 2 for the ProfitAndLoss report (optional)
  48980.      * @param  string $tracking_option_id The tracking option 1 for the ProfitAndLoss report (optional)
  48981.      * @param  string $tracking_option_id2 The tracking option 2 for the ProfitAndLoss report (optional)
  48982.      * @param  bool $standard_layout Return the standard layout for the ProfitAndLoss report (optional)
  48983.      * @param  bool $payments_only Return cash only basis for the ProfitAndLoss report (optional)
  48984.      * @throws \InvalidArgumentException
  48985.      * @return \GuzzleHttp\Promise\PromiseInterface
  48986.      */
  48987.     public function getReportProfitAndLossAsync($xero_tenant_id$from_date null$to_date null$periods null$timeframe null$tracking_category_id null$tracking_category_id2 null$tracking_option_id null$tracking_option_id2 null$standard_layout null$payments_only null)
  48988.     {
  48989.         return $this->getReportProfitAndLossAsyncWithHttpInfo($xero_tenant_id$from_date$to_date$periods$timeframe$tracking_category_id$tracking_category_id2$tracking_option_id$tracking_option_id2$standard_layout$payments_only)
  48990.             ->then(
  48991.                 function ($response) {
  48992.                     return $response[0];
  48993.                 }
  48994.             );
  48995.     }
  48996.     /**
  48997.      * Operation getReportProfitAndLossAsyncWithHttpInfo
  48998.      * Retrieves report for profit and loss
  48999.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  49000.      * @param  \DateTime $from_date filter by the from date of the report e.g. 2021-02-01 (optional)
  49001.      * @param  \DateTime $to_date filter by the to date of the report e.g. 2021-02-28 (optional)
  49002.      * @param  int $periods The number of periods to compare (integer between 1 and 12) (optional)
  49003.      * @param  string $timeframe The period size to compare to (MONTH, QUARTER, YEAR) (optional)
  49004.      * @param  string $tracking_category_id The trackingCategory 1 for the ProfitAndLoss report (optional)
  49005.      * @param  string $tracking_category_id2 The trackingCategory 2 for the ProfitAndLoss report (optional)
  49006.      * @param  string $tracking_option_id The tracking option 1 for the ProfitAndLoss report (optional)
  49007.      * @param  string $tracking_option_id2 The tracking option 2 for the ProfitAndLoss report (optional)
  49008.      * @param  bool $standard_layout Return the standard layout for the ProfitAndLoss report (optional)
  49009.      * @param  bool $payments_only Return cash only basis for the ProfitAndLoss report (optional)
  49010.      * @throws \InvalidArgumentException
  49011.      * @return \GuzzleHttp\Promise\PromiseInterface */
  49012.     public function getReportProfitAndLossAsyncWithHttpInfo($xero_tenant_id$from_date null$to_date null$periods null$timeframe null$tracking_category_id null$tracking_category_id2 null$tracking_option_id null$tracking_option_id2 null$standard_layout null$payments_only null)
  49013.     {
  49014.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows';
  49015.         $request $this->getReportProfitAndLossRequest($xero_tenant_id$from_date$to_date$periods$timeframe$tracking_category_id$tracking_category_id2$tracking_option_id$tracking_option_id2$standard_layout$payments_only);
  49016.         return $this->client
  49017.             ->sendAsync($request$this->createHttpClientOption())
  49018.             ->then(
  49019.                 function ($response) use ($returnType) {
  49020.                     $responseBody $response->getBody();
  49021.                     if ($returnType === '\SplFileObject') {
  49022.                         $content $responseBody//stream goes to serializer
  49023.                     } else {
  49024.                         $content $responseBody->getContents();
  49025.                     }
  49026.                     return [
  49027.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  49028.                         $response->getStatusCode(),
  49029.                         $response->getHeaders()
  49030.                     ];
  49031.                 },
  49032.                 function ($exception) {
  49033.                     $response $exception->getResponse();
  49034.                     $statusCode $response->getStatusCode();
  49035.                     throw new ApiException(
  49036.                         sprintf(
  49037.                             '[%d] Error connecting to the API (%s)',
  49038.                             $statusCode,
  49039.                             $exception->getRequest()->getUri()
  49040.                         ),
  49041.                         $statusCode,
  49042.                         $response->getHeaders(),
  49043.                         $response->getBody()
  49044.                     );
  49045.                 }
  49046.             );
  49047.     }
  49048.     /**
  49049.      * Create request for operation 'getReportProfitAndLoss'
  49050.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  49051.      * @param  \DateTime $from_date filter by the from date of the report e.g. 2021-02-01 (optional)
  49052.      * @param  \DateTime $to_date filter by the to date of the report e.g. 2021-02-28 (optional)
  49053.      * @param  int $periods The number of periods to compare (integer between 1 and 12) (optional)
  49054.      * @param  string $timeframe The period size to compare to (MONTH, QUARTER, YEAR) (optional)
  49055.      * @param  string $tracking_category_id The trackingCategory 1 for the ProfitAndLoss report (optional)
  49056.      * @param  string $tracking_category_id2 The trackingCategory 2 for the ProfitAndLoss report (optional)
  49057.      * @param  string $tracking_option_id The tracking option 1 for the ProfitAndLoss report (optional)
  49058.      * @param  string $tracking_option_id2 The tracking option 2 for the ProfitAndLoss report (optional)
  49059.      * @param  bool $standard_layout Return the standard layout for the ProfitAndLoss report (optional)
  49060.      * @param  bool $payments_only Return cash only basis for the ProfitAndLoss report (optional)
  49061.      * @throws \InvalidArgumentException
  49062.      * @return \GuzzleHttp\Psr7\Request  */
  49063.     protected function getReportProfitAndLossRequest($xero_tenant_id$from_date null$to_date null$periods null$timeframe null$tracking_category_id null$tracking_category_id2 null$tracking_option_id null$tracking_option_id2 null$standard_layout null$payments_only null)
  49064.     {
  49065.         // verify the required parameter 'xero_tenant_id' is set
  49066.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  49067.             throw new \InvalidArgumentException(
  49068.                 'Missing the required parameter $xero_tenant_id when calling getReportProfitAndLoss'
  49069.             );
  49070.         }
  49071.         $resourcePath '/Reports/ProfitAndLoss';
  49072.         $formParams = [];
  49073.         $queryParams = [];
  49074.         $headerParams = [];
  49075.         $httpBody '';
  49076.         $multipart false;
  49077.         // query params
  49078.         if ($from_date !== null) {
  49079.             $queryParams['fromDate'] = AccountingObjectSerializer::toQueryValue($from_date);
  49080.         }
  49081.         // query params
  49082.         if ($to_date !== null) {
  49083.             $queryParams['toDate'] = AccountingObjectSerializer::toQueryValue($to_date);
  49084.         }
  49085.         // query params
  49086.         if ($periods !== null) {
  49087.             $queryParams['periods'] = AccountingObjectSerializer::toQueryValue($periods);
  49088.         }
  49089.         // query params
  49090.         if ($timeframe !== null) {
  49091.             $queryParams['timeframe'] = AccountingObjectSerializer::toQueryValue($timeframe);
  49092.         }
  49093.         // query params
  49094.         if ($tracking_category_id !== null) {
  49095.             $queryParams['trackingCategoryID'] = AccountingObjectSerializer::toQueryValue($tracking_category_id);
  49096.         }
  49097.         // query params
  49098.         if ($tracking_category_id2 !== null) {
  49099.             $queryParams['trackingCategoryID2'] = AccountingObjectSerializer::toQueryValue($tracking_category_id2);
  49100.         }
  49101.         // query params
  49102.         if ($tracking_option_id !== null) {
  49103.             $queryParams['trackingOptionID'] = AccountingObjectSerializer::toQueryValue($tracking_option_id);
  49104.         }
  49105.         // query params
  49106.         if ($tracking_option_id2 !== null) {
  49107.             $queryParams['trackingOptionID2'] = AccountingObjectSerializer::toQueryValue($tracking_option_id2);
  49108.         }
  49109.         // query params
  49110.         if ($standard_layout !== null) {
  49111.             $queryParams['standardLayout'] = $standard_layout 'true' 'false';
  49112.         }
  49113.         // query params
  49114.         if ($payments_only !== null) {
  49115.             $queryParams['paymentsOnly'] = $payments_only 'true' 'false';
  49116.         }
  49117.         // header params
  49118.         if ($xero_tenant_id !== null) {
  49119.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  49120.         }
  49121.         // body params
  49122.         $_tempBody null;
  49123.         if ($multipart) {
  49124.             $headers $this->headerSelector->selectHeadersForMultipart(
  49125.                 ['application/json']
  49126.             );
  49127.         } else {
  49128.             $headers $this->headerSelector->selectHeaders(
  49129.                 ['application/json'],
  49130.                 []
  49131.             );
  49132.         }
  49133.         // for model (json/xml)
  49134.         if (isset($_tempBody)) {
  49135.             // $_tempBody is the method argument, if present
  49136.             if ($headers['Content-Type'] === 'application/json') {
  49137.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  49138.             } else {
  49139.                 $httpBody $_tempBody;
  49140.             }
  49141.         } elseif (count($formParams) > 0) {
  49142.             if ($multipart) {
  49143.                 $multipartContents = [
  49144.                     [
  49145.                         'Content-type' => 'multipart/form-data',
  49146.                     ]
  49147.                 ];
  49148.                 
  49149.                 // for HTTP post (form)
  49150.                 $httpBody = new MultipartStream($multipartContents);
  49151.             } elseif ($headers['Content-Type'] === 'application/json') {
  49152.                 $httpBody \GuzzleHttp\json_encode($formParams);
  49153.             } else {
  49154.                 // for HTTP post (form)
  49155.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  49156.             }
  49157.         }
  49158.         // this endpoint requires OAuth (access token)
  49159.         if ($this->config->getAccessToken() !== null) {
  49160.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  49161.         }
  49162.         $defaultHeaders = [];
  49163.         if ($this->config->getUserAgent()) {
  49164.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  49165.         }
  49166.         $headers array_merge(
  49167.             $defaultHeaders,
  49168.             $headerParams,
  49169.             $headers
  49170.         );
  49171.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  49172.         return new Request(
  49173.             'GET',
  49174.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  49175.             $headers,
  49176.             $httpBody
  49177.         );
  49178.     }
  49179.     /**
  49180.      * Operation getReportTenNinetyNine
  49181.      * Retrieve reports for 1099
  49182.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  49183.      * @param  string $report_year The year of the 1099 report (optional)
  49184.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  49185.      * @throws \InvalidArgumentException
  49186.      * @return \XeroAPI\XeroPHP\Models\Accounting\Reports
  49187.      */
  49188.     public function getReportTenNinetyNine($xero_tenant_id$report_year null)
  49189.     {
  49190.         list($response) = $this->getReportTenNinetyNineWithHttpInfo($xero_tenant_id$report_year);
  49191.         return $response;
  49192.     }
  49193.     /**
  49194.      * Operation getReportTenNinetyNineWithHttpInfo
  49195.      * Retrieve reports for 1099
  49196.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  49197.      * @param  string $report_year The year of the 1099 report (optional)
  49198.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  49199.      * @throws \InvalidArgumentException
  49200.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Reports, HTTP status code, HTTP response headers (array of strings)
  49201.      */
  49202.     public function getReportTenNinetyNineWithHttpInfo($xero_tenant_id$report_year null)
  49203.     {
  49204.         $request $this->getReportTenNinetyNineRequest($xero_tenant_id$report_year);
  49205.         try {
  49206.             $options $this->createHttpClientOption();
  49207.             try {
  49208.                 $response $this->client->send($request$options);
  49209.             } catch (RequestException $e) {
  49210.                 throw new ApiException(
  49211.                     "[{$e->getCode()}{$e->getMessage()}",
  49212.                     $e->getCode(),
  49213.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  49214.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  49215.                 );
  49216.             }
  49217.             $statusCode $response->getStatusCode();
  49218.             if ($statusCode 200 || $statusCode 299) {
  49219.                 throw new ApiException(
  49220.                     sprintf(
  49221.                         '[%d] Error connecting to the API (%s)',
  49222.                         $statusCode,
  49223.                         $request->getUri()
  49224.                     ),
  49225.                     $statusCode,
  49226.                     $response->getHeaders(),
  49227.                     $response->getBody()
  49228.                 );
  49229.             }
  49230.             $responseBody $response->getBody();
  49231.             switch($statusCode) {
  49232.                 case 200:
  49233.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Reports' === '\SplFileObject') {
  49234.                         $content $responseBody//stream goes to serializer
  49235.                     } else {
  49236.                         $content $responseBody->getContents();
  49237.                     }
  49238.                     return [
  49239.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Reports', []),
  49240.                         $response->getStatusCode(),
  49241.                         $response->getHeaders()
  49242.                     ];
  49243.             }
  49244.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Reports';
  49245.             $responseBody $response->getBody();
  49246.             if ($returnType === '\SplFileObject') {
  49247.                 $content $responseBody//stream goes to serializer
  49248.             } else {
  49249.                 $content $responseBody->getContents();
  49250.             }
  49251.             return [
  49252.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  49253.                 $response->getStatusCode(),
  49254.                 $response->getHeaders()
  49255.             ];
  49256.         } catch (ApiException $e) {
  49257.             switch ($e->getCode()) {
  49258.                 case 200:
  49259.                     $data AccountingObjectSerializer::deserialize(
  49260.                         $e->getResponseBody(),
  49261.                         '\XeroAPI\XeroPHP\Models\Accounting\Reports',
  49262.                         $e->getResponseHeaders()
  49263.                     );
  49264.                     $e->setResponseObject($data);
  49265.                     break;
  49266.             }
  49267.             throw $e;
  49268.         }
  49269.     }
  49270.     /**
  49271.      * Operation getReportTenNinetyNineAsync
  49272.      * Retrieve reports for 1099
  49273.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  49274.      * @param  string $report_year The year of the 1099 report (optional)
  49275.      * @throws \InvalidArgumentException
  49276.      * @return \GuzzleHttp\Promise\PromiseInterface
  49277.      */
  49278.     public function getReportTenNinetyNineAsync($xero_tenant_id$report_year null)
  49279.     {
  49280.         return $this->getReportTenNinetyNineAsyncWithHttpInfo($xero_tenant_id$report_year)
  49281.             ->then(
  49282.                 function ($response) {
  49283.                     return $response[0];
  49284.                 }
  49285.             );
  49286.     }
  49287.     /**
  49288.      * Operation getReportTenNinetyNineAsyncWithHttpInfo
  49289.      * Retrieve reports for 1099
  49290.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  49291.      * @param  string $report_year The year of the 1099 report (optional)
  49292.      * @throws \InvalidArgumentException
  49293.      * @return \GuzzleHttp\Promise\PromiseInterface */
  49294.     public function getReportTenNinetyNineAsyncWithHttpInfo($xero_tenant_id$report_year null)
  49295.     {
  49296.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Reports';
  49297.         $request $this->getReportTenNinetyNineRequest($xero_tenant_id$report_year);
  49298.         return $this->client
  49299.             ->sendAsync($request$this->createHttpClientOption())
  49300.             ->then(
  49301.                 function ($response) use ($returnType) {
  49302.                     $responseBody $response->getBody();
  49303.                     if ($returnType === '\SplFileObject') {
  49304.                         $content $responseBody//stream goes to serializer
  49305.                     } else {
  49306.                         $content $responseBody->getContents();
  49307.                     }
  49308.                     return [
  49309.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  49310.                         $response->getStatusCode(),
  49311.                         $response->getHeaders()
  49312.                     ];
  49313.                 },
  49314.                 function ($exception) {
  49315.                     $response $exception->getResponse();
  49316.                     $statusCode $response->getStatusCode();
  49317.                     throw new ApiException(
  49318.                         sprintf(
  49319.                             '[%d] Error connecting to the API (%s)',
  49320.                             $statusCode,
  49321.                             $exception->getRequest()->getUri()
  49322.                         ),
  49323.                         $statusCode,
  49324.                         $response->getHeaders(),
  49325.                         $response->getBody()
  49326.                     );
  49327.                 }
  49328.             );
  49329.     }
  49330.     /**
  49331.      * Create request for operation 'getReportTenNinetyNine'
  49332.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  49333.      * @param  string $report_year The year of the 1099 report (optional)
  49334.      * @throws \InvalidArgumentException
  49335.      * @return \GuzzleHttp\Psr7\Request  */
  49336.     protected function getReportTenNinetyNineRequest($xero_tenant_id$report_year null)
  49337.     {
  49338.         // verify the required parameter 'xero_tenant_id' is set
  49339.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  49340.             throw new \InvalidArgumentException(
  49341.                 'Missing the required parameter $xero_tenant_id when calling getReportTenNinetyNine'
  49342.             );
  49343.         }
  49344.         $resourcePath '/Reports/TenNinetyNine';
  49345.         $formParams = [];
  49346.         $queryParams = [];
  49347.         $headerParams = [];
  49348.         $httpBody '';
  49349.         $multipart false;
  49350.         // query params
  49351.         if ($report_year !== null) {
  49352.             $queryParams['reportYear'] = AccountingObjectSerializer::toQueryValue($report_year);
  49353.         }
  49354.         // header params
  49355.         if ($xero_tenant_id !== null) {
  49356.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  49357.         }
  49358.         // body params
  49359.         $_tempBody null;
  49360.         if ($multipart) {
  49361.             $headers $this->headerSelector->selectHeadersForMultipart(
  49362.                 ['application/json']
  49363.             );
  49364.         } else {
  49365.             $headers $this->headerSelector->selectHeaders(
  49366.                 ['application/json'],
  49367.                 []
  49368.             );
  49369.         }
  49370.         // for model (json/xml)
  49371.         if (isset($_tempBody)) {
  49372.             // $_tempBody is the method argument, if present
  49373.             if ($headers['Content-Type'] === 'application/json') {
  49374.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  49375.             } else {
  49376.                 $httpBody $_tempBody;
  49377.             }
  49378.         } elseif (count($formParams) > 0) {
  49379.             if ($multipart) {
  49380.                 $multipartContents = [
  49381.                     [
  49382.                         'Content-type' => 'multipart/form-data',
  49383.                     ]
  49384.                 ];
  49385.                 
  49386.                 // for HTTP post (form)
  49387.                 $httpBody = new MultipartStream($multipartContents);
  49388.             } elseif ($headers['Content-Type'] === 'application/json') {
  49389.                 $httpBody \GuzzleHttp\json_encode($formParams);
  49390.             } else {
  49391.                 // for HTTP post (form)
  49392.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  49393.             }
  49394.         }
  49395.         // this endpoint requires OAuth (access token)
  49396.         if ($this->config->getAccessToken() !== null) {
  49397.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  49398.         }
  49399.         $defaultHeaders = [];
  49400.         if ($this->config->getUserAgent()) {
  49401.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  49402.         }
  49403.         $headers array_merge(
  49404.             $defaultHeaders,
  49405.             $headerParams,
  49406.             $headers
  49407.         );
  49408.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  49409.         return new Request(
  49410.             'GET',
  49411.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  49412.             $headers,
  49413.             $httpBody
  49414.         );
  49415.     }
  49416.     /**
  49417.      * Operation getReportTrialBalance
  49418.      * Retrieves report for trial balance
  49419.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  49420.      * @param  \DateTime $date The date for the Trial Balance report e.g. 2018-03-31 (optional)
  49421.      * @param  bool $payments_only Return cash only basis for the Trial Balance report (optional)
  49422.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  49423.      * @throws \InvalidArgumentException
  49424.      * @return \XeroAPI\XeroPHP\Models\Accounting\ReportWithRows
  49425.      */
  49426.     public function getReportTrialBalance($xero_tenant_id$date null$payments_only null)
  49427.     {
  49428.         list($response) = $this->getReportTrialBalanceWithHttpInfo($xero_tenant_id$date$payments_only);
  49429.         return $response;
  49430.     }
  49431.     /**
  49432.      * Operation getReportTrialBalanceWithHttpInfo
  49433.      * Retrieves report for trial balance
  49434.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  49435.      * @param  \DateTime $date The date for the Trial Balance report e.g. 2018-03-31 (optional)
  49436.      * @param  bool $payments_only Return cash only basis for the Trial Balance report (optional)
  49437.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  49438.      * @throws \InvalidArgumentException
  49439.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\ReportWithRows, HTTP status code, HTTP response headers (array of strings)
  49440.      */
  49441.     public function getReportTrialBalanceWithHttpInfo($xero_tenant_id$date null$payments_only null)
  49442.     {
  49443.         $request $this->getReportTrialBalanceRequest($xero_tenant_id$date$payments_only);
  49444.         try {
  49445.             $options $this->createHttpClientOption();
  49446.             try {
  49447.                 $response $this->client->send($request$options);
  49448.             } catch (RequestException $e) {
  49449.                 throw new ApiException(
  49450.                     "[{$e->getCode()}{$e->getMessage()}",
  49451.                     $e->getCode(),
  49452.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  49453.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  49454.                 );
  49455.             }
  49456.             $statusCode $response->getStatusCode();
  49457.             if ($statusCode 200 || $statusCode 299) {
  49458.                 throw new ApiException(
  49459.                     sprintf(
  49460.                         '[%d] Error connecting to the API (%s)',
  49461.                         $statusCode,
  49462.                         $request->getUri()
  49463.                     ),
  49464.                     $statusCode,
  49465.                     $response->getHeaders(),
  49466.                     $response->getBody()
  49467.                 );
  49468.             }
  49469.             $responseBody $response->getBody();
  49470.             switch($statusCode) {
  49471.                 case 200:
  49472.                     if ('\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows' === '\SplFileObject') {
  49473.                         $content $responseBody//stream goes to serializer
  49474.                     } else {
  49475.                         $content $responseBody->getContents();
  49476.                     }
  49477.                     return [
  49478.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows', []),
  49479.                         $response->getStatusCode(),
  49480.                         $response->getHeaders()
  49481.                     ];
  49482.             }
  49483.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows';
  49484.             $responseBody $response->getBody();
  49485.             if ($returnType === '\SplFileObject') {
  49486.                 $content $responseBody//stream goes to serializer
  49487.             } else {
  49488.                 $content $responseBody->getContents();
  49489.             }
  49490.             return [
  49491.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  49492.                 $response->getStatusCode(),
  49493.                 $response->getHeaders()
  49494.             ];
  49495.         } catch (ApiException $e) {
  49496.             switch ($e->getCode()) {
  49497.                 case 200:
  49498.                     $data AccountingObjectSerializer::deserialize(
  49499.                         $e->getResponseBody(),
  49500.                         '\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows',
  49501.                         $e->getResponseHeaders()
  49502.                     );
  49503.                     $e->setResponseObject($data);
  49504.                     break;
  49505.             }
  49506.             throw $e;
  49507.         }
  49508.     }
  49509.     /**
  49510.      * Operation getReportTrialBalanceAsync
  49511.      * Retrieves report for trial balance
  49512.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  49513.      * @param  \DateTime $date The date for the Trial Balance report e.g. 2018-03-31 (optional)
  49514.      * @param  bool $payments_only Return cash only basis for the Trial Balance report (optional)
  49515.      * @throws \InvalidArgumentException
  49516.      * @return \GuzzleHttp\Promise\PromiseInterface
  49517.      */
  49518.     public function getReportTrialBalanceAsync($xero_tenant_id$date null$payments_only null)
  49519.     {
  49520.         return $this->getReportTrialBalanceAsyncWithHttpInfo($xero_tenant_id$date$payments_only)
  49521.             ->then(
  49522.                 function ($response) {
  49523.                     return $response[0];
  49524.                 }
  49525.             );
  49526.     }
  49527.     /**
  49528.      * Operation getReportTrialBalanceAsyncWithHttpInfo
  49529.      * Retrieves report for trial balance
  49530.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  49531.      * @param  \DateTime $date The date for the Trial Balance report e.g. 2018-03-31 (optional)
  49532.      * @param  bool $payments_only Return cash only basis for the Trial Balance report (optional)
  49533.      * @throws \InvalidArgumentException
  49534.      * @return \GuzzleHttp\Promise\PromiseInterface */
  49535.     public function getReportTrialBalanceAsyncWithHttpInfo($xero_tenant_id$date null$payments_only null)
  49536.     {
  49537.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows';
  49538.         $request $this->getReportTrialBalanceRequest($xero_tenant_id$date$payments_only);
  49539.         return $this->client
  49540.             ->sendAsync($request$this->createHttpClientOption())
  49541.             ->then(
  49542.                 function ($response) use ($returnType) {
  49543.                     $responseBody $response->getBody();
  49544.                     if ($returnType === '\SplFileObject') {
  49545.                         $content $responseBody//stream goes to serializer
  49546.                     } else {
  49547.                         $content $responseBody->getContents();
  49548.                     }
  49549.                     return [
  49550.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  49551.                         $response->getStatusCode(),
  49552.                         $response->getHeaders()
  49553.                     ];
  49554.                 },
  49555.                 function ($exception) {
  49556.                     $response $exception->getResponse();
  49557.                     $statusCode $response->getStatusCode();
  49558.                     throw new ApiException(
  49559.                         sprintf(
  49560.                             '[%d] Error connecting to the API (%s)',
  49561.                             $statusCode,
  49562.                             $exception->getRequest()->getUri()
  49563.                         ),
  49564.                         $statusCode,
  49565.                         $response->getHeaders(),
  49566.                         $response->getBody()
  49567.                     );
  49568.                 }
  49569.             );
  49570.     }
  49571.     /**
  49572.      * Create request for operation 'getReportTrialBalance'
  49573.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  49574.      * @param  \DateTime $date The date for the Trial Balance report e.g. 2018-03-31 (optional)
  49575.      * @param  bool $payments_only Return cash only basis for the Trial Balance report (optional)
  49576.      * @throws \InvalidArgumentException
  49577.      * @return \GuzzleHttp\Psr7\Request  */
  49578.     protected function getReportTrialBalanceRequest($xero_tenant_id$date null$payments_only null)
  49579.     {
  49580.         // verify the required parameter 'xero_tenant_id' is set
  49581.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  49582.             throw new \InvalidArgumentException(
  49583.                 'Missing the required parameter $xero_tenant_id when calling getReportTrialBalance'
  49584.             );
  49585.         }
  49586.         $resourcePath '/Reports/TrialBalance';
  49587.         $formParams = [];
  49588.         $queryParams = [];
  49589.         $headerParams = [];
  49590.         $httpBody '';
  49591.         $multipart false;
  49592.         // query params
  49593.         if ($date !== null) {
  49594.             $queryParams['date'] = AccountingObjectSerializer::toQueryValue($date);
  49595.         }
  49596.         // query params
  49597.         if ($payments_only !== null) {
  49598.             $queryParams['paymentsOnly'] = $payments_only 'true' 'false';
  49599.         }
  49600.         // header params
  49601.         if ($xero_tenant_id !== null) {
  49602.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  49603.         }
  49604.         // body params
  49605.         $_tempBody null;
  49606.         if ($multipart) {
  49607.             $headers $this->headerSelector->selectHeadersForMultipart(
  49608.                 ['application/json']
  49609.             );
  49610.         } else {
  49611.             $headers $this->headerSelector->selectHeaders(
  49612.                 ['application/json'],
  49613.                 []
  49614.             );
  49615.         }
  49616.         // for model (json/xml)
  49617.         if (isset($_tempBody)) {
  49618.             // $_tempBody is the method argument, if present
  49619.             if ($headers['Content-Type'] === 'application/json') {
  49620.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  49621.             } else {
  49622.                 $httpBody $_tempBody;
  49623.             }
  49624.         } elseif (count($formParams) > 0) {
  49625.             if ($multipart) {
  49626.                 $multipartContents = [
  49627.                     [
  49628.                         'Content-type' => 'multipart/form-data',
  49629.                     ]
  49630.                 ];
  49631.                 
  49632.                 // for HTTP post (form)
  49633.                 $httpBody = new MultipartStream($multipartContents);
  49634.             } elseif ($headers['Content-Type'] === 'application/json') {
  49635.                 $httpBody \GuzzleHttp\json_encode($formParams);
  49636.             } else {
  49637.                 // for HTTP post (form)
  49638.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  49639.             }
  49640.         }
  49641.         // this endpoint requires OAuth (access token)
  49642.         if ($this->config->getAccessToken() !== null) {
  49643.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  49644.         }
  49645.         $defaultHeaders = [];
  49646.         if ($this->config->getUserAgent()) {
  49647.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  49648.         }
  49649.         $headers array_merge(
  49650.             $defaultHeaders,
  49651.             $headerParams,
  49652.             $headers
  49653.         );
  49654.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  49655.         return new Request(
  49656.             'GET',
  49657.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  49658.             $headers,
  49659.             $httpBody
  49660.         );
  49661.     }
  49662.     /**
  49663.      * Operation getReportsList
  49664.      * Retrieves a list of the organistaions unique reports that require a uuid to fetch
  49665.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  49666.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  49667.      * @throws \InvalidArgumentException
  49668.      * @return \XeroAPI\XeroPHP\Models\Accounting\ReportWithRows
  49669.      */
  49670.     public function getReportsList($xero_tenant_id)
  49671.     {
  49672.         list($response) = $this->getReportsListWithHttpInfo($xero_tenant_id);
  49673.         return $response;
  49674.     }
  49675.     /**
  49676.      * Operation getReportsListWithHttpInfo
  49677.      * Retrieves a list of the organistaions unique reports that require a uuid to fetch
  49678.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  49679.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  49680.      * @throws \InvalidArgumentException
  49681.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\ReportWithRows, HTTP status code, HTTP response headers (array of strings)
  49682.      */
  49683.     public function getReportsListWithHttpInfo($xero_tenant_id)
  49684.     {
  49685.         $request $this->getReportsListRequest($xero_tenant_id);
  49686.         try {
  49687.             $options $this->createHttpClientOption();
  49688.             try {
  49689.                 $response $this->client->send($request$options);
  49690.             } catch (RequestException $e) {
  49691.                 throw new ApiException(
  49692.                     "[{$e->getCode()}{$e->getMessage()}",
  49693.                     $e->getCode(),
  49694.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  49695.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  49696.                 );
  49697.             }
  49698.             $statusCode $response->getStatusCode();
  49699.             if ($statusCode 200 || $statusCode 299) {
  49700.                 throw new ApiException(
  49701.                     sprintf(
  49702.                         '[%d] Error connecting to the API (%s)',
  49703.                         $statusCode,
  49704.                         $request->getUri()
  49705.                     ),
  49706.                     $statusCode,
  49707.                     $response->getHeaders(),
  49708.                     $response->getBody()
  49709.                 );
  49710.             }
  49711.             $responseBody $response->getBody();
  49712.             switch($statusCode) {
  49713.                 case 200:
  49714.                     if ('\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows' === '\SplFileObject') {
  49715.                         $content $responseBody//stream goes to serializer
  49716.                     } else {
  49717.                         $content $responseBody->getContents();
  49718.                     }
  49719.                     return [
  49720.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows', []),
  49721.                         $response->getStatusCode(),
  49722.                         $response->getHeaders()
  49723.                     ];
  49724.             }
  49725.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows';
  49726.             $responseBody $response->getBody();
  49727.             if ($returnType === '\SplFileObject') {
  49728.                 $content $responseBody//stream goes to serializer
  49729.             } else {
  49730.                 $content $responseBody->getContents();
  49731.             }
  49732.             return [
  49733.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  49734.                 $response->getStatusCode(),
  49735.                 $response->getHeaders()
  49736.             ];
  49737.         } catch (ApiException $e) {
  49738.             switch ($e->getCode()) {
  49739.                 case 200:
  49740.                     $data AccountingObjectSerializer::deserialize(
  49741.                         $e->getResponseBody(),
  49742.                         '\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows',
  49743.                         $e->getResponseHeaders()
  49744.                     );
  49745.                     $e->setResponseObject($data);
  49746.                     break;
  49747.             }
  49748.             throw $e;
  49749.         }
  49750.     }
  49751.     /**
  49752.      * Operation getReportsListAsync
  49753.      * Retrieves a list of the organistaions unique reports that require a uuid to fetch
  49754.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  49755.      * @throws \InvalidArgumentException
  49756.      * @return \GuzzleHttp\Promise\PromiseInterface
  49757.      */
  49758.     public function getReportsListAsync($xero_tenant_id)
  49759.     {
  49760.         return $this->getReportsListAsyncWithHttpInfo($xero_tenant_id)
  49761.             ->then(
  49762.                 function ($response) {
  49763.                     return $response[0];
  49764.                 }
  49765.             );
  49766.     }
  49767.     /**
  49768.      * Operation getReportsListAsyncWithHttpInfo
  49769.      * Retrieves a list of the organistaions unique reports that require a uuid to fetch
  49770.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  49771.      * @throws \InvalidArgumentException
  49772.      * @return \GuzzleHttp\Promise\PromiseInterface */
  49773.     public function getReportsListAsyncWithHttpInfo($xero_tenant_id)
  49774.     {
  49775.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\ReportWithRows';
  49776.         $request $this->getReportsListRequest($xero_tenant_id);
  49777.         return $this->client
  49778.             ->sendAsync($request$this->createHttpClientOption())
  49779.             ->then(
  49780.                 function ($response) use ($returnType) {
  49781.                     $responseBody $response->getBody();
  49782.                     if ($returnType === '\SplFileObject') {
  49783.                         $content $responseBody//stream goes to serializer
  49784.                     } else {
  49785.                         $content $responseBody->getContents();
  49786.                     }
  49787.                     return [
  49788.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  49789.                         $response->getStatusCode(),
  49790.                         $response->getHeaders()
  49791.                     ];
  49792.                 },
  49793.                 function ($exception) {
  49794.                     $response $exception->getResponse();
  49795.                     $statusCode $response->getStatusCode();
  49796.                     throw new ApiException(
  49797.                         sprintf(
  49798.                             '[%d] Error connecting to the API (%s)',
  49799.                             $statusCode,
  49800.                             $exception->getRequest()->getUri()
  49801.                         ),
  49802.                         $statusCode,
  49803.                         $response->getHeaders(),
  49804.                         $response->getBody()
  49805.                     );
  49806.                 }
  49807.             );
  49808.     }
  49809.     /**
  49810.      * Create request for operation 'getReportsList'
  49811.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  49812.      * @throws \InvalidArgumentException
  49813.      * @return \GuzzleHttp\Psr7\Request  */
  49814.     protected function getReportsListRequest($xero_tenant_id)
  49815.     {
  49816.         // verify the required parameter 'xero_tenant_id' is set
  49817.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  49818.             throw new \InvalidArgumentException(
  49819.                 'Missing the required parameter $xero_tenant_id when calling getReportsList'
  49820.             );
  49821.         }
  49822.         $resourcePath '/Reports';
  49823.         $formParams = [];
  49824.         $queryParams = [];
  49825.         $headerParams = [];
  49826.         $httpBody '';
  49827.         $multipart false;
  49828.         // header params
  49829.         if ($xero_tenant_id !== null) {
  49830.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  49831.         }
  49832.         // body params
  49833.         $_tempBody null;
  49834.         if ($multipart) {
  49835.             $headers $this->headerSelector->selectHeadersForMultipart(
  49836.                 ['application/json']
  49837.             );
  49838.         } else {
  49839.             $headers $this->headerSelector->selectHeaders(
  49840.                 ['application/json'],
  49841.                 []
  49842.             );
  49843.         }
  49844.         // for model (json/xml)
  49845.         if (isset($_tempBody)) {
  49846.             // $_tempBody is the method argument, if present
  49847.             if ($headers['Content-Type'] === 'application/json') {
  49848.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  49849.             } else {
  49850.                 $httpBody $_tempBody;
  49851.             }
  49852.         } elseif (count($formParams) > 0) {
  49853.             if ($multipart) {
  49854.                 $multipartContents = [
  49855.                     [
  49856.                         'Content-type' => 'multipart/form-data',
  49857.                     ]
  49858.                 ];
  49859.                 
  49860.                 // for HTTP post (form)
  49861.                 $httpBody = new MultipartStream($multipartContents);
  49862.             } elseif ($headers['Content-Type'] === 'application/json') {
  49863.                 $httpBody \GuzzleHttp\json_encode($formParams);
  49864.             } else {
  49865.                 // for HTTP post (form)
  49866.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  49867.             }
  49868.         }
  49869.         // this endpoint requires OAuth (access token)
  49870.         if ($this->config->getAccessToken() !== null) {
  49871.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  49872.         }
  49873.         $defaultHeaders = [];
  49874.         if ($this->config->getUserAgent()) {
  49875.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  49876.         }
  49877.         $headers array_merge(
  49878.             $defaultHeaders,
  49879.             $headerParams,
  49880.             $headers
  49881.         );
  49882.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  49883.         return new Request(
  49884.             'GET',
  49885.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  49886.             $headers,
  49887.             $httpBody
  49888.         );
  49889.     }
  49890.     /**
  49891.      * Operation getTaxRates
  49892.      * Retrieves tax rates
  49893.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  49894.      * @param  string $where Filter by an any element (optional)
  49895.      * @param  string $order Order by an any element (optional)
  49896.      * @param  string $tax_type Filter by tax type (optional)
  49897.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  49898.      * @throws \InvalidArgumentException
  49899.      * @return \XeroAPI\XeroPHP\Models\Accounting\TaxRates
  49900.      */
  49901.     public function getTaxRates($xero_tenant_id$where null$order null$tax_type null)
  49902.     {
  49903.         list($response) = $this->getTaxRatesWithHttpInfo($xero_tenant_id$where$order$tax_type);
  49904.         return $response;
  49905.     }
  49906.     /**
  49907.      * Operation getTaxRatesWithHttpInfo
  49908.      * Retrieves tax rates
  49909.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  49910.      * @param  string $where Filter by an any element (optional)
  49911.      * @param  string $order Order by an any element (optional)
  49912.      * @param  string $tax_type Filter by tax type (optional)
  49913.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  49914.      * @throws \InvalidArgumentException
  49915.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\TaxRates, HTTP status code, HTTP response headers (array of strings)
  49916.      */
  49917.     public function getTaxRatesWithHttpInfo($xero_tenant_id$where null$order null$tax_type null)
  49918.     {
  49919.         $request $this->getTaxRatesRequest($xero_tenant_id$where$order$tax_type);
  49920.         try {
  49921.             $options $this->createHttpClientOption();
  49922.             try {
  49923.                 $response $this->client->send($request$options);
  49924.             } catch (RequestException $e) {
  49925.                 throw new ApiException(
  49926.                     "[{$e->getCode()}{$e->getMessage()}",
  49927.                     $e->getCode(),
  49928.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  49929.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  49930.                 );
  49931.             }
  49932.             $statusCode $response->getStatusCode();
  49933.             if ($statusCode 200 || $statusCode 299) {
  49934.                 throw new ApiException(
  49935.                     sprintf(
  49936.                         '[%d] Error connecting to the API (%s)',
  49937.                         $statusCode,
  49938.                         $request->getUri()
  49939.                     ),
  49940.                     $statusCode,
  49941.                     $response->getHeaders(),
  49942.                     $response->getBody()
  49943.                 );
  49944.             }
  49945.             $responseBody $response->getBody();
  49946.             switch($statusCode) {
  49947.                 case 200:
  49948.                     if ('\XeroAPI\XeroPHP\Models\Accounting\TaxRates' === '\SplFileObject') {
  49949.                         $content $responseBody//stream goes to serializer
  49950.                     } else {
  49951.                         $content $responseBody->getContents();
  49952.                     }
  49953.                     return [
  49954.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\TaxRates', []),
  49955.                         $response->getStatusCode(),
  49956.                         $response->getHeaders()
  49957.                     ];
  49958.             }
  49959.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\TaxRates';
  49960.             $responseBody $response->getBody();
  49961.             if ($returnType === '\SplFileObject') {
  49962.                 $content $responseBody//stream goes to serializer
  49963.             } else {
  49964.                 $content $responseBody->getContents();
  49965.             }
  49966.             return [
  49967.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  49968.                 $response->getStatusCode(),
  49969.                 $response->getHeaders()
  49970.             ];
  49971.         } catch (ApiException $e) {
  49972.             switch ($e->getCode()) {
  49973.                 case 200:
  49974.                     $data AccountingObjectSerializer::deserialize(
  49975.                         $e->getResponseBody(),
  49976.                         '\XeroAPI\XeroPHP\Models\Accounting\TaxRates',
  49977.                         $e->getResponseHeaders()
  49978.                     );
  49979.                     $e->setResponseObject($data);
  49980.                     break;
  49981.             }
  49982.             throw $e;
  49983.         }
  49984.     }
  49985.     /**
  49986.      * Operation getTaxRatesAsync
  49987.      * Retrieves tax rates
  49988.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  49989.      * @param  string $where Filter by an any element (optional)
  49990.      * @param  string $order Order by an any element (optional)
  49991.      * @param  string $tax_type Filter by tax type (optional)
  49992.      * @throws \InvalidArgumentException
  49993.      * @return \GuzzleHttp\Promise\PromiseInterface
  49994.      */
  49995.     public function getTaxRatesAsync($xero_tenant_id$where null$order null$tax_type null)
  49996.     {
  49997.         return $this->getTaxRatesAsyncWithHttpInfo($xero_tenant_id$where$order$tax_type)
  49998.             ->then(
  49999.                 function ($response) {
  50000.                     return $response[0];
  50001.                 }
  50002.             );
  50003.     }
  50004.     /**
  50005.      * Operation getTaxRatesAsyncWithHttpInfo
  50006.      * Retrieves tax rates
  50007.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  50008.      * @param  string $where Filter by an any element (optional)
  50009.      * @param  string $order Order by an any element (optional)
  50010.      * @param  string $tax_type Filter by tax type (optional)
  50011.      * @throws \InvalidArgumentException
  50012.      * @return \GuzzleHttp\Promise\PromiseInterface */
  50013.     public function getTaxRatesAsyncWithHttpInfo($xero_tenant_id$where null$order null$tax_type null)
  50014.     {
  50015.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\TaxRates';
  50016.         $request $this->getTaxRatesRequest($xero_tenant_id$where$order$tax_type);
  50017.         return $this->client
  50018.             ->sendAsync($request$this->createHttpClientOption())
  50019.             ->then(
  50020.                 function ($response) use ($returnType) {
  50021.                     $responseBody $response->getBody();
  50022.                     if ($returnType === '\SplFileObject') {
  50023.                         $content $responseBody//stream goes to serializer
  50024.                     } else {
  50025.                         $content $responseBody->getContents();
  50026.                     }
  50027.                     return [
  50028.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  50029.                         $response->getStatusCode(),
  50030.                         $response->getHeaders()
  50031.                     ];
  50032.                 },
  50033.                 function ($exception) {
  50034.                     $response $exception->getResponse();
  50035.                     $statusCode $response->getStatusCode();
  50036.                     throw new ApiException(
  50037.                         sprintf(
  50038.                             '[%d] Error connecting to the API (%s)',
  50039.                             $statusCode,
  50040.                             $exception->getRequest()->getUri()
  50041.                         ),
  50042.                         $statusCode,
  50043.                         $response->getHeaders(),
  50044.                         $response->getBody()
  50045.                     );
  50046.                 }
  50047.             );
  50048.     }
  50049.     /**
  50050.      * Create request for operation 'getTaxRates'
  50051.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  50052.      * @param  string $where Filter by an any element (optional)
  50053.      * @param  string $order Order by an any element (optional)
  50054.      * @param  string $tax_type Filter by tax type (optional)
  50055.      * @throws \InvalidArgumentException
  50056.      * @return \GuzzleHttp\Psr7\Request  */
  50057.     protected function getTaxRatesRequest($xero_tenant_id$where null$order null$tax_type null)
  50058.     {
  50059.         // verify the required parameter 'xero_tenant_id' is set
  50060.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  50061.             throw new \InvalidArgumentException(
  50062.                 'Missing the required parameter $xero_tenant_id when calling getTaxRates'
  50063.             );
  50064.         }
  50065.         $resourcePath '/TaxRates';
  50066.         $formParams = [];
  50067.         $queryParams = [];
  50068.         $headerParams = [];
  50069.         $httpBody '';
  50070.         $multipart false;
  50071.         // query params
  50072.         if ($where !== null) {
  50073.             $queryParams['where'] = AccountingObjectSerializer::toQueryValue($where);
  50074.         }
  50075.         // query params
  50076.         if ($order !== null) {
  50077.             $queryParams['order'] = AccountingObjectSerializer::toQueryValue($order);
  50078.         }
  50079.         // query params
  50080.         if ($tax_type !== null) {
  50081.             $queryParams['TaxType'] = AccountingObjectSerializer::toQueryValue($tax_type);
  50082.         }
  50083.         // header params
  50084.         if ($xero_tenant_id !== null) {
  50085.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  50086.         }
  50087.         // body params
  50088.         $_tempBody null;
  50089.         if ($multipart) {
  50090.             $headers $this->headerSelector->selectHeadersForMultipart(
  50091.                 ['application/json']
  50092.             );
  50093.         } else {
  50094.             $headers $this->headerSelector->selectHeaders(
  50095.                 ['application/json'],
  50096.                 []
  50097.             );
  50098.         }
  50099.         // for model (json/xml)
  50100.         if (isset($_tempBody)) {
  50101.             // $_tempBody is the method argument, if present
  50102.             if ($headers['Content-Type'] === 'application/json') {
  50103.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  50104.             } else {
  50105.                 $httpBody $_tempBody;
  50106.             }
  50107.         } elseif (count($formParams) > 0) {
  50108.             if ($multipart) {
  50109.                 $multipartContents = [
  50110.                     [
  50111.                         'Content-type' => 'multipart/form-data',
  50112.                     ]
  50113.                 ];
  50114.                 
  50115.                 // for HTTP post (form)
  50116.                 $httpBody = new MultipartStream($multipartContents);
  50117.             } elseif ($headers['Content-Type'] === 'application/json') {
  50118.                 $httpBody \GuzzleHttp\json_encode($formParams);
  50119.             } else {
  50120.                 // for HTTP post (form)
  50121.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  50122.             }
  50123.         }
  50124.         // this endpoint requires OAuth (access token)
  50125.         if ($this->config->getAccessToken() !== null) {
  50126.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  50127.         }
  50128.         $defaultHeaders = [];
  50129.         if ($this->config->getUserAgent()) {
  50130.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  50131.         }
  50132.         $headers array_merge(
  50133.             $defaultHeaders,
  50134.             $headerParams,
  50135.             $headers
  50136.         );
  50137.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  50138.         return new Request(
  50139.             'GET',
  50140.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  50141.             $headers,
  50142.             $httpBody
  50143.         );
  50144.     }
  50145.     /**
  50146.      * Operation getTrackingCategories
  50147.      * Retrieves tracking categories and options
  50148.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  50149.      * @param  string $where Filter by an any element (optional)
  50150.      * @param  string $order Order by an any element (optional)
  50151.      * @param  bool $include_archived e.g. includeArchived&#x3D;true - Categories and options with a status of ARCHIVED will be included in the response (optional)
  50152.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  50153.      * @throws \InvalidArgumentException
  50154.      * @return \XeroAPI\XeroPHP\Models\Accounting\TrackingCategories
  50155.      */
  50156.     public function getTrackingCategories($xero_tenant_id$where null$order null$include_archived null)
  50157.     {
  50158.         list($response) = $this->getTrackingCategoriesWithHttpInfo($xero_tenant_id$where$order$include_archived);
  50159.         return $response;
  50160.     }
  50161.     /**
  50162.      * Operation getTrackingCategoriesWithHttpInfo
  50163.      * Retrieves tracking categories and options
  50164.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  50165.      * @param  string $where Filter by an any element (optional)
  50166.      * @param  string $order Order by an any element (optional)
  50167.      * @param  bool $include_archived e.g. includeArchived&#x3D;true - Categories and options with a status of ARCHIVED will be included in the response (optional)
  50168.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  50169.      * @throws \InvalidArgumentException
  50170.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\TrackingCategories, HTTP status code, HTTP response headers (array of strings)
  50171.      */
  50172.     public function getTrackingCategoriesWithHttpInfo($xero_tenant_id$where null$order null$include_archived null)
  50173.     {
  50174.         $request $this->getTrackingCategoriesRequest($xero_tenant_id$where$order$include_archived);
  50175.         try {
  50176.             $options $this->createHttpClientOption();
  50177.             try {
  50178.                 $response $this->client->send($request$options);
  50179.             } catch (RequestException $e) {
  50180.                 throw new ApiException(
  50181.                     "[{$e->getCode()}{$e->getMessage()}",
  50182.                     $e->getCode(),
  50183.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  50184.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  50185.                 );
  50186.             }
  50187.             $statusCode $response->getStatusCode();
  50188.             if ($statusCode 200 || $statusCode 299) {
  50189.                 throw new ApiException(
  50190.                     sprintf(
  50191.                         '[%d] Error connecting to the API (%s)',
  50192.                         $statusCode,
  50193.                         $request->getUri()
  50194.                     ),
  50195.                     $statusCode,
  50196.                     $response->getHeaders(),
  50197.                     $response->getBody()
  50198.                 );
  50199.             }
  50200.             $responseBody $response->getBody();
  50201.             switch($statusCode) {
  50202.                 case 200:
  50203.                     if ('\XeroAPI\XeroPHP\Models\Accounting\TrackingCategories' === '\SplFileObject') {
  50204.                         $content $responseBody//stream goes to serializer
  50205.                     } else {
  50206.                         $content $responseBody->getContents();
  50207.                     }
  50208.                     return [
  50209.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\TrackingCategories', []),
  50210.                         $response->getStatusCode(),
  50211.                         $response->getHeaders()
  50212.                     ];
  50213.             }
  50214.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\TrackingCategories';
  50215.             $responseBody $response->getBody();
  50216.             if ($returnType === '\SplFileObject') {
  50217.                 $content $responseBody//stream goes to serializer
  50218.             } else {
  50219.                 $content $responseBody->getContents();
  50220.             }
  50221.             return [
  50222.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  50223.                 $response->getStatusCode(),
  50224.                 $response->getHeaders()
  50225.             ];
  50226.         } catch (ApiException $e) {
  50227.             switch ($e->getCode()) {
  50228.                 case 200:
  50229.                     $data AccountingObjectSerializer::deserialize(
  50230.                         $e->getResponseBody(),
  50231.                         '\XeroAPI\XeroPHP\Models\Accounting\TrackingCategories',
  50232.                         $e->getResponseHeaders()
  50233.                     );
  50234.                     $e->setResponseObject($data);
  50235.                     break;
  50236.             }
  50237.             throw $e;
  50238.         }
  50239.     }
  50240.     /**
  50241.      * Operation getTrackingCategoriesAsync
  50242.      * Retrieves tracking categories and options
  50243.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  50244.      * @param  string $where Filter by an any element (optional)
  50245.      * @param  string $order Order by an any element (optional)
  50246.      * @param  bool $include_archived e.g. includeArchived&#x3D;true - Categories and options with a status of ARCHIVED will be included in the response (optional)
  50247.      * @throws \InvalidArgumentException
  50248.      * @return \GuzzleHttp\Promise\PromiseInterface
  50249.      */
  50250.     public function getTrackingCategoriesAsync($xero_tenant_id$where null$order null$include_archived null)
  50251.     {
  50252.         return $this->getTrackingCategoriesAsyncWithHttpInfo($xero_tenant_id$where$order$include_archived)
  50253.             ->then(
  50254.                 function ($response) {
  50255.                     return $response[0];
  50256.                 }
  50257.             );
  50258.     }
  50259.     /**
  50260.      * Operation getTrackingCategoriesAsyncWithHttpInfo
  50261.      * Retrieves tracking categories and options
  50262.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  50263.      * @param  string $where Filter by an any element (optional)
  50264.      * @param  string $order Order by an any element (optional)
  50265.      * @param  bool $include_archived e.g. includeArchived&#x3D;true - Categories and options with a status of ARCHIVED will be included in the response (optional)
  50266.      * @throws \InvalidArgumentException
  50267.      * @return \GuzzleHttp\Promise\PromiseInterface */
  50268.     public function getTrackingCategoriesAsyncWithHttpInfo($xero_tenant_id$where null$order null$include_archived null)
  50269.     {
  50270.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\TrackingCategories';
  50271.         $request $this->getTrackingCategoriesRequest($xero_tenant_id$where$order$include_archived);
  50272.         return $this->client
  50273.             ->sendAsync($request$this->createHttpClientOption())
  50274.             ->then(
  50275.                 function ($response) use ($returnType) {
  50276.                     $responseBody $response->getBody();
  50277.                     if ($returnType === '\SplFileObject') {
  50278.                         $content $responseBody//stream goes to serializer
  50279.                     } else {
  50280.                         $content $responseBody->getContents();
  50281.                     }
  50282.                     return [
  50283.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  50284.                         $response->getStatusCode(),
  50285.                         $response->getHeaders()
  50286.                     ];
  50287.                 },
  50288.                 function ($exception) {
  50289.                     $response $exception->getResponse();
  50290.                     $statusCode $response->getStatusCode();
  50291.                     throw new ApiException(
  50292.                         sprintf(
  50293.                             '[%d] Error connecting to the API (%s)',
  50294.                             $statusCode,
  50295.                             $exception->getRequest()->getUri()
  50296.                         ),
  50297.                         $statusCode,
  50298.                         $response->getHeaders(),
  50299.                         $response->getBody()
  50300.                     );
  50301.                 }
  50302.             );
  50303.     }
  50304.     /**
  50305.      * Create request for operation 'getTrackingCategories'
  50306.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  50307.      * @param  string $where Filter by an any element (optional)
  50308.      * @param  string $order Order by an any element (optional)
  50309.      * @param  bool $include_archived e.g. includeArchived&#x3D;true - Categories and options with a status of ARCHIVED will be included in the response (optional)
  50310.      * @throws \InvalidArgumentException
  50311.      * @return \GuzzleHttp\Psr7\Request  */
  50312.     protected function getTrackingCategoriesRequest($xero_tenant_id$where null$order null$include_archived null)
  50313.     {
  50314.         // verify the required parameter 'xero_tenant_id' is set
  50315.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  50316.             throw new \InvalidArgumentException(
  50317.                 'Missing the required parameter $xero_tenant_id when calling getTrackingCategories'
  50318.             );
  50319.         }
  50320.         $resourcePath '/TrackingCategories';
  50321.         $formParams = [];
  50322.         $queryParams = [];
  50323.         $headerParams = [];
  50324.         $httpBody '';
  50325.         $multipart false;
  50326.         // query params
  50327.         if ($where !== null) {
  50328.             $queryParams['where'] = AccountingObjectSerializer::toQueryValue($where);
  50329.         }
  50330.         // query params
  50331.         if ($order !== null) {
  50332.             $queryParams['order'] = AccountingObjectSerializer::toQueryValue($order);
  50333.         }
  50334.         // query params
  50335.         if ($include_archived !== null) {
  50336.             $queryParams['includeArchived'] = $include_archived 'true' 'false';
  50337.         }
  50338.         // header params
  50339.         if ($xero_tenant_id !== null) {
  50340.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  50341.         }
  50342.         // body params
  50343.         $_tempBody null;
  50344.         if ($multipart) {
  50345.             $headers $this->headerSelector->selectHeadersForMultipart(
  50346.                 ['application/json']
  50347.             );
  50348.         } else {
  50349.             $headers $this->headerSelector->selectHeaders(
  50350.                 ['application/json'],
  50351.                 []
  50352.             );
  50353.         }
  50354.         // for model (json/xml)
  50355.         if (isset($_tempBody)) {
  50356.             // $_tempBody is the method argument, if present
  50357.             if ($headers['Content-Type'] === 'application/json') {
  50358.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  50359.             } else {
  50360.                 $httpBody $_tempBody;
  50361.             }
  50362.         } elseif (count($formParams) > 0) {
  50363.             if ($multipart) {
  50364.                 $multipartContents = [
  50365.                     [
  50366.                         'Content-type' => 'multipart/form-data',
  50367.                     ]
  50368.                 ];
  50369.                 
  50370.                 // for HTTP post (form)
  50371.                 $httpBody = new MultipartStream($multipartContents);
  50372.             } elseif ($headers['Content-Type'] === 'application/json') {
  50373.                 $httpBody \GuzzleHttp\json_encode($formParams);
  50374.             } else {
  50375.                 // for HTTP post (form)
  50376.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  50377.             }
  50378.         }
  50379.         // this endpoint requires OAuth (access token)
  50380.         if ($this->config->getAccessToken() !== null) {
  50381.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  50382.         }
  50383.         $defaultHeaders = [];
  50384.         if ($this->config->getUserAgent()) {
  50385.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  50386.         }
  50387.         $headers array_merge(
  50388.             $defaultHeaders,
  50389.             $headerParams,
  50390.             $headers
  50391.         );
  50392.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  50393.         return new Request(
  50394.             'GET',
  50395.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  50396.             $headers,
  50397.             $httpBody
  50398.         );
  50399.     }
  50400.     /**
  50401.      * Operation getTrackingCategory
  50402.      * Retrieves specific tracking categories and options using a unique tracking category Id
  50403.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  50404.      * @param  string $tracking_category_id Unique identifier for a TrackingCategory (required)
  50405.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  50406.      * @throws \InvalidArgumentException
  50407.      * @return \XeroAPI\XeroPHP\Models\Accounting\TrackingCategories
  50408.      */
  50409.     public function getTrackingCategory($xero_tenant_id$tracking_category_id)
  50410.     {
  50411.         list($response) = $this->getTrackingCategoryWithHttpInfo($xero_tenant_id$tracking_category_id);
  50412.         return $response;
  50413.     }
  50414.     /**
  50415.      * Operation getTrackingCategoryWithHttpInfo
  50416.      * Retrieves specific tracking categories and options using a unique tracking category Id
  50417.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  50418.      * @param  string $tracking_category_id Unique identifier for a TrackingCategory (required)
  50419.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  50420.      * @throws \InvalidArgumentException
  50421.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\TrackingCategories, HTTP status code, HTTP response headers (array of strings)
  50422.      */
  50423.     public function getTrackingCategoryWithHttpInfo($xero_tenant_id$tracking_category_id)
  50424.     {
  50425.         $request $this->getTrackingCategoryRequest($xero_tenant_id$tracking_category_id);
  50426.         try {
  50427.             $options $this->createHttpClientOption();
  50428.             try {
  50429.                 $response $this->client->send($request$options);
  50430.             } catch (RequestException $e) {
  50431.                 throw new ApiException(
  50432.                     "[{$e->getCode()}{$e->getMessage()}",
  50433.                     $e->getCode(),
  50434.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  50435.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  50436.                 );
  50437.             }
  50438.             $statusCode $response->getStatusCode();
  50439.             if ($statusCode 200 || $statusCode 299) {
  50440.                 throw new ApiException(
  50441.                     sprintf(
  50442.                         '[%d] Error connecting to the API (%s)',
  50443.                         $statusCode,
  50444.                         $request->getUri()
  50445.                     ),
  50446.                     $statusCode,
  50447.                     $response->getHeaders(),
  50448.                     $response->getBody()
  50449.                 );
  50450.             }
  50451.             $responseBody $response->getBody();
  50452.             switch($statusCode) {
  50453.                 case 200:
  50454.                     if ('\XeroAPI\XeroPHP\Models\Accounting\TrackingCategories' === '\SplFileObject') {
  50455.                         $content $responseBody//stream goes to serializer
  50456.                     } else {
  50457.                         $content $responseBody->getContents();
  50458.                     }
  50459.                     return [
  50460.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\TrackingCategories', []),
  50461.                         $response->getStatusCode(),
  50462.                         $response->getHeaders()
  50463.                     ];
  50464.             }
  50465.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\TrackingCategories';
  50466.             $responseBody $response->getBody();
  50467.             if ($returnType === '\SplFileObject') {
  50468.                 $content $responseBody//stream goes to serializer
  50469.             } else {
  50470.                 $content $responseBody->getContents();
  50471.             }
  50472.             return [
  50473.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  50474.                 $response->getStatusCode(),
  50475.                 $response->getHeaders()
  50476.             ];
  50477.         } catch (ApiException $e) {
  50478.             switch ($e->getCode()) {
  50479.                 case 200:
  50480.                     $data AccountingObjectSerializer::deserialize(
  50481.                         $e->getResponseBody(),
  50482.                         '\XeroAPI\XeroPHP\Models\Accounting\TrackingCategories',
  50483.                         $e->getResponseHeaders()
  50484.                     );
  50485.                     $e->setResponseObject($data);
  50486.                     break;
  50487.             }
  50488.             throw $e;
  50489.         }
  50490.     }
  50491.     /**
  50492.      * Operation getTrackingCategoryAsync
  50493.      * Retrieves specific tracking categories and options using a unique tracking category Id
  50494.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  50495.      * @param  string $tracking_category_id Unique identifier for a TrackingCategory (required)
  50496.      * @throws \InvalidArgumentException
  50497.      * @return \GuzzleHttp\Promise\PromiseInterface
  50498.      */
  50499.     public function getTrackingCategoryAsync($xero_tenant_id$tracking_category_id)
  50500.     {
  50501.         return $this->getTrackingCategoryAsyncWithHttpInfo($xero_tenant_id$tracking_category_id)
  50502.             ->then(
  50503.                 function ($response) {
  50504.                     return $response[0];
  50505.                 }
  50506.             );
  50507.     }
  50508.     /**
  50509.      * Operation getTrackingCategoryAsyncWithHttpInfo
  50510.      * Retrieves specific tracking categories and options using a unique tracking category Id
  50511.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  50512.      * @param  string $tracking_category_id Unique identifier for a TrackingCategory (required)
  50513.      * @throws \InvalidArgumentException
  50514.      * @return \GuzzleHttp\Promise\PromiseInterface */
  50515.     public function getTrackingCategoryAsyncWithHttpInfo($xero_tenant_id$tracking_category_id)
  50516.     {
  50517.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\TrackingCategories';
  50518.         $request $this->getTrackingCategoryRequest($xero_tenant_id$tracking_category_id);
  50519.         return $this->client
  50520.             ->sendAsync($request$this->createHttpClientOption())
  50521.             ->then(
  50522.                 function ($response) use ($returnType) {
  50523.                     $responseBody $response->getBody();
  50524.                     if ($returnType === '\SplFileObject') {
  50525.                         $content $responseBody//stream goes to serializer
  50526.                     } else {
  50527.                         $content $responseBody->getContents();
  50528.                     }
  50529.                     return [
  50530.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  50531.                         $response->getStatusCode(),
  50532.                         $response->getHeaders()
  50533.                     ];
  50534.                 },
  50535.                 function ($exception) {
  50536.                     $response $exception->getResponse();
  50537.                     $statusCode $response->getStatusCode();
  50538.                     throw new ApiException(
  50539.                         sprintf(
  50540.                             '[%d] Error connecting to the API (%s)',
  50541.                             $statusCode,
  50542.                             $exception->getRequest()->getUri()
  50543.                         ),
  50544.                         $statusCode,
  50545.                         $response->getHeaders(),
  50546.                         $response->getBody()
  50547.                     );
  50548.                 }
  50549.             );
  50550.     }
  50551.     /**
  50552.      * Create request for operation 'getTrackingCategory'
  50553.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  50554.      * @param  string $tracking_category_id Unique identifier for a TrackingCategory (required)
  50555.      * @throws \InvalidArgumentException
  50556.      * @return \GuzzleHttp\Psr7\Request  */
  50557.     protected function getTrackingCategoryRequest($xero_tenant_id$tracking_category_id)
  50558.     {
  50559.         // verify the required parameter 'xero_tenant_id' is set
  50560.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  50561.             throw new \InvalidArgumentException(
  50562.                 'Missing the required parameter $xero_tenant_id when calling getTrackingCategory'
  50563.             );
  50564.         }
  50565.         // verify the required parameter 'tracking_category_id' is set
  50566.         if ($tracking_category_id === null || (is_array($tracking_category_id) && count($tracking_category_id) === 0)) {
  50567.             throw new \InvalidArgumentException(
  50568.                 'Missing the required parameter $tracking_category_id when calling getTrackingCategory'
  50569.             );
  50570.         }
  50571.         $resourcePath '/TrackingCategories/{TrackingCategoryID}';
  50572.         $formParams = [];
  50573.         $queryParams = [];
  50574.         $headerParams = [];
  50575.         $httpBody '';
  50576.         $multipart false;
  50577.         // header params
  50578.         if ($xero_tenant_id !== null) {
  50579.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  50580.         }
  50581.         // path params
  50582.         if ($tracking_category_id !== null) {
  50583.             $resourcePath str_replace(
  50584.                 '{' 'TrackingCategoryID' '}',
  50585.                 AccountingObjectSerializer::toPathValue($tracking_category_id),
  50586.                 $resourcePath
  50587.             );
  50588.         }
  50589.         // body params
  50590.         $_tempBody null;
  50591.         if ($multipart) {
  50592.             $headers $this->headerSelector->selectHeadersForMultipart(
  50593.                 ['application/json']
  50594.             );
  50595.         } else {
  50596.             $headers $this->headerSelector->selectHeaders(
  50597.                 ['application/json'],
  50598.                 []
  50599.             );
  50600.         }
  50601.         // for model (json/xml)
  50602.         if (isset($_tempBody)) {
  50603.             // $_tempBody is the method argument, if present
  50604.             if ($headers['Content-Type'] === 'application/json') {
  50605.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  50606.             } else {
  50607.                 $httpBody $_tempBody;
  50608.             }
  50609.         } elseif (count($formParams) > 0) {
  50610.             if ($multipart) {
  50611.                 $multipartContents = [
  50612.                     [
  50613.                         'Content-type' => 'multipart/form-data',
  50614.                     ]
  50615.                 ];
  50616.                 
  50617.                 // for HTTP post (form)
  50618.                 $httpBody = new MultipartStream($multipartContents);
  50619.             } elseif ($headers['Content-Type'] === 'application/json') {
  50620.                 $httpBody \GuzzleHttp\json_encode($formParams);
  50621.             } else {
  50622.                 // for HTTP post (form)
  50623.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  50624.             }
  50625.         }
  50626.         // this endpoint requires OAuth (access token)
  50627.         if ($this->config->getAccessToken() !== null) {
  50628.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  50629.         }
  50630.         $defaultHeaders = [];
  50631.         if ($this->config->getUserAgent()) {
  50632.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  50633.         }
  50634.         $headers array_merge(
  50635.             $defaultHeaders,
  50636.             $headerParams,
  50637.             $headers
  50638.         );
  50639.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  50640.         return new Request(
  50641.             'GET',
  50642.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  50643.             $headers,
  50644.             $httpBody
  50645.         );
  50646.     }
  50647.     /**
  50648.      * Operation getUser
  50649.      * Retrieves a specific user
  50650.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  50651.      * @param  string $user_id Unique identifier for a User (required)
  50652.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  50653.      * @throws \InvalidArgumentException
  50654.      * @return \XeroAPI\XeroPHP\Models\Accounting\Users
  50655.      */
  50656.     public function getUser($xero_tenant_id$user_id)
  50657.     {
  50658.         list($response) = $this->getUserWithHttpInfo($xero_tenant_id$user_id);
  50659.         return $response;
  50660.     }
  50661.     /**
  50662.      * Operation getUserWithHttpInfo
  50663.      * Retrieves a specific user
  50664.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  50665.      * @param  string $user_id Unique identifier for a User (required)
  50666.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  50667.      * @throws \InvalidArgumentException
  50668.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Users, HTTP status code, HTTP response headers (array of strings)
  50669.      */
  50670.     public function getUserWithHttpInfo($xero_tenant_id$user_id)
  50671.     {
  50672.         $request $this->getUserRequest($xero_tenant_id$user_id);
  50673.         try {
  50674.             $options $this->createHttpClientOption();
  50675.             try {
  50676.                 $response $this->client->send($request$options);
  50677.             } catch (RequestException $e) {
  50678.                 throw new ApiException(
  50679.                     "[{$e->getCode()}{$e->getMessage()}",
  50680.                     $e->getCode(),
  50681.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  50682.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  50683.                 );
  50684.             }
  50685.             $statusCode $response->getStatusCode();
  50686.             if ($statusCode 200 || $statusCode 299) {
  50687.                 throw new ApiException(
  50688.                     sprintf(
  50689.                         '[%d] Error connecting to the API (%s)',
  50690.                         $statusCode,
  50691.                         $request->getUri()
  50692.                     ),
  50693.                     $statusCode,
  50694.                     $response->getHeaders(),
  50695.                     $response->getBody()
  50696.                 );
  50697.             }
  50698.             $responseBody $response->getBody();
  50699.             switch($statusCode) {
  50700.                 case 200:
  50701.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Users' === '\SplFileObject') {
  50702.                         $content $responseBody//stream goes to serializer
  50703.                     } else {
  50704.                         $content $responseBody->getContents();
  50705.                     }
  50706.                     return [
  50707.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Users', []),
  50708.                         $response->getStatusCode(),
  50709.                         $response->getHeaders()
  50710.                     ];
  50711.             }
  50712.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Users';
  50713.             $responseBody $response->getBody();
  50714.             if ($returnType === '\SplFileObject') {
  50715.                 $content $responseBody//stream goes to serializer
  50716.             } else {
  50717.                 $content $responseBody->getContents();
  50718.             }
  50719.             return [
  50720.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  50721.                 $response->getStatusCode(),
  50722.                 $response->getHeaders()
  50723.             ];
  50724.         } catch (ApiException $e) {
  50725.             switch ($e->getCode()) {
  50726.                 case 200:
  50727.                     $data AccountingObjectSerializer::deserialize(
  50728.                         $e->getResponseBody(),
  50729.                         '\XeroAPI\XeroPHP\Models\Accounting\Users',
  50730.                         $e->getResponseHeaders()
  50731.                     );
  50732.                     $e->setResponseObject($data);
  50733.                     break;
  50734.             }
  50735.             throw $e;
  50736.         }
  50737.     }
  50738.     /**
  50739.      * Operation getUserAsync
  50740.      * Retrieves a specific user
  50741.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  50742.      * @param  string $user_id Unique identifier for a User (required)
  50743.      * @throws \InvalidArgumentException
  50744.      * @return \GuzzleHttp\Promise\PromiseInterface
  50745.      */
  50746.     public function getUserAsync($xero_tenant_id$user_id)
  50747.     {
  50748.         return $this->getUserAsyncWithHttpInfo($xero_tenant_id$user_id)
  50749.             ->then(
  50750.                 function ($response) {
  50751.                     return $response[0];
  50752.                 }
  50753.             );
  50754.     }
  50755.     /**
  50756.      * Operation getUserAsyncWithHttpInfo
  50757.      * Retrieves a specific user
  50758.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  50759.      * @param  string $user_id Unique identifier for a User (required)
  50760.      * @throws \InvalidArgumentException
  50761.      * @return \GuzzleHttp\Promise\PromiseInterface */
  50762.     public function getUserAsyncWithHttpInfo($xero_tenant_id$user_id)
  50763.     {
  50764.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Users';
  50765.         $request $this->getUserRequest($xero_tenant_id$user_id);
  50766.         return $this->client
  50767.             ->sendAsync($request$this->createHttpClientOption())
  50768.             ->then(
  50769.                 function ($response) use ($returnType) {
  50770.                     $responseBody $response->getBody();
  50771.                     if ($returnType === '\SplFileObject') {
  50772.                         $content $responseBody//stream goes to serializer
  50773.                     } else {
  50774.                         $content $responseBody->getContents();
  50775.                     }
  50776.                     return [
  50777.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  50778.                         $response->getStatusCode(),
  50779.                         $response->getHeaders()
  50780.                     ];
  50781.                 },
  50782.                 function ($exception) {
  50783.                     $response $exception->getResponse();
  50784.                     $statusCode $response->getStatusCode();
  50785.                     throw new ApiException(
  50786.                         sprintf(
  50787.                             '[%d] Error connecting to the API (%s)',
  50788.                             $statusCode,
  50789.                             $exception->getRequest()->getUri()
  50790.                         ),
  50791.                         $statusCode,
  50792.                         $response->getHeaders(),
  50793.                         $response->getBody()
  50794.                     );
  50795.                 }
  50796.             );
  50797.     }
  50798.     /**
  50799.      * Create request for operation 'getUser'
  50800.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  50801.      * @param  string $user_id Unique identifier for a User (required)
  50802.      * @throws \InvalidArgumentException
  50803.      * @return \GuzzleHttp\Psr7\Request  */
  50804.     protected function getUserRequest($xero_tenant_id$user_id)
  50805.     {
  50806.         // verify the required parameter 'xero_tenant_id' is set
  50807.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  50808.             throw new \InvalidArgumentException(
  50809.                 'Missing the required parameter $xero_tenant_id when calling getUser'
  50810.             );
  50811.         }
  50812.         // verify the required parameter 'user_id' is set
  50813.         if ($user_id === null || (is_array($user_id) && count($user_id) === 0)) {
  50814.             throw new \InvalidArgumentException(
  50815.                 'Missing the required parameter $user_id when calling getUser'
  50816.             );
  50817.         }
  50818.         $resourcePath '/Users/{UserID}';
  50819.         $formParams = [];
  50820.         $queryParams = [];
  50821.         $headerParams = [];
  50822.         $httpBody '';
  50823.         $multipart false;
  50824.         // header params
  50825.         if ($xero_tenant_id !== null) {
  50826.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  50827.         }
  50828.         // path params
  50829.         if ($user_id !== null) {
  50830.             $resourcePath str_replace(
  50831.                 '{' 'UserID' '}',
  50832.                 AccountingObjectSerializer::toPathValue($user_id),
  50833.                 $resourcePath
  50834.             );
  50835.         }
  50836.         // body params
  50837.         $_tempBody null;
  50838.         if ($multipart) {
  50839.             $headers $this->headerSelector->selectHeadersForMultipart(
  50840.                 ['application/json']
  50841.             );
  50842.         } else {
  50843.             $headers $this->headerSelector->selectHeaders(
  50844.                 ['application/json'],
  50845.                 []
  50846.             );
  50847.         }
  50848.         // for model (json/xml)
  50849.         if (isset($_tempBody)) {
  50850.             // $_tempBody is the method argument, if present
  50851.             if ($headers['Content-Type'] === 'application/json') {
  50852.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  50853.             } else {
  50854.                 $httpBody $_tempBody;
  50855.             }
  50856.         } elseif (count($formParams) > 0) {
  50857.             if ($multipart) {
  50858.                 $multipartContents = [
  50859.                     [
  50860.                         'Content-type' => 'multipart/form-data',
  50861.                     ]
  50862.                 ];
  50863.                 
  50864.                 // for HTTP post (form)
  50865.                 $httpBody = new MultipartStream($multipartContents);
  50866.             } elseif ($headers['Content-Type'] === 'application/json') {
  50867.                 $httpBody \GuzzleHttp\json_encode($formParams);
  50868.             } else {
  50869.                 // for HTTP post (form)
  50870.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  50871.             }
  50872.         }
  50873.         // this endpoint requires OAuth (access token)
  50874.         if ($this->config->getAccessToken() !== null) {
  50875.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  50876.         }
  50877.         $defaultHeaders = [];
  50878.         if ($this->config->getUserAgent()) {
  50879.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  50880.         }
  50881.         $headers array_merge(
  50882.             $defaultHeaders,
  50883.             $headerParams,
  50884.             $headers
  50885.         );
  50886.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  50887.         return new Request(
  50888.             'GET',
  50889.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  50890.             $headers,
  50891.             $httpBody
  50892.         );
  50893.     }
  50894.     /**
  50895.      * Operation getUsers
  50896.      * Retrieves users
  50897.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  50898.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  50899.      * @param  string $where Filter by an any element (optional)
  50900.      * @param  string $order Order by an any element (optional)
  50901.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  50902.      * @throws \InvalidArgumentException
  50903.      * @return \XeroAPI\XeroPHP\Models\Accounting\Users
  50904.      */
  50905.     public function getUsers($xero_tenant_id$if_modified_since null$where null$order null)
  50906.     {
  50907.         list($response) = $this->getUsersWithHttpInfo($xero_tenant_id$if_modified_since$where$order);
  50908.         return $response;
  50909.     }
  50910.     /**
  50911.      * Operation getUsersWithHttpInfo
  50912.      * Retrieves users
  50913.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  50914.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  50915.      * @param  string $where Filter by an any element (optional)
  50916.      * @param  string $order Order by an any element (optional)
  50917.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  50918.      * @throws \InvalidArgumentException
  50919.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Users, HTTP status code, HTTP response headers (array of strings)
  50920.      */
  50921.     public function getUsersWithHttpInfo($xero_tenant_id$if_modified_since null$where null$order null)
  50922.     {
  50923.         $request $this->getUsersRequest($xero_tenant_id$if_modified_since$where$order);
  50924.         try {
  50925.             $options $this->createHttpClientOption();
  50926.             try {
  50927.                 $response $this->client->send($request$options);
  50928.             } catch (RequestException $e) {
  50929.                 throw new ApiException(
  50930.                     "[{$e->getCode()}{$e->getMessage()}",
  50931.                     $e->getCode(),
  50932.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  50933.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  50934.                 );
  50935.             }
  50936.             $statusCode $response->getStatusCode();
  50937.             if ($statusCode 200 || $statusCode 299) {
  50938.                 throw new ApiException(
  50939.                     sprintf(
  50940.                         '[%d] Error connecting to the API (%s)',
  50941.                         $statusCode,
  50942.                         $request->getUri()
  50943.                     ),
  50944.                     $statusCode,
  50945.                     $response->getHeaders(),
  50946.                     $response->getBody()
  50947.                 );
  50948.             }
  50949.             $responseBody $response->getBody();
  50950.             switch($statusCode) {
  50951.                 case 200:
  50952.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Users' === '\SplFileObject') {
  50953.                         $content $responseBody//stream goes to serializer
  50954.                     } else {
  50955.                         $content $responseBody->getContents();
  50956.                     }
  50957.                     return [
  50958.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Users', []),
  50959.                         $response->getStatusCode(),
  50960.                         $response->getHeaders()
  50961.                     ];
  50962.             }
  50963.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Users';
  50964.             $responseBody $response->getBody();
  50965.             if ($returnType === '\SplFileObject') {
  50966.                 $content $responseBody//stream goes to serializer
  50967.             } else {
  50968.                 $content $responseBody->getContents();
  50969.             }
  50970.             return [
  50971.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  50972.                 $response->getStatusCode(),
  50973.                 $response->getHeaders()
  50974.             ];
  50975.         } catch (ApiException $e) {
  50976.             switch ($e->getCode()) {
  50977.                 case 200:
  50978.                     $data AccountingObjectSerializer::deserialize(
  50979.                         $e->getResponseBody(),
  50980.                         '\XeroAPI\XeroPHP\Models\Accounting\Users',
  50981.                         $e->getResponseHeaders()
  50982.                     );
  50983.                     $e->setResponseObject($data);
  50984.                     break;
  50985.             }
  50986.             throw $e;
  50987.         }
  50988.     }
  50989.     /**
  50990.      * Operation getUsersAsync
  50991.      * Retrieves users
  50992.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  50993.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  50994.      * @param  string $where Filter by an any element (optional)
  50995.      * @param  string $order Order by an any element (optional)
  50996.      * @throws \InvalidArgumentException
  50997.      * @return \GuzzleHttp\Promise\PromiseInterface
  50998.      */
  50999.     public function getUsersAsync($xero_tenant_id$if_modified_since null$where null$order null)
  51000.     {
  51001.         return $this->getUsersAsyncWithHttpInfo($xero_tenant_id$if_modified_since$where$order)
  51002.             ->then(
  51003.                 function ($response) {
  51004.                     return $response[0];
  51005.                 }
  51006.             );
  51007.     }
  51008.     /**
  51009.      * Operation getUsersAsyncWithHttpInfo
  51010.      * Retrieves users
  51011.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  51012.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  51013.      * @param  string $where Filter by an any element (optional)
  51014.      * @param  string $order Order by an any element (optional)
  51015.      * @throws \InvalidArgumentException
  51016.      * @return \GuzzleHttp\Promise\PromiseInterface */
  51017.     public function getUsersAsyncWithHttpInfo($xero_tenant_id$if_modified_since null$where null$order null)
  51018.     {
  51019.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Users';
  51020.         $request $this->getUsersRequest($xero_tenant_id$if_modified_since$where$order);
  51021.         return $this->client
  51022.             ->sendAsync($request$this->createHttpClientOption())
  51023.             ->then(
  51024.                 function ($response) use ($returnType) {
  51025.                     $responseBody $response->getBody();
  51026.                     if ($returnType === '\SplFileObject') {
  51027.                         $content $responseBody//stream goes to serializer
  51028.                     } else {
  51029.                         $content $responseBody->getContents();
  51030.                     }
  51031.                     return [
  51032.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  51033.                         $response->getStatusCode(),
  51034.                         $response->getHeaders()
  51035.                     ];
  51036.                 },
  51037.                 function ($exception) {
  51038.                     $response $exception->getResponse();
  51039.                     $statusCode $response->getStatusCode();
  51040.                     throw new ApiException(
  51041.                         sprintf(
  51042.                             '[%d] Error connecting to the API (%s)',
  51043.                             $statusCode,
  51044.                             $exception->getRequest()->getUri()
  51045.                         ),
  51046.                         $statusCode,
  51047.                         $response->getHeaders(),
  51048.                         $response->getBody()
  51049.                     );
  51050.                 }
  51051.             );
  51052.     }
  51053.     /**
  51054.      * Create request for operation 'getUsers'
  51055.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  51056.      * @param  \DateTime $if_modified_since Only records created or modified since this timestamp will be returned (optional)
  51057.      * @param  string $where Filter by an any element (optional)
  51058.      * @param  string $order Order by an any element (optional)
  51059.      * @throws \InvalidArgumentException
  51060.      * @return \GuzzleHttp\Psr7\Request  */
  51061.     protected function getUsersRequest($xero_tenant_id$if_modified_since null$where null$order null)
  51062.     {
  51063.         // verify the required parameter 'xero_tenant_id' is set
  51064.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  51065.             throw new \InvalidArgumentException(
  51066.                 'Missing the required parameter $xero_tenant_id when calling getUsers'
  51067.             );
  51068.         }
  51069.         $resourcePath '/Users';
  51070.         $formParams = [];
  51071.         $queryParams = [];
  51072.         $headerParams = [];
  51073.         $httpBody '';
  51074.         $multipart false;
  51075.         // query params
  51076.         if ($where !== null) {
  51077.             $queryParams['where'] = AccountingObjectSerializer::toQueryValue($where);
  51078.         }
  51079.         // query params
  51080.         if ($order !== null) {
  51081.             $queryParams['order'] = AccountingObjectSerializer::toQueryValue($order);
  51082.         }
  51083.         // header params
  51084.         if ($xero_tenant_id !== null) {
  51085.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  51086.         }
  51087.         // header params
  51088.         if ($if_modified_since !== null) {
  51089.             $headerParams['If-Modified-Since'] = AccountingObjectSerializer::toHeaderValue($if_modified_since);
  51090.         }
  51091.         // body params
  51092.         $_tempBody null;
  51093.         if ($multipart) {
  51094.             $headers $this->headerSelector->selectHeadersForMultipart(
  51095.                 ['application/json']
  51096.             );
  51097.         } else {
  51098.             $headers $this->headerSelector->selectHeaders(
  51099.                 ['application/json'],
  51100.                 []
  51101.             );
  51102.         }
  51103.         // for model (json/xml)
  51104.         if (isset($_tempBody)) {
  51105.             // $_tempBody is the method argument, if present
  51106.             if ($headers['Content-Type'] === 'application/json') {
  51107.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  51108.             } else {
  51109.                 $httpBody $_tempBody;
  51110.             }
  51111.         } elseif (count($formParams) > 0) {
  51112.             if ($multipart) {
  51113.                 $multipartContents = [
  51114.                     [
  51115.                         'Content-type' => 'multipart/form-data',
  51116.                     ]
  51117.                 ];
  51118.                 
  51119.                 // for HTTP post (form)
  51120.                 $httpBody = new MultipartStream($multipartContents);
  51121.             } elseif ($headers['Content-Type'] === 'application/json') {
  51122.                 $httpBody \GuzzleHttp\json_encode($formParams);
  51123.             } else {
  51124.                 // for HTTP post (form)
  51125.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  51126.             }
  51127.         }
  51128.         // this endpoint requires OAuth (access token)
  51129.         if ($this->config->getAccessToken() !== null) {
  51130.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  51131.         }
  51132.         $defaultHeaders = [];
  51133.         if ($this->config->getUserAgent()) {
  51134.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  51135.         }
  51136.         $headers array_merge(
  51137.             $defaultHeaders,
  51138.             $headerParams,
  51139.             $headers
  51140.         );
  51141.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  51142.         return new Request(
  51143.             'GET',
  51144.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  51145.             $headers,
  51146.             $httpBody
  51147.         );
  51148.     }
  51149.     /**
  51150.      * Operation postSetup
  51151.      * Sets the chart of accounts, the conversion date and conversion balances
  51152.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  51153.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Setup $setup Object including an accounts array, a conversion balances array and a conversion date object in body of request (required)
  51154.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  51155.      * @throws \InvalidArgumentException
  51156.      * @return \XeroAPI\XeroPHP\Models\Accounting\ImportSummaryObject
  51157.      */
  51158.     public function postSetup($xero_tenant_id$setup)
  51159.     {
  51160.         list($response) = $this->postSetupWithHttpInfo($xero_tenant_id$setup);
  51161.         return $response;
  51162.     }
  51163.     /**
  51164.      * Operation postSetupWithHttpInfo
  51165.      * Sets the chart of accounts, the conversion date and conversion balances
  51166.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  51167.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Setup $setup Object including an accounts array, a conversion balances array and a conversion date object in body of request (required)
  51168.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  51169.      * @throws \InvalidArgumentException
  51170.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\ImportSummaryObject, HTTP status code, HTTP response headers (array of strings)
  51171.      */
  51172.     public function postSetupWithHttpInfo($xero_tenant_id$setup)
  51173.     {
  51174.         $request $this->postSetupRequest($xero_tenant_id$setup);
  51175.         try {
  51176.             $options $this->createHttpClientOption();
  51177.             try {
  51178.                 $response $this->client->send($request$options);
  51179.             } catch (RequestException $e) {
  51180.                 throw new ApiException(
  51181.                     "[{$e->getCode()}{$e->getMessage()}",
  51182.                     $e->getCode(),
  51183.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  51184.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  51185.                 );
  51186.             }
  51187.             $statusCode $response->getStatusCode();
  51188.             if ($statusCode 200 || $statusCode 299) {
  51189.                 throw new ApiException(
  51190.                     sprintf(
  51191.                         '[%d] Error connecting to the API (%s)',
  51192.                         $statusCode,
  51193.                         $request->getUri()
  51194.                     ),
  51195.                     $statusCode,
  51196.                     $response->getHeaders(),
  51197.                     $response->getBody()
  51198.                 );
  51199.             }
  51200.             $responseBody $response->getBody();
  51201.             switch($statusCode) {
  51202.                 case 200:
  51203.                     if ('\XeroAPI\XeroPHP\Models\Accounting\ImportSummaryObject' === '\SplFileObject') {
  51204.                         $content $responseBody//stream goes to serializer
  51205.                     } else {
  51206.                         $content $responseBody->getContents();
  51207.                     }
  51208.                     return [
  51209.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\ImportSummaryObject', []),
  51210.                         $response->getStatusCode(),
  51211.                         $response->getHeaders()
  51212.                     ];
  51213.             }
  51214.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\ImportSummaryObject';
  51215.             $responseBody $response->getBody();
  51216.             if ($returnType === '\SplFileObject') {
  51217.                 $content $responseBody//stream goes to serializer
  51218.             } else {
  51219.                 $content $responseBody->getContents();
  51220.             }
  51221.             return [
  51222.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  51223.                 $response->getStatusCode(),
  51224.                 $response->getHeaders()
  51225.             ];
  51226.         } catch (ApiException $e) {
  51227.             switch ($e->getCode()) {
  51228.                 case 200:
  51229.                     $data AccountingObjectSerializer::deserialize(
  51230.                         $e->getResponseBody(),
  51231.                         '\XeroAPI\XeroPHP\Models\Accounting\ImportSummaryObject',
  51232.                         $e->getResponseHeaders()
  51233.                     );
  51234.                     $e->setResponseObject($data);
  51235.                     break;
  51236.             }
  51237.             throw $e;
  51238.         }
  51239.     }
  51240.     /**
  51241.      * Operation postSetupAsync
  51242.      * Sets the chart of accounts, the conversion date and conversion balances
  51243.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  51244.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Setup $setup Object including an accounts array, a conversion balances array and a conversion date object in body of request (required)
  51245.      * @throws \InvalidArgumentException
  51246.      * @return \GuzzleHttp\Promise\PromiseInterface
  51247.      */
  51248.     public function postSetupAsync($xero_tenant_id$setup)
  51249.     {
  51250.         return $this->postSetupAsyncWithHttpInfo($xero_tenant_id$setup)
  51251.             ->then(
  51252.                 function ($response) {
  51253.                     return $response[0];
  51254.                 }
  51255.             );
  51256.     }
  51257.     /**
  51258.      * Operation postSetupAsyncWithHttpInfo
  51259.      * Sets the chart of accounts, the conversion date and conversion balances
  51260.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  51261.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Setup $setup Object including an accounts array, a conversion balances array and a conversion date object in body of request (required)
  51262.      * @throws \InvalidArgumentException
  51263.      * @return \GuzzleHttp\Promise\PromiseInterface */
  51264.     public function postSetupAsyncWithHttpInfo($xero_tenant_id$setup)
  51265.     {
  51266.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\ImportSummaryObject';
  51267.         $request $this->postSetupRequest($xero_tenant_id$setup);
  51268.         return $this->client
  51269.             ->sendAsync($request$this->createHttpClientOption())
  51270.             ->then(
  51271.                 function ($response) use ($returnType) {
  51272.                     $responseBody $response->getBody();
  51273.                     if ($returnType === '\SplFileObject') {
  51274.                         $content $responseBody//stream goes to serializer
  51275.                     } else {
  51276.                         $content $responseBody->getContents();
  51277.                     }
  51278.                     return [
  51279.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  51280.                         $response->getStatusCode(),
  51281.                         $response->getHeaders()
  51282.                     ];
  51283.                 },
  51284.                 function ($exception) {
  51285.                     $response $exception->getResponse();
  51286.                     $statusCode $response->getStatusCode();
  51287.                     throw new ApiException(
  51288.                         sprintf(
  51289.                             '[%d] Error connecting to the API (%s)',
  51290.                             $statusCode,
  51291.                             $exception->getRequest()->getUri()
  51292.                         ),
  51293.                         $statusCode,
  51294.                         $response->getHeaders(),
  51295.                         $response->getBody()
  51296.                     );
  51297.                 }
  51298.             );
  51299.     }
  51300.     /**
  51301.      * Create request for operation 'postSetup'
  51302.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  51303.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Setup $setup Object including an accounts array, a conversion balances array and a conversion date object in body of request (required)
  51304.      * @throws \InvalidArgumentException
  51305.      * @return \GuzzleHttp\Psr7\Request  */
  51306.     protected function postSetupRequest($xero_tenant_id$setup)
  51307.     {
  51308.         // verify the required parameter 'xero_tenant_id' is set
  51309.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  51310.             throw new \InvalidArgumentException(
  51311.                 'Missing the required parameter $xero_tenant_id when calling postSetup'
  51312.             );
  51313.         }
  51314.         // verify the required parameter 'setup' is set
  51315.         if ($setup === null || (is_array($setup) && count($setup) === 0)) {
  51316.             throw new \InvalidArgumentException(
  51317.                 'Missing the required parameter $setup when calling postSetup'
  51318.             );
  51319.         }
  51320.         $resourcePath '/Setup';
  51321.         $formParams = [];
  51322.         $queryParams = [];
  51323.         $headerParams = [];
  51324.         $httpBody '';
  51325.         $multipart false;
  51326.         // header params
  51327.         if ($xero_tenant_id !== null) {
  51328.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  51329.         }
  51330.         // body params
  51331.         $_tempBody null;
  51332.         if (isset($setup)) {
  51333.             $_tempBody $setup;
  51334.         }
  51335.         if ($multipart) {
  51336.             $headers $this->headerSelector->selectHeadersForMultipart(
  51337.                 ['application/json']
  51338.             );
  51339.         } else {
  51340.             $headers $this->headerSelector->selectHeaders(
  51341.                 ['application/json'],
  51342.                 ['application/json']
  51343.             );
  51344.         }
  51345.         // for model (json/xml)
  51346.         if (isset($_tempBody)) {
  51347.             // $_tempBody is the method argument, if present
  51348.             if ($headers['Content-Type'] === 'application/json') {
  51349.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  51350.             } else {
  51351.                 $httpBody $_tempBody;
  51352.             }
  51353.         } elseif (count($formParams) > 0) {
  51354.             if ($multipart) {
  51355.                 $multipartContents = [
  51356.                     [
  51357.                         'Content-type' => 'multipart/form-data',
  51358.                     ]
  51359.                 ];
  51360.                 
  51361.                 // for HTTP post (form)
  51362.                 $httpBody = new MultipartStream($multipartContents);
  51363.             } elseif ($headers['Content-Type'] === 'application/json') {
  51364.                 $httpBody \GuzzleHttp\json_encode($formParams);
  51365.             } else {
  51366.                 // for HTTP post (form)
  51367.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  51368.             }
  51369.         }
  51370.         // this endpoint requires OAuth (access token)
  51371.         if ($this->config->getAccessToken() !== null) {
  51372.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  51373.         }
  51374.         $defaultHeaders = [];
  51375.         if ($this->config->getUserAgent()) {
  51376.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  51377.         }
  51378.         $headers array_merge(
  51379.             $defaultHeaders,
  51380.             $headerParams,
  51381.             $headers
  51382.         );
  51383.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  51384.         return new Request(
  51385.             'POST',
  51386.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  51387.             $headers,
  51388.             $httpBody
  51389.         );
  51390.     }
  51391.     /**
  51392.      * Operation updateAccount
  51393.      * Updates a chart of accounts
  51394.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  51395.      * @param  string $account_id Unique identifier for Account object (required)
  51396.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Accounts $accounts Request of type Accounts array with one Account (required)
  51397.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  51398.      * @throws \InvalidArgumentException
  51399.      * @return \XeroAPI\XeroPHP\Models\Accounting\Accounts|\XeroAPI\XeroPHP\Models\Accounting\Error
  51400.      */
  51401.     public function updateAccount($xero_tenant_id$account_id$accounts)
  51402.     {
  51403.         list($response) = $this->updateAccountWithHttpInfo($xero_tenant_id$account_id$accounts);
  51404.         return $response;
  51405.     }
  51406.     /**
  51407.      * Operation updateAccountWithHttpInfo
  51408.      * Updates a chart of accounts
  51409.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  51410.      * @param  string $account_id Unique identifier for Account object (required)
  51411.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Accounts $accounts Request of type Accounts array with one Account (required)
  51412.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  51413.      * @throws \InvalidArgumentException
  51414.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Accounts|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  51415.      */
  51416.     public function updateAccountWithHttpInfo($xero_tenant_id$account_id$accounts)
  51417.     {
  51418.         $request $this->updateAccountRequest($xero_tenant_id$account_id$accounts);
  51419.         try {
  51420.             $options $this->createHttpClientOption();
  51421.             try {
  51422.                 $response $this->client->send($request$options);
  51423.             } catch (RequestException $e) {
  51424.                 throw new ApiException(
  51425.                     "[{$e->getCode()}{$e->getMessage()}",
  51426.                     $e->getCode(),
  51427.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  51428.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  51429.                 );
  51430.             }
  51431.             $statusCode $response->getStatusCode();
  51432.             if ($statusCode 200 || $statusCode 299) {
  51433.                 throw new ApiException(
  51434.                     sprintf(
  51435.                         '[%d] Error connecting to the API (%s)',
  51436.                         $statusCode,
  51437.                         $request->getUri()
  51438.                     ),
  51439.                     $statusCode,
  51440.                     $response->getHeaders(),
  51441.                     $response->getBody()
  51442.                 );
  51443.             }
  51444.             $responseBody $response->getBody();
  51445.             switch($statusCode) {
  51446.                 case 200:
  51447.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Accounts' === '\SplFileObject') {
  51448.                         $content $responseBody//stream goes to serializer
  51449.                     } else {
  51450.                         $content $responseBody->getContents();
  51451.                     }
  51452.                     return [
  51453.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Accounts', []),
  51454.                         $response->getStatusCode(),
  51455.                         $response->getHeaders()
  51456.                     ];
  51457.                 case 400:
  51458.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  51459.                         $content $responseBody//stream goes to serializer
  51460.                     } else {
  51461.                         $content $responseBody->getContents();
  51462.                     }
  51463.                     return [
  51464.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  51465.                         $response->getStatusCode(),
  51466.                         $response->getHeaders()
  51467.                     ];
  51468.             }
  51469.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Accounts';
  51470.             $responseBody $response->getBody();
  51471.             if ($returnType === '\SplFileObject') {
  51472.                 $content $responseBody//stream goes to serializer
  51473.             } else {
  51474.                 $content $responseBody->getContents();
  51475.             }
  51476.             return [
  51477.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  51478.                 $response->getStatusCode(),
  51479.                 $response->getHeaders()
  51480.             ];
  51481.         } catch (ApiException $e) {
  51482.             switch ($e->getCode()) {
  51483.                 case 200:
  51484.                     $data AccountingObjectSerializer::deserialize(
  51485.                         $e->getResponseBody(),
  51486.                         '\XeroAPI\XeroPHP\Models\Accounting\Accounts',
  51487.                         $e->getResponseHeaders()
  51488.                     );
  51489.                     $e->setResponseObject($data);
  51490.                     break;
  51491.                 case 400:
  51492.                     $data AccountingObjectSerializer::deserialize(
  51493.                         $e->getResponseBody(),
  51494.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  51495.                         $e->getResponseHeaders()
  51496.                     );
  51497.                     $e->setResponseObject($data);
  51498.                     break;
  51499.             }
  51500.             throw $e;
  51501.         }
  51502.     }
  51503.     /**
  51504.      * Operation updateAccountAsync
  51505.      * Updates a chart of accounts
  51506.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  51507.      * @param  string $account_id Unique identifier for Account object (required)
  51508.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Accounts $accounts Request of type Accounts array with one Account (required)
  51509.      * @throws \InvalidArgumentException
  51510.      * @return \GuzzleHttp\Promise\PromiseInterface
  51511.      */
  51512.     public function updateAccountAsync($xero_tenant_id$account_id$accounts)
  51513.     {
  51514.         return $this->updateAccountAsyncWithHttpInfo($xero_tenant_id$account_id$accounts)
  51515.             ->then(
  51516.                 function ($response) {
  51517.                     return $response[0];
  51518.                 }
  51519.             );
  51520.     }
  51521.     /**
  51522.      * Operation updateAccountAsyncWithHttpInfo
  51523.      * Updates a chart of accounts
  51524.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  51525.      * @param  string $account_id Unique identifier for Account object (required)
  51526.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Accounts $accounts Request of type Accounts array with one Account (required)
  51527.      * @throws \InvalidArgumentException
  51528.      * @return \GuzzleHttp\Promise\PromiseInterface */
  51529.     public function updateAccountAsyncWithHttpInfo($xero_tenant_id$account_id$accounts)
  51530.     {
  51531.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Accounts';
  51532.         $request $this->updateAccountRequest($xero_tenant_id$account_id$accounts);
  51533.         return $this->client
  51534.             ->sendAsync($request$this->createHttpClientOption())
  51535.             ->then(
  51536.                 function ($response) use ($returnType) {
  51537.                     $responseBody $response->getBody();
  51538.                     if ($returnType === '\SplFileObject') {
  51539.                         $content $responseBody//stream goes to serializer
  51540.                     } else {
  51541.                         $content $responseBody->getContents();
  51542.                     }
  51543.                     return [
  51544.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  51545.                         $response->getStatusCode(),
  51546.                         $response->getHeaders()
  51547.                     ];
  51548.                 },
  51549.                 function ($exception) {
  51550.                     $response $exception->getResponse();
  51551.                     $statusCode $response->getStatusCode();
  51552.                     throw new ApiException(
  51553.                         sprintf(
  51554.                             '[%d] Error connecting to the API (%s)',
  51555.                             $statusCode,
  51556.                             $exception->getRequest()->getUri()
  51557.                         ),
  51558.                         $statusCode,
  51559.                         $response->getHeaders(),
  51560.                         $response->getBody()
  51561.                     );
  51562.                 }
  51563.             );
  51564.     }
  51565.     /**
  51566.      * Create request for operation 'updateAccount'
  51567.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  51568.      * @param  string $account_id Unique identifier for Account object (required)
  51569.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Accounts $accounts Request of type Accounts array with one Account (required)
  51570.      * @throws \InvalidArgumentException
  51571.      * @return \GuzzleHttp\Psr7\Request  */
  51572.     protected function updateAccountRequest($xero_tenant_id$account_id$accounts)
  51573.     {
  51574.         // verify the required parameter 'xero_tenant_id' is set
  51575.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  51576.             throw new \InvalidArgumentException(
  51577.                 'Missing the required parameter $xero_tenant_id when calling updateAccount'
  51578.             );
  51579.         }
  51580.         // verify the required parameter 'account_id' is set
  51581.         if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
  51582.             throw new \InvalidArgumentException(
  51583.                 'Missing the required parameter $account_id when calling updateAccount'
  51584.             );
  51585.         }
  51586.         // verify the required parameter 'accounts' is set
  51587.         if ($accounts === null || (is_array($accounts) && count($accounts) === 0)) {
  51588.             throw new \InvalidArgumentException(
  51589.                 'Missing the required parameter $accounts when calling updateAccount'
  51590.             );
  51591.         }
  51592.         $resourcePath '/Accounts/{AccountID}';
  51593.         $formParams = [];
  51594.         $queryParams = [];
  51595.         $headerParams = [];
  51596.         $httpBody '';
  51597.         $multipart false;
  51598.         // header params
  51599.         if ($xero_tenant_id !== null) {
  51600.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  51601.         }
  51602.         // path params
  51603.         if ($account_id !== null) {
  51604.             $resourcePath str_replace(
  51605.                 '{' 'AccountID' '}',
  51606.                 AccountingObjectSerializer::toPathValue($account_id),
  51607.                 $resourcePath
  51608.             );
  51609.         }
  51610.         // body params
  51611.         $_tempBody null;
  51612.         if (isset($accounts)) {
  51613.             $_tempBody $accounts;
  51614.         }
  51615.         if ($multipart) {
  51616.             $headers $this->headerSelector->selectHeadersForMultipart(
  51617.                 ['application/json']
  51618.             );
  51619.         } else {
  51620.             $headers $this->headerSelector->selectHeaders(
  51621.                 ['application/json'],
  51622.                 ['application/json']
  51623.             );
  51624.         }
  51625.         // for model (json/xml)
  51626.         if (isset($_tempBody)) {
  51627.             // $_tempBody is the method argument, if present
  51628.             if ($headers['Content-Type'] === 'application/json') {
  51629.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  51630.             } else {
  51631.                 $httpBody $_tempBody;
  51632.             }
  51633.         } elseif (count($formParams) > 0) {
  51634.             if ($multipart) {
  51635.                 $multipartContents = [
  51636.                     [
  51637.                         'Content-type' => 'multipart/form-data',
  51638.                     ]
  51639.                 ];
  51640.                 
  51641.                 // for HTTP post (form)
  51642.                 $httpBody = new MultipartStream($multipartContents);
  51643.             } elseif ($headers['Content-Type'] === 'application/json') {
  51644.                 $httpBody \GuzzleHttp\json_encode($formParams);
  51645.             } else {
  51646.                 // for HTTP post (form)
  51647.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  51648.             }
  51649.         }
  51650.         // this endpoint requires OAuth (access token)
  51651.         if ($this->config->getAccessToken() !== null) {
  51652.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  51653.         }
  51654.         $defaultHeaders = [];
  51655.         if ($this->config->getUserAgent()) {
  51656.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  51657.         }
  51658.         $headers array_merge(
  51659.             $defaultHeaders,
  51660.             $headerParams,
  51661.             $headers
  51662.         );
  51663.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  51664.         return new Request(
  51665.             'POST',
  51666.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  51667.             $headers,
  51668.             $httpBody
  51669.         );
  51670.     }
  51671.     /**
  51672.      * Operation updateAccountAttachmentByFileName
  51673.      * Updates attachment on a specific account by filename
  51674.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  51675.      * @param  string $account_id Unique identifier for Account object (required)
  51676.      * @param  string $file_name Name of the attachment (required)
  51677.      * @param  string $body Byte array of file in body of request (required)
  51678.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  51679.      * @throws \InvalidArgumentException
  51680.      * @return \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error
  51681.      */
  51682.     public function updateAccountAttachmentByFileName($xero_tenant_id$account_id$file_name$body)
  51683.     {
  51684.         list($response) = $this->updateAccountAttachmentByFileNameWithHttpInfo($xero_tenant_id$account_id$file_name$body);
  51685.         return $response;
  51686.     }
  51687.     /**
  51688.      * Operation updateAccountAttachmentByFileNameWithHttpInfo
  51689.      * Updates attachment on a specific account by filename
  51690.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  51691.      * @param  string $account_id Unique identifier for Account object (required)
  51692.      * @param  string $file_name Name of the attachment (required)
  51693.      * @param  string $body Byte array of file in body of request (required)
  51694.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  51695.      * @throws \InvalidArgumentException
  51696.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  51697.      */
  51698.     public function updateAccountAttachmentByFileNameWithHttpInfo($xero_tenant_id$account_id$file_name$body)
  51699.     {
  51700.         $request $this->updateAccountAttachmentByFileNameRequest($xero_tenant_id$account_id$file_name$body);
  51701.         try {
  51702.             $options $this->createHttpClientOption();
  51703.             try {
  51704.                 $response $this->client->send($request$options);
  51705.             } catch (RequestException $e) {
  51706.                 throw new ApiException(
  51707.                     "[{$e->getCode()}{$e->getMessage()}",
  51708.                     $e->getCode(),
  51709.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  51710.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  51711.                 );
  51712.             }
  51713.             $statusCode $response->getStatusCode();
  51714.             if ($statusCode 200 || $statusCode 299) {
  51715.                 throw new ApiException(
  51716.                     sprintf(
  51717.                         '[%d] Error connecting to the API (%s)',
  51718.                         $statusCode,
  51719.                         $request->getUri()
  51720.                     ),
  51721.                     $statusCode,
  51722.                     $response->getHeaders(),
  51723.                     $response->getBody()
  51724.                 );
  51725.             }
  51726.             $responseBody $response->getBody();
  51727.             switch($statusCode) {
  51728.                 case 200:
  51729.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Attachments' === '\SplFileObject') {
  51730.                         $content $responseBody//stream goes to serializer
  51731.                     } else {
  51732.                         $content $responseBody->getContents();
  51733.                     }
  51734.                     return [
  51735.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Attachments', []),
  51736.                         $response->getStatusCode(),
  51737.                         $response->getHeaders()
  51738.                     ];
  51739.                 case 400:
  51740.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  51741.                         $content $responseBody//stream goes to serializer
  51742.                     } else {
  51743.                         $content $responseBody->getContents();
  51744.                     }
  51745.                     return [
  51746.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  51747.                         $response->getStatusCode(),
  51748.                         $response->getHeaders()
  51749.                     ];
  51750.             }
  51751.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  51752.             $responseBody $response->getBody();
  51753.             if ($returnType === '\SplFileObject') {
  51754.                 $content $responseBody//stream goes to serializer
  51755.             } else {
  51756.                 $content $responseBody->getContents();
  51757.             }
  51758.             return [
  51759.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  51760.                 $response->getStatusCode(),
  51761.                 $response->getHeaders()
  51762.             ];
  51763.         } catch (ApiException $e) {
  51764.             switch ($e->getCode()) {
  51765.                 case 200:
  51766.                     $data AccountingObjectSerializer::deserialize(
  51767.                         $e->getResponseBody(),
  51768.                         '\XeroAPI\XeroPHP\Models\Accounting\Attachments',
  51769.                         $e->getResponseHeaders()
  51770.                     );
  51771.                     $e->setResponseObject($data);
  51772.                     break;
  51773.                 case 400:
  51774.                     $data AccountingObjectSerializer::deserialize(
  51775.                         $e->getResponseBody(),
  51776.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  51777.                         $e->getResponseHeaders()
  51778.                     );
  51779.                     $e->setResponseObject($data);
  51780.                     break;
  51781.             }
  51782.             throw $e;
  51783.         }
  51784.     }
  51785.     /**
  51786.      * Operation updateAccountAttachmentByFileNameAsync
  51787.      * Updates attachment on a specific account by filename
  51788.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  51789.      * @param  string $account_id Unique identifier for Account object (required)
  51790.      * @param  string $file_name Name of the attachment (required)
  51791.      * @param  string $body Byte array of file in body of request (required)
  51792.      * @throws \InvalidArgumentException
  51793.      * @return \GuzzleHttp\Promise\PromiseInterface
  51794.      */
  51795.     public function updateAccountAttachmentByFileNameAsync($xero_tenant_id$account_id$file_name$body)
  51796.     {
  51797.         return $this->updateAccountAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$account_id$file_name$body)
  51798.             ->then(
  51799.                 function ($response) {
  51800.                     return $response[0];
  51801.                 }
  51802.             );
  51803.     }
  51804.     /**
  51805.      * Operation updateAccountAttachmentByFileNameAsyncWithHttpInfo
  51806.      * Updates attachment on a specific account by filename
  51807.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  51808.      * @param  string $account_id Unique identifier for Account object (required)
  51809.      * @param  string $file_name Name of the attachment (required)
  51810.      * @param  string $body Byte array of file in body of request (required)
  51811.      * @throws \InvalidArgumentException
  51812.      * @return \GuzzleHttp\Promise\PromiseInterface */
  51813.     public function updateAccountAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$account_id$file_name$body)
  51814.     {
  51815.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  51816.         $request $this->updateAccountAttachmentByFileNameRequest($xero_tenant_id$account_id$file_name$body);
  51817.         return $this->client
  51818.             ->sendAsync($request$this->createHttpClientOption())
  51819.             ->then(
  51820.                 function ($response) use ($returnType) {
  51821.                     $responseBody $response->getBody();
  51822.                     if ($returnType === '\SplFileObject') {
  51823.                         $content $responseBody//stream goes to serializer
  51824.                     } else {
  51825.                         $content $responseBody->getContents();
  51826.                     }
  51827.                     return [
  51828.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  51829.                         $response->getStatusCode(),
  51830.                         $response->getHeaders()
  51831.                     ];
  51832.                 },
  51833.                 function ($exception) {
  51834.                     $response $exception->getResponse();
  51835.                     $statusCode $response->getStatusCode();
  51836.                     throw new ApiException(
  51837.                         sprintf(
  51838.                             '[%d] Error connecting to the API (%s)',
  51839.                             $statusCode,
  51840.                             $exception->getRequest()->getUri()
  51841.                         ),
  51842.                         $statusCode,
  51843.                         $response->getHeaders(),
  51844.                         $response->getBody()
  51845.                     );
  51846.                 }
  51847.             );
  51848.     }
  51849.     /**
  51850.      * Create request for operation 'updateAccountAttachmentByFileName'
  51851.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  51852.      * @param  string $account_id Unique identifier for Account object (required)
  51853.      * @param  string $file_name Name of the attachment (required)
  51854.      * @param  string $body Byte array of file in body of request (required)
  51855.      * @throws \InvalidArgumentException
  51856.      * @return \GuzzleHttp\Psr7\Request  */
  51857.     protected function updateAccountAttachmentByFileNameRequest($xero_tenant_id$account_id$file_name$body)
  51858.     {
  51859.         // verify the required parameter 'xero_tenant_id' is set
  51860.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  51861.             throw new \InvalidArgumentException(
  51862.                 'Missing the required parameter $xero_tenant_id when calling updateAccountAttachmentByFileName'
  51863.             );
  51864.         }
  51865.         // verify the required parameter 'account_id' is set
  51866.         if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
  51867.             throw new \InvalidArgumentException(
  51868.                 'Missing the required parameter $account_id when calling updateAccountAttachmentByFileName'
  51869.             );
  51870.         }
  51871.         // verify the required parameter 'file_name' is set
  51872.         if ($file_name === null || (is_array($file_name) && count($file_name) === 0)) {
  51873.             throw new \InvalidArgumentException(
  51874.                 'Missing the required parameter $file_name when calling updateAccountAttachmentByFileName'
  51875.             );
  51876.         }
  51877.         // verify the required parameter 'body' is set
  51878.         if ($body === null || (is_array($body) && count($body) === 0)) {
  51879.             throw new \InvalidArgumentException(
  51880.                 'Missing the required parameter $body when calling updateAccountAttachmentByFileName'
  51881.             );
  51882.         }
  51883.         $resourcePath '/Accounts/{AccountID}/Attachments/{FileName}';
  51884.         $formParams = [];
  51885.         $queryParams = [];
  51886.         $headerParams = [];
  51887.         $httpBody '';
  51888.         $multipart false;
  51889.         // header params
  51890.         if ($xero_tenant_id !== null) {
  51891.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  51892.         }
  51893.         // path params
  51894.         if ($account_id !== null) {
  51895.             $resourcePath str_replace(
  51896.                 '{' 'AccountID' '}',
  51897.                 AccountingObjectSerializer::toPathValue($account_id),
  51898.                 $resourcePath
  51899.             );
  51900.         }
  51901.         // path params
  51902.         if ($file_name !== null) {
  51903.             $resourcePath str_replace(
  51904.                 '{' 'FileName' '}',
  51905.                 AccountingObjectSerializer::toPathValue($file_name),
  51906.                 $resourcePath
  51907.             );
  51908.         }
  51909.         // body params
  51910.         $_tempBody null;
  51911.         if (isset($body)) {
  51912.             $_tempBody $body;
  51913.         }
  51914.         if ($multipart) {
  51915.             $headers $this->headerSelector->selectHeadersForMultipart(
  51916.                 ['application/json']
  51917.             );
  51918.         } else {
  51919.             $headers $this->headerSelector->selectHeaders(
  51920.                 ['application/json'],
  51921.                 ['application/octet-stream']
  51922.             );
  51923.         }
  51924.         // for model (json/xml)
  51925.         if (isset($_tempBody)) {
  51926.             // $_tempBody is the method argument, if present
  51927.             if ($headers['Content-Type'] === 'application/json') {
  51928.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  51929.             } else {
  51930.                 $httpBody $_tempBody;
  51931.             }
  51932.         } elseif (count($formParams) > 0) {
  51933.             if ($multipart) {
  51934.                 $multipartContents = [
  51935.                     [
  51936.                         'Content-type' => 'multipart/form-data',
  51937.                     ]
  51938.                 ];
  51939.                 
  51940.                 // for HTTP post (form)
  51941.                 $httpBody = new MultipartStream($multipartContents);
  51942.             } elseif ($headers['Content-Type'] === 'application/json') {
  51943.                 $httpBody \GuzzleHttp\json_encode($formParams);
  51944.             } else {
  51945.                 // for HTTP post (form)
  51946.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  51947.             }
  51948.         }
  51949.         // this endpoint requires OAuth (access token)
  51950.         if ($this->config->getAccessToken() !== null) {
  51951.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  51952.         }
  51953.         $defaultHeaders = [];
  51954.         if ($this->config->getUserAgent()) {
  51955.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  51956.         }
  51957.         $headers array_merge(
  51958.             $defaultHeaders,
  51959.             $headerParams,
  51960.             $headers
  51961.         );
  51962.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  51963.         return new Request(
  51964.             'POST',
  51965.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  51966.             $headers,
  51967.             $httpBody
  51968.         );
  51969.     }
  51970.     /**
  51971.      * Operation updateBankTransaction
  51972.      * Updates a single spent or received money transaction
  51973.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  51974.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  51975.      * @param  \XeroAPI\XeroPHP\Models\Accounting\BankTransactions $bank_transactions bank_transactions (required)
  51976.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  51977.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  51978.      * @throws \InvalidArgumentException
  51979.      * @return \XeroAPI\XeroPHP\Models\Accounting\BankTransactions|\XeroAPI\XeroPHP\Models\Accounting\Error
  51980.      */
  51981.     public function updateBankTransaction($xero_tenant_id$bank_transaction_id$bank_transactions$unitdp null)
  51982.     {
  51983.         list($response) = $this->updateBankTransactionWithHttpInfo($xero_tenant_id$bank_transaction_id$bank_transactions$unitdp);
  51984.         return $response;
  51985.     }
  51986.     /**
  51987.      * Operation updateBankTransactionWithHttpInfo
  51988.      * Updates a single spent or received money transaction
  51989.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  51990.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  51991.      * @param  \XeroAPI\XeroPHP\Models\Accounting\BankTransactions $bank_transactions (required)
  51992.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  51993.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  51994.      * @throws \InvalidArgumentException
  51995.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\BankTransactions|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  51996.      */
  51997.     public function updateBankTransactionWithHttpInfo($xero_tenant_id$bank_transaction_id$bank_transactions$unitdp null)
  51998.     {
  51999.         $request $this->updateBankTransactionRequest($xero_tenant_id$bank_transaction_id$bank_transactions$unitdp);
  52000.         try {
  52001.             $options $this->createHttpClientOption();
  52002.             try {
  52003.                 $response $this->client->send($request$options);
  52004.             } catch (RequestException $e) {
  52005.                 throw new ApiException(
  52006.                     "[{$e->getCode()}{$e->getMessage()}",
  52007.                     $e->getCode(),
  52008.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  52009.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  52010.                 );
  52011.             }
  52012.             $statusCode $response->getStatusCode();
  52013.             if ($statusCode 200 || $statusCode 299) {
  52014.                 throw new ApiException(
  52015.                     sprintf(
  52016.                         '[%d] Error connecting to the API (%s)',
  52017.                         $statusCode,
  52018.                         $request->getUri()
  52019.                     ),
  52020.                     $statusCode,
  52021.                     $response->getHeaders(),
  52022.                     $response->getBody()
  52023.                 );
  52024.             }
  52025.             $responseBody $response->getBody();
  52026.             switch($statusCode) {
  52027.                 case 200:
  52028.                     if ('\XeroAPI\XeroPHP\Models\Accounting\BankTransactions' === '\SplFileObject') {
  52029.                         $content $responseBody//stream goes to serializer
  52030.                     } else {
  52031.                         $content $responseBody->getContents();
  52032.                     }
  52033.                     return [
  52034.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\BankTransactions', []),
  52035.                         $response->getStatusCode(),
  52036.                         $response->getHeaders()
  52037.                     ];
  52038.                 case 400:
  52039.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  52040.                         $content $responseBody//stream goes to serializer
  52041.                     } else {
  52042.                         $content $responseBody->getContents();
  52043.                     }
  52044.                     return [
  52045.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  52046.                         $response->getStatusCode(),
  52047.                         $response->getHeaders()
  52048.                     ];
  52049.             }
  52050.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\BankTransactions';
  52051.             $responseBody $response->getBody();
  52052.             if ($returnType === '\SplFileObject') {
  52053.                 $content $responseBody//stream goes to serializer
  52054.             } else {
  52055.                 $content $responseBody->getContents();
  52056.             }
  52057.             return [
  52058.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  52059.                 $response->getStatusCode(),
  52060.                 $response->getHeaders()
  52061.             ];
  52062.         } catch (ApiException $e) {
  52063.             switch ($e->getCode()) {
  52064.                 case 200:
  52065.                     $data AccountingObjectSerializer::deserialize(
  52066.                         $e->getResponseBody(),
  52067.                         '\XeroAPI\XeroPHP\Models\Accounting\BankTransactions',
  52068.                         $e->getResponseHeaders()
  52069.                     );
  52070.                     $e->setResponseObject($data);
  52071.                     break;
  52072.                 case 400:
  52073.                     $data AccountingObjectSerializer::deserialize(
  52074.                         $e->getResponseBody(),
  52075.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  52076.                         $e->getResponseHeaders()
  52077.                     );
  52078.                     $e->setResponseObject($data);
  52079.                     break;
  52080.             }
  52081.             throw $e;
  52082.         }
  52083.     }
  52084.     /**
  52085.      * Operation updateBankTransactionAsync
  52086.      * Updates a single spent or received money transaction
  52087.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  52088.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  52089.      * @param  \XeroAPI\XeroPHP\Models\Accounting\BankTransactions $bank_transactions (required)
  52090.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  52091.      * @throws \InvalidArgumentException
  52092.      * @return \GuzzleHttp\Promise\PromiseInterface
  52093.      */
  52094.     public function updateBankTransactionAsync($xero_tenant_id$bank_transaction_id$bank_transactions$unitdp null)
  52095.     {
  52096.         return $this->updateBankTransactionAsyncWithHttpInfo($xero_tenant_id$bank_transaction_id$bank_transactions$unitdp)
  52097.             ->then(
  52098.                 function ($response) {
  52099.                     return $response[0];
  52100.                 }
  52101.             );
  52102.     }
  52103.     /**
  52104.      * Operation updateBankTransactionAsyncWithHttpInfo
  52105.      * Updates a single spent or received money transaction
  52106.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  52107.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  52108.      * @param  \XeroAPI\XeroPHP\Models\Accounting\BankTransactions $bank_transactions (required)
  52109.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  52110.      * @throws \InvalidArgumentException
  52111.      * @return \GuzzleHttp\Promise\PromiseInterface */
  52112.     public function updateBankTransactionAsyncWithHttpInfo($xero_tenant_id$bank_transaction_id$bank_transactions$unitdp null)
  52113.     {
  52114.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\BankTransactions';
  52115.         $request $this->updateBankTransactionRequest($xero_tenant_id$bank_transaction_id$bank_transactions$unitdp);
  52116.         return $this->client
  52117.             ->sendAsync($request$this->createHttpClientOption())
  52118.             ->then(
  52119.                 function ($response) use ($returnType) {
  52120.                     $responseBody $response->getBody();
  52121.                     if ($returnType === '\SplFileObject') {
  52122.                         $content $responseBody//stream goes to serializer
  52123.                     } else {
  52124.                         $content $responseBody->getContents();
  52125.                     }
  52126.                     return [
  52127.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  52128.                         $response->getStatusCode(),
  52129.                         $response->getHeaders()
  52130.                     ];
  52131.                 },
  52132.                 function ($exception) {
  52133.                     $response $exception->getResponse();
  52134.                     $statusCode $response->getStatusCode();
  52135.                     throw new ApiException(
  52136.                         sprintf(
  52137.                             '[%d] Error connecting to the API (%s)',
  52138.                             $statusCode,
  52139.                             $exception->getRequest()->getUri()
  52140.                         ),
  52141.                         $statusCode,
  52142.                         $response->getHeaders(),
  52143.                         $response->getBody()
  52144.                     );
  52145.                 }
  52146.             );
  52147.     }
  52148.     /**
  52149.      * Create request for operation 'updateBankTransaction'
  52150.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  52151.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  52152.      * @param  \XeroAPI\XeroPHP\Models\Accounting\BankTransactions $bank_transactions (required)
  52153.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  52154.      * @throws \InvalidArgumentException
  52155.      * @return \GuzzleHttp\Psr7\Request  */
  52156.     protected function updateBankTransactionRequest($xero_tenant_id$bank_transaction_id$bank_transactions$unitdp null)
  52157.     {
  52158.         // verify the required parameter 'xero_tenant_id' is set
  52159.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  52160.             throw new \InvalidArgumentException(
  52161.                 'Missing the required parameter $xero_tenant_id when calling updateBankTransaction'
  52162.             );
  52163.         }
  52164.         // verify the required parameter 'bank_transaction_id' is set
  52165.         if ($bank_transaction_id === null || (is_array($bank_transaction_id) && count($bank_transaction_id) === 0)) {
  52166.             throw new \InvalidArgumentException(
  52167.                 'Missing the required parameter $bank_transaction_id when calling updateBankTransaction'
  52168.             );
  52169.         }
  52170.         // verify the required parameter 'bank_transactions' is set
  52171.         if ($bank_transactions === null || (is_array($bank_transactions) && count($bank_transactions) === 0)) {
  52172.             throw new \InvalidArgumentException(
  52173.                 'Missing the required parameter $bank_transactions when calling updateBankTransaction'
  52174.             );
  52175.         }
  52176.         $resourcePath '/BankTransactions/{BankTransactionID}';
  52177.         $formParams = [];
  52178.         $queryParams = [];
  52179.         $headerParams = [];
  52180.         $httpBody '';
  52181.         $multipart false;
  52182.         // query params
  52183.         if ($unitdp !== null) {
  52184.             $queryParams['unitdp'] = AccountingObjectSerializer::toQueryValue($unitdp);
  52185.         }
  52186.         // header params
  52187.         if ($xero_tenant_id !== null) {
  52188.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  52189.         }
  52190.         // path params
  52191.         if ($bank_transaction_id !== null) {
  52192.             $resourcePath str_replace(
  52193.                 '{' 'BankTransactionID' '}',
  52194.                 AccountingObjectSerializer::toPathValue($bank_transaction_id),
  52195.                 $resourcePath
  52196.             );
  52197.         }
  52198.         // body params
  52199.         $_tempBody null;
  52200.         if (isset($bank_transactions)) {
  52201.             $_tempBody $bank_transactions;
  52202.         }
  52203.         if ($multipart) {
  52204.             $headers $this->headerSelector->selectHeadersForMultipart(
  52205.                 ['application/json']
  52206.             );
  52207.         } else {
  52208.             $headers $this->headerSelector->selectHeaders(
  52209.                 ['application/json'],
  52210.                 ['application/json']
  52211.             );
  52212.         }
  52213.         // for model (json/xml)
  52214.         if (isset($_tempBody)) {
  52215.             // $_tempBody is the method argument, if present
  52216.             if ($headers['Content-Type'] === 'application/json') {
  52217.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  52218.             } else {
  52219.                 $httpBody $_tempBody;
  52220.             }
  52221.         } elseif (count($formParams) > 0) {
  52222.             if ($multipart) {
  52223.                 $multipartContents = [
  52224.                     [
  52225.                         'Content-type' => 'multipart/form-data',
  52226.                     ]
  52227.                 ];
  52228.                 
  52229.                 // for HTTP post (form)
  52230.                 $httpBody = new MultipartStream($multipartContents);
  52231.             } elseif ($headers['Content-Type'] === 'application/json') {
  52232.                 $httpBody \GuzzleHttp\json_encode($formParams);
  52233.             } else {
  52234.                 // for HTTP post (form)
  52235.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  52236.             }
  52237.         }
  52238.         // this endpoint requires OAuth (access token)
  52239.         if ($this->config->getAccessToken() !== null) {
  52240.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  52241.         }
  52242.         $defaultHeaders = [];
  52243.         if ($this->config->getUserAgent()) {
  52244.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  52245.         }
  52246.         $headers array_merge(
  52247.             $defaultHeaders,
  52248.             $headerParams,
  52249.             $headers
  52250.         );
  52251.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  52252.         return new Request(
  52253.             'POST',
  52254.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  52255.             $headers,
  52256.             $httpBody
  52257.         );
  52258.     }
  52259.     /**
  52260.      * Operation updateBankTransactionAttachmentByFileName
  52261.      * Updates a specific attachment from a specific bank transaction by filename
  52262.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  52263.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  52264.      * @param  string $file_name Name of the attachment (required)
  52265.      * @param  string $body Byte array of file in body of request (required)
  52266.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  52267.      * @throws \InvalidArgumentException
  52268.      * @return \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error
  52269.      */
  52270.     public function updateBankTransactionAttachmentByFileName($xero_tenant_id$bank_transaction_id$file_name$body)
  52271.     {
  52272.         list($response) = $this->updateBankTransactionAttachmentByFileNameWithHttpInfo($xero_tenant_id$bank_transaction_id$file_name$body);
  52273.         return $response;
  52274.     }
  52275.     /**
  52276.      * Operation updateBankTransactionAttachmentByFileNameWithHttpInfo
  52277.      * Updates a specific attachment from a specific bank transaction by filename
  52278.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  52279.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  52280.      * @param  string $file_name Name of the attachment (required)
  52281.      * @param  string $body Byte array of file in body of request (required)
  52282.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  52283.      * @throws \InvalidArgumentException
  52284.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  52285.      */
  52286.     public function updateBankTransactionAttachmentByFileNameWithHttpInfo($xero_tenant_id$bank_transaction_id$file_name$body)
  52287.     {
  52288.         $request $this->updateBankTransactionAttachmentByFileNameRequest($xero_tenant_id$bank_transaction_id$file_name$body);
  52289.         try {
  52290.             $options $this->createHttpClientOption();
  52291.             try {
  52292.                 $response $this->client->send($request$options);
  52293.             } catch (RequestException $e) {
  52294.                 throw new ApiException(
  52295.                     "[{$e->getCode()}{$e->getMessage()}",
  52296.                     $e->getCode(),
  52297.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  52298.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  52299.                 );
  52300.             }
  52301.             $statusCode $response->getStatusCode();
  52302.             if ($statusCode 200 || $statusCode 299) {
  52303.                 throw new ApiException(
  52304.                     sprintf(
  52305.                         '[%d] Error connecting to the API (%s)',
  52306.                         $statusCode,
  52307.                         $request->getUri()
  52308.                     ),
  52309.                     $statusCode,
  52310.                     $response->getHeaders(),
  52311.                     $response->getBody()
  52312.                 );
  52313.             }
  52314.             $responseBody $response->getBody();
  52315.             switch($statusCode) {
  52316.                 case 200:
  52317.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Attachments' === '\SplFileObject') {
  52318.                         $content $responseBody//stream goes to serializer
  52319.                     } else {
  52320.                         $content $responseBody->getContents();
  52321.                     }
  52322.                     return [
  52323.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Attachments', []),
  52324.                         $response->getStatusCode(),
  52325.                         $response->getHeaders()
  52326.                     ];
  52327.                 case 400:
  52328.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  52329.                         $content $responseBody//stream goes to serializer
  52330.                     } else {
  52331.                         $content $responseBody->getContents();
  52332.                     }
  52333.                     return [
  52334.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  52335.                         $response->getStatusCode(),
  52336.                         $response->getHeaders()
  52337.                     ];
  52338.             }
  52339.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  52340.             $responseBody $response->getBody();
  52341.             if ($returnType === '\SplFileObject') {
  52342.                 $content $responseBody//stream goes to serializer
  52343.             } else {
  52344.                 $content $responseBody->getContents();
  52345.             }
  52346.             return [
  52347.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  52348.                 $response->getStatusCode(),
  52349.                 $response->getHeaders()
  52350.             ];
  52351.         } catch (ApiException $e) {
  52352.             switch ($e->getCode()) {
  52353.                 case 200:
  52354.                     $data AccountingObjectSerializer::deserialize(
  52355.                         $e->getResponseBody(),
  52356.                         '\XeroAPI\XeroPHP\Models\Accounting\Attachments',
  52357.                         $e->getResponseHeaders()
  52358.                     );
  52359.                     $e->setResponseObject($data);
  52360.                     break;
  52361.                 case 400:
  52362.                     $data AccountingObjectSerializer::deserialize(
  52363.                         $e->getResponseBody(),
  52364.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  52365.                         $e->getResponseHeaders()
  52366.                     );
  52367.                     $e->setResponseObject($data);
  52368.                     break;
  52369.             }
  52370.             throw $e;
  52371.         }
  52372.     }
  52373.     /**
  52374.      * Operation updateBankTransactionAttachmentByFileNameAsync
  52375.      * Updates a specific attachment from a specific bank transaction by filename
  52376.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  52377.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  52378.      * @param  string $file_name Name of the attachment (required)
  52379.      * @param  string $body Byte array of file in body of request (required)
  52380.      * @throws \InvalidArgumentException
  52381.      * @return \GuzzleHttp\Promise\PromiseInterface
  52382.      */
  52383.     public function updateBankTransactionAttachmentByFileNameAsync($xero_tenant_id$bank_transaction_id$file_name$body)
  52384.     {
  52385.         return $this->updateBankTransactionAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$bank_transaction_id$file_name$body)
  52386.             ->then(
  52387.                 function ($response) {
  52388.                     return $response[0];
  52389.                 }
  52390.             );
  52391.     }
  52392.     /**
  52393.      * Operation updateBankTransactionAttachmentByFileNameAsyncWithHttpInfo
  52394.      * Updates a specific attachment from a specific bank transaction by filename
  52395.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  52396.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  52397.      * @param  string $file_name Name of the attachment (required)
  52398.      * @param  string $body Byte array of file in body of request (required)
  52399.      * @throws \InvalidArgumentException
  52400.      * @return \GuzzleHttp\Promise\PromiseInterface */
  52401.     public function updateBankTransactionAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$bank_transaction_id$file_name$body)
  52402.     {
  52403.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  52404.         $request $this->updateBankTransactionAttachmentByFileNameRequest($xero_tenant_id$bank_transaction_id$file_name$body);
  52405.         return $this->client
  52406.             ->sendAsync($request$this->createHttpClientOption())
  52407.             ->then(
  52408.                 function ($response) use ($returnType) {
  52409.                     $responseBody $response->getBody();
  52410.                     if ($returnType === '\SplFileObject') {
  52411.                         $content $responseBody//stream goes to serializer
  52412.                     } else {
  52413.                         $content $responseBody->getContents();
  52414.                     }
  52415.                     return [
  52416.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  52417.                         $response->getStatusCode(),
  52418.                         $response->getHeaders()
  52419.                     ];
  52420.                 },
  52421.                 function ($exception) {
  52422.                     $response $exception->getResponse();
  52423.                     $statusCode $response->getStatusCode();
  52424.                     throw new ApiException(
  52425.                         sprintf(
  52426.                             '[%d] Error connecting to the API (%s)',
  52427.                             $statusCode,
  52428.                             $exception->getRequest()->getUri()
  52429.                         ),
  52430.                         $statusCode,
  52431.                         $response->getHeaders(),
  52432.                         $response->getBody()
  52433.                     );
  52434.                 }
  52435.             );
  52436.     }
  52437.     /**
  52438.      * Create request for operation 'updateBankTransactionAttachmentByFileName'
  52439.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  52440.      * @param  string $bank_transaction_id Xero generated unique identifier for a bank transaction (required)
  52441.      * @param  string $file_name Name of the attachment (required)
  52442.      * @param  string $body Byte array of file in body of request (required)
  52443.      * @throws \InvalidArgumentException
  52444.      * @return \GuzzleHttp\Psr7\Request  */
  52445.     protected function updateBankTransactionAttachmentByFileNameRequest($xero_tenant_id$bank_transaction_id$file_name$body)
  52446.     {
  52447.         // verify the required parameter 'xero_tenant_id' is set
  52448.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  52449.             throw new \InvalidArgumentException(
  52450.                 'Missing the required parameter $xero_tenant_id when calling updateBankTransactionAttachmentByFileName'
  52451.             );
  52452.         }
  52453.         // verify the required parameter 'bank_transaction_id' is set
  52454.         if ($bank_transaction_id === null || (is_array($bank_transaction_id) && count($bank_transaction_id) === 0)) {
  52455.             throw new \InvalidArgumentException(
  52456.                 'Missing the required parameter $bank_transaction_id when calling updateBankTransactionAttachmentByFileName'
  52457.             );
  52458.         }
  52459.         // verify the required parameter 'file_name' is set
  52460.         if ($file_name === null || (is_array($file_name) && count($file_name) === 0)) {
  52461.             throw new \InvalidArgumentException(
  52462.                 'Missing the required parameter $file_name when calling updateBankTransactionAttachmentByFileName'
  52463.             );
  52464.         }
  52465.         // verify the required parameter 'body' is set
  52466.         if ($body === null || (is_array($body) && count($body) === 0)) {
  52467.             throw new \InvalidArgumentException(
  52468.                 'Missing the required parameter $body when calling updateBankTransactionAttachmentByFileName'
  52469.             );
  52470.         }
  52471.         $resourcePath '/BankTransactions/{BankTransactionID}/Attachments/{FileName}';
  52472.         $formParams = [];
  52473.         $queryParams = [];
  52474.         $headerParams = [];
  52475.         $httpBody '';
  52476.         $multipart false;
  52477.         // header params
  52478.         if ($xero_tenant_id !== null) {
  52479.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  52480.         }
  52481.         // path params
  52482.         if ($bank_transaction_id !== null) {
  52483.             $resourcePath str_replace(
  52484.                 '{' 'BankTransactionID' '}',
  52485.                 AccountingObjectSerializer::toPathValue($bank_transaction_id),
  52486.                 $resourcePath
  52487.             );
  52488.         }
  52489.         // path params
  52490.         if ($file_name !== null) {
  52491.             $resourcePath str_replace(
  52492.                 '{' 'FileName' '}',
  52493.                 AccountingObjectSerializer::toPathValue($file_name),
  52494.                 $resourcePath
  52495.             );
  52496.         }
  52497.         // body params
  52498.         $_tempBody null;
  52499.         if (isset($body)) {
  52500.             $_tempBody $body;
  52501.         }
  52502.         if ($multipart) {
  52503.             $headers $this->headerSelector->selectHeadersForMultipart(
  52504.                 ['application/json']
  52505.             );
  52506.         } else {
  52507.             $headers $this->headerSelector->selectHeaders(
  52508.                 ['application/json'],
  52509.                 ['application/octet-stream']
  52510.             );
  52511.         }
  52512.         // for model (json/xml)
  52513.         if (isset($_tempBody)) {
  52514.             // $_tempBody is the method argument, if present
  52515.             if ($headers['Content-Type'] === 'application/json') {
  52516.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  52517.             } else {
  52518.                 $httpBody $_tempBody;
  52519.             }
  52520.         } elseif (count($formParams) > 0) {
  52521.             if ($multipart) {
  52522.                 $multipartContents = [
  52523.                     [
  52524.                         'Content-type' => 'multipart/form-data',
  52525.                     ]
  52526.                 ];
  52527.                 
  52528.                 // for HTTP post (form)
  52529.                 $httpBody = new MultipartStream($multipartContents);
  52530.             } elseif ($headers['Content-Type'] === 'application/json') {
  52531.                 $httpBody \GuzzleHttp\json_encode($formParams);
  52532.             } else {
  52533.                 // for HTTP post (form)
  52534.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  52535.             }
  52536.         }
  52537.         // this endpoint requires OAuth (access token)
  52538.         if ($this->config->getAccessToken() !== null) {
  52539.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  52540.         }
  52541.         $defaultHeaders = [];
  52542.         if ($this->config->getUserAgent()) {
  52543.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  52544.         }
  52545.         $headers array_merge(
  52546.             $defaultHeaders,
  52547.             $headerParams,
  52548.             $headers
  52549.         );
  52550.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  52551.         return new Request(
  52552.             'POST',
  52553.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  52554.             $headers,
  52555.             $httpBody
  52556.         );
  52557.     }
  52558.     /**
  52559.      * Operation updateBankTransferAttachmentByFileName
  52560.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  52561.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  52562.      * @param  string $file_name Name of the attachment (required)
  52563.      * @param  string $body Byte array of file in body of request (required)
  52564.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  52565.      * @throws \InvalidArgumentException
  52566.      * @return \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error
  52567.      */
  52568.     public function updateBankTransferAttachmentByFileName($xero_tenant_id$bank_transfer_id$file_name$body)
  52569.     {
  52570.         list($response) = $this->updateBankTransferAttachmentByFileNameWithHttpInfo($xero_tenant_id$bank_transfer_id$file_name$body);
  52571.         return $response;
  52572.     }
  52573.     /**
  52574.      * Operation updateBankTransferAttachmentByFileNameWithHttpInfo
  52575.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  52576.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  52577.      * @param  string $file_name Name of the attachment (required)
  52578.      * @param  string $body Byte array of file in body of request (required)
  52579.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  52580.      * @throws \InvalidArgumentException
  52581.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  52582.      */
  52583.     public function updateBankTransferAttachmentByFileNameWithHttpInfo($xero_tenant_id$bank_transfer_id$file_name$body)
  52584.     {
  52585.         $request $this->updateBankTransferAttachmentByFileNameRequest($xero_tenant_id$bank_transfer_id$file_name$body);
  52586.         try {
  52587.             $options $this->createHttpClientOption();
  52588.             try {
  52589.                 $response $this->client->send($request$options);
  52590.             } catch (RequestException $e) {
  52591.                 throw new ApiException(
  52592.                     "[{$e->getCode()}{$e->getMessage()}",
  52593.                     $e->getCode(),
  52594.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  52595.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  52596.                 );
  52597.             }
  52598.             $statusCode $response->getStatusCode();
  52599.             if ($statusCode 200 || $statusCode 299) {
  52600.                 throw new ApiException(
  52601.                     sprintf(
  52602.                         '[%d] Error connecting to the API (%s)',
  52603.                         $statusCode,
  52604.                         $request->getUri()
  52605.                     ),
  52606.                     $statusCode,
  52607.                     $response->getHeaders(),
  52608.                     $response->getBody()
  52609.                 );
  52610.             }
  52611.             $responseBody $response->getBody();
  52612.             switch($statusCode) {
  52613.                 case 200:
  52614.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Attachments' === '\SplFileObject') {
  52615.                         $content $responseBody//stream goes to serializer
  52616.                     } else {
  52617.                         $content $responseBody->getContents();
  52618.                     }
  52619.                     return [
  52620.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Attachments', []),
  52621.                         $response->getStatusCode(),
  52622.                         $response->getHeaders()
  52623.                     ];
  52624.                 case 400:
  52625.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  52626.                         $content $responseBody//stream goes to serializer
  52627.                     } else {
  52628.                         $content $responseBody->getContents();
  52629.                     }
  52630.                     return [
  52631.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  52632.                         $response->getStatusCode(),
  52633.                         $response->getHeaders()
  52634.                     ];
  52635.             }
  52636.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  52637.             $responseBody $response->getBody();
  52638.             if ($returnType === '\SplFileObject') {
  52639.                 $content $responseBody//stream goes to serializer
  52640.             } else {
  52641.                 $content $responseBody->getContents();
  52642.             }
  52643.             return [
  52644.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  52645.                 $response->getStatusCode(),
  52646.                 $response->getHeaders()
  52647.             ];
  52648.         } catch (ApiException $e) {
  52649.             switch ($e->getCode()) {
  52650.                 case 200:
  52651.                     $data AccountingObjectSerializer::deserialize(
  52652.                         $e->getResponseBody(),
  52653.                         '\XeroAPI\XeroPHP\Models\Accounting\Attachments',
  52654.                         $e->getResponseHeaders()
  52655.                     );
  52656.                     $e->setResponseObject($data);
  52657.                     break;
  52658.                 case 400:
  52659.                     $data AccountingObjectSerializer::deserialize(
  52660.                         $e->getResponseBody(),
  52661.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  52662.                         $e->getResponseHeaders()
  52663.                     );
  52664.                     $e->setResponseObject($data);
  52665.                     break;
  52666.             }
  52667.             throw $e;
  52668.         }
  52669.     }
  52670.     /**
  52671.      * Operation updateBankTransferAttachmentByFileNameAsync
  52672.      * 
  52673.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  52674.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  52675.      * @param  string $file_name Name of the attachment (required)
  52676.      * @param  string $body Byte array of file in body of request (required)
  52677.      * @throws \InvalidArgumentException
  52678.      * @return \GuzzleHttp\Promise\PromiseInterface
  52679.      */
  52680.     public function updateBankTransferAttachmentByFileNameAsync($xero_tenant_id$bank_transfer_id$file_name$body)
  52681.     {
  52682.         return $this->updateBankTransferAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$bank_transfer_id$file_name$body)
  52683.             ->then(
  52684.                 function ($response) {
  52685.                     return $response[0];
  52686.                 }
  52687.             );
  52688.     }
  52689.     /**
  52690.      * Operation updateBankTransferAttachmentByFileNameAsyncWithHttpInfo
  52691.      * 
  52692.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  52693.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  52694.      * @param  string $file_name Name of the attachment (required)
  52695.      * @param  string $body Byte array of file in body of request (required)
  52696.      * @throws \InvalidArgumentException
  52697.      * @return \GuzzleHttp\Promise\PromiseInterface */
  52698.     public function updateBankTransferAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$bank_transfer_id$file_name$body)
  52699.     {
  52700.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  52701.         $request $this->updateBankTransferAttachmentByFileNameRequest($xero_tenant_id$bank_transfer_id$file_name$body);
  52702.         return $this->client
  52703.             ->sendAsync($request$this->createHttpClientOption())
  52704.             ->then(
  52705.                 function ($response) use ($returnType) {
  52706.                     $responseBody $response->getBody();
  52707.                     if ($returnType === '\SplFileObject') {
  52708.                         $content $responseBody//stream goes to serializer
  52709.                     } else {
  52710.                         $content $responseBody->getContents();
  52711.                     }
  52712.                     return [
  52713.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  52714.                         $response->getStatusCode(),
  52715.                         $response->getHeaders()
  52716.                     ];
  52717.                 },
  52718.                 function ($exception) {
  52719.                     $response $exception->getResponse();
  52720.                     $statusCode $response->getStatusCode();
  52721.                     throw new ApiException(
  52722.                         sprintf(
  52723.                             '[%d] Error connecting to the API (%s)',
  52724.                             $statusCode,
  52725.                             $exception->getRequest()->getUri()
  52726.                         ),
  52727.                         $statusCode,
  52728.                         $response->getHeaders(),
  52729.                         $response->getBody()
  52730.                     );
  52731.                 }
  52732.             );
  52733.     }
  52734.     /**
  52735.      * Create request for operation 'updateBankTransferAttachmentByFileName'
  52736.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  52737.      * @param  string $bank_transfer_id Xero generated unique identifier for a bank transfer (required)
  52738.      * @param  string $file_name Name of the attachment (required)
  52739.      * @param  string $body Byte array of file in body of request (required)
  52740.      * @throws \InvalidArgumentException
  52741.      * @return \GuzzleHttp\Psr7\Request  */
  52742.     protected function updateBankTransferAttachmentByFileNameRequest($xero_tenant_id$bank_transfer_id$file_name$body)
  52743.     {
  52744.         // verify the required parameter 'xero_tenant_id' is set
  52745.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  52746.             throw new \InvalidArgumentException(
  52747.                 'Missing the required parameter $xero_tenant_id when calling updateBankTransferAttachmentByFileName'
  52748.             );
  52749.         }
  52750.         // verify the required parameter 'bank_transfer_id' is set
  52751.         if ($bank_transfer_id === null || (is_array($bank_transfer_id) && count($bank_transfer_id) === 0)) {
  52752.             throw new \InvalidArgumentException(
  52753.                 'Missing the required parameter $bank_transfer_id when calling updateBankTransferAttachmentByFileName'
  52754.             );
  52755.         }
  52756.         // verify the required parameter 'file_name' is set
  52757.         if ($file_name === null || (is_array($file_name) && count($file_name) === 0)) {
  52758.             throw new \InvalidArgumentException(
  52759.                 'Missing the required parameter $file_name when calling updateBankTransferAttachmentByFileName'
  52760.             );
  52761.         }
  52762.         // verify the required parameter 'body' is set
  52763.         if ($body === null || (is_array($body) && count($body) === 0)) {
  52764.             throw new \InvalidArgumentException(
  52765.                 'Missing the required parameter $body when calling updateBankTransferAttachmentByFileName'
  52766.             );
  52767.         }
  52768.         $resourcePath '/BankTransfers/{BankTransferID}/Attachments/{FileName}';
  52769.         $formParams = [];
  52770.         $queryParams = [];
  52771.         $headerParams = [];
  52772.         $httpBody '';
  52773.         $multipart false;
  52774.         // header params
  52775.         if ($xero_tenant_id !== null) {
  52776.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  52777.         }
  52778.         // path params
  52779.         if ($bank_transfer_id !== null) {
  52780.             $resourcePath str_replace(
  52781.                 '{' 'BankTransferID' '}',
  52782.                 AccountingObjectSerializer::toPathValue($bank_transfer_id),
  52783.                 $resourcePath
  52784.             );
  52785.         }
  52786.         // path params
  52787.         if ($file_name !== null) {
  52788.             $resourcePath str_replace(
  52789.                 '{' 'FileName' '}',
  52790.                 AccountingObjectSerializer::toPathValue($file_name),
  52791.                 $resourcePath
  52792.             );
  52793.         }
  52794.         // body params
  52795.         $_tempBody null;
  52796.         if (isset($body)) {
  52797.             $_tempBody $body;
  52798.         }
  52799.         if ($multipart) {
  52800.             $headers $this->headerSelector->selectHeadersForMultipart(
  52801.                 ['application/json']
  52802.             );
  52803.         } else {
  52804.             $headers $this->headerSelector->selectHeaders(
  52805.                 ['application/json'],
  52806.                 ['application/octet-stream']
  52807.             );
  52808.         }
  52809.         // for model (json/xml)
  52810.         if (isset($_tempBody)) {
  52811.             // $_tempBody is the method argument, if present
  52812.             if ($headers['Content-Type'] === 'application/json') {
  52813.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  52814.             } else {
  52815.                 $httpBody $_tempBody;
  52816.             }
  52817.         } elseif (count($formParams) > 0) {
  52818.             if ($multipart) {
  52819.                 $multipartContents = [
  52820.                     [
  52821.                         'Content-type' => 'multipart/form-data',
  52822.                     ]
  52823.                 ];
  52824.                 
  52825.                 // for HTTP post (form)
  52826.                 $httpBody = new MultipartStream($multipartContents);
  52827.             } elseif ($headers['Content-Type'] === 'application/json') {
  52828.                 $httpBody \GuzzleHttp\json_encode($formParams);
  52829.             } else {
  52830.                 // for HTTP post (form)
  52831.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  52832.             }
  52833.         }
  52834.         // this endpoint requires OAuth (access token)
  52835.         if ($this->config->getAccessToken() !== null) {
  52836.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  52837.         }
  52838.         $defaultHeaders = [];
  52839.         if ($this->config->getUserAgent()) {
  52840.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  52841.         }
  52842.         $headers array_merge(
  52843.             $defaultHeaders,
  52844.             $headerParams,
  52845.             $headers
  52846.         );
  52847.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  52848.         return new Request(
  52849.             'POST',
  52850.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  52851.             $headers,
  52852.             $httpBody
  52853.         );
  52854.     }
  52855.     /**
  52856.      * Operation updateContact
  52857.      * Updates a specific contact in a Xero organisation
  52858.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  52859.      * @param  string $contact_id Unique identifier for a Contact (required)
  52860.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Contacts $contacts an array of Contacts containing single Contact object with properties to update (required)
  52861.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  52862.      * @throws \InvalidArgumentException
  52863.      * @return \XeroAPI\XeroPHP\Models\Accounting\Contacts|\XeroAPI\XeroPHP\Models\Accounting\Error
  52864.      */
  52865.     public function updateContact($xero_tenant_id$contact_id$contacts)
  52866.     {
  52867.         list($response) = $this->updateContactWithHttpInfo($xero_tenant_id$contact_id$contacts);
  52868.         return $response;
  52869.     }
  52870.     /**
  52871.      * Operation updateContactWithHttpInfo
  52872.      * Updates a specific contact in a Xero organisation
  52873.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  52874.      * @param  string $contact_id Unique identifier for a Contact (required)
  52875.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Contacts $contacts an array of Contacts containing single Contact object with properties to update (required)
  52876.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  52877.      * @throws \InvalidArgumentException
  52878.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Contacts|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  52879.      */
  52880.     public function updateContactWithHttpInfo($xero_tenant_id$contact_id$contacts)
  52881.     {
  52882.         $request $this->updateContactRequest($xero_tenant_id$contact_id$contacts);
  52883.         try {
  52884.             $options $this->createHttpClientOption();
  52885.             try {
  52886.                 $response $this->client->send($request$options);
  52887.             } catch (RequestException $e) {
  52888.                 throw new ApiException(
  52889.                     "[{$e->getCode()}{$e->getMessage()}",
  52890.                     $e->getCode(),
  52891.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  52892.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  52893.                 );
  52894.             }
  52895.             $statusCode $response->getStatusCode();
  52896.             if ($statusCode 200 || $statusCode 299) {
  52897.                 throw new ApiException(
  52898.                     sprintf(
  52899.                         '[%d] Error connecting to the API (%s)',
  52900.                         $statusCode,
  52901.                         $request->getUri()
  52902.                     ),
  52903.                     $statusCode,
  52904.                     $response->getHeaders(),
  52905.                     $response->getBody()
  52906.                 );
  52907.             }
  52908.             $responseBody $response->getBody();
  52909.             switch($statusCode) {
  52910.                 case 200:
  52911.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Contacts' === '\SplFileObject') {
  52912.                         $content $responseBody//stream goes to serializer
  52913.                     } else {
  52914.                         $content $responseBody->getContents();
  52915.                     }
  52916.                     return [
  52917.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Contacts', []),
  52918.                         $response->getStatusCode(),
  52919.                         $response->getHeaders()
  52920.                     ];
  52921.                 case 400:
  52922.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  52923.                         $content $responseBody//stream goes to serializer
  52924.                     } else {
  52925.                         $content $responseBody->getContents();
  52926.                     }
  52927.                     return [
  52928.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  52929.                         $response->getStatusCode(),
  52930.                         $response->getHeaders()
  52931.                     ];
  52932.             }
  52933.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Contacts';
  52934.             $responseBody $response->getBody();
  52935.             if ($returnType === '\SplFileObject') {
  52936.                 $content $responseBody//stream goes to serializer
  52937.             } else {
  52938.                 $content $responseBody->getContents();
  52939.             }
  52940.             return [
  52941.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  52942.                 $response->getStatusCode(),
  52943.                 $response->getHeaders()
  52944.             ];
  52945.         } catch (ApiException $e) {
  52946.             switch ($e->getCode()) {
  52947.                 case 200:
  52948.                     $data AccountingObjectSerializer::deserialize(
  52949.                         $e->getResponseBody(),
  52950.                         '\XeroAPI\XeroPHP\Models\Accounting\Contacts',
  52951.                         $e->getResponseHeaders()
  52952.                     );
  52953.                     $e->setResponseObject($data);
  52954.                     break;
  52955.                 case 400:
  52956.                     $data AccountingObjectSerializer::deserialize(
  52957.                         $e->getResponseBody(),
  52958.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  52959.                         $e->getResponseHeaders()
  52960.                     );
  52961.                     $e->setResponseObject($data);
  52962.                     break;
  52963.             }
  52964.             throw $e;
  52965.         }
  52966.     }
  52967.     /**
  52968.      * Operation updateContactAsync
  52969.      * Updates a specific contact in a Xero organisation
  52970.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  52971.      * @param  string $contact_id Unique identifier for a Contact (required)
  52972.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Contacts $contacts an array of Contacts containing single Contact object with properties to update (required)
  52973.      * @throws \InvalidArgumentException
  52974.      * @return \GuzzleHttp\Promise\PromiseInterface
  52975.      */
  52976.     public function updateContactAsync($xero_tenant_id$contact_id$contacts)
  52977.     {
  52978.         return $this->updateContactAsyncWithHttpInfo($xero_tenant_id$contact_id$contacts)
  52979.             ->then(
  52980.                 function ($response) {
  52981.                     return $response[0];
  52982.                 }
  52983.             );
  52984.     }
  52985.     /**
  52986.      * Operation updateContactAsyncWithHttpInfo
  52987.      * Updates a specific contact in a Xero organisation
  52988.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  52989.      * @param  string $contact_id Unique identifier for a Contact (required)
  52990.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Contacts $contacts an array of Contacts containing single Contact object with properties to update (required)
  52991.      * @throws \InvalidArgumentException
  52992.      * @return \GuzzleHttp\Promise\PromiseInterface */
  52993.     public function updateContactAsyncWithHttpInfo($xero_tenant_id$contact_id$contacts)
  52994.     {
  52995.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Contacts';
  52996.         $request $this->updateContactRequest($xero_tenant_id$contact_id$contacts);
  52997.         return $this->client
  52998.             ->sendAsync($request$this->createHttpClientOption())
  52999.             ->then(
  53000.                 function ($response) use ($returnType) {
  53001.                     $responseBody $response->getBody();
  53002.                     if ($returnType === '\SplFileObject') {
  53003.                         $content $responseBody//stream goes to serializer
  53004.                     } else {
  53005.                         $content $responseBody->getContents();
  53006.                     }
  53007.                     return [
  53008.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  53009.                         $response->getStatusCode(),
  53010.                         $response->getHeaders()
  53011.                     ];
  53012.                 },
  53013.                 function ($exception) {
  53014.                     $response $exception->getResponse();
  53015.                     $statusCode $response->getStatusCode();
  53016.                     throw new ApiException(
  53017.                         sprintf(
  53018.                             '[%d] Error connecting to the API (%s)',
  53019.                             $statusCode,
  53020.                             $exception->getRequest()->getUri()
  53021.                         ),
  53022.                         $statusCode,
  53023.                         $response->getHeaders(),
  53024.                         $response->getBody()
  53025.                     );
  53026.                 }
  53027.             );
  53028.     }
  53029.     /**
  53030.      * Create request for operation 'updateContact'
  53031.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  53032.      * @param  string $contact_id Unique identifier for a Contact (required)
  53033.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Contacts $contacts an array of Contacts containing single Contact object with properties to update (required)
  53034.      * @throws \InvalidArgumentException
  53035.      * @return \GuzzleHttp\Psr7\Request  */
  53036.     protected function updateContactRequest($xero_tenant_id$contact_id$contacts)
  53037.     {
  53038.         // verify the required parameter 'xero_tenant_id' is set
  53039.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  53040.             throw new \InvalidArgumentException(
  53041.                 'Missing the required parameter $xero_tenant_id when calling updateContact'
  53042.             );
  53043.         }
  53044.         // verify the required parameter 'contact_id' is set
  53045.         if ($contact_id === null || (is_array($contact_id) && count($contact_id) === 0)) {
  53046.             throw new \InvalidArgumentException(
  53047.                 'Missing the required parameter $contact_id when calling updateContact'
  53048.             );
  53049.         }
  53050.         // verify the required parameter 'contacts' is set
  53051.         if ($contacts === null || (is_array($contacts) && count($contacts) === 0)) {
  53052.             throw new \InvalidArgumentException(
  53053.                 'Missing the required parameter $contacts when calling updateContact'
  53054.             );
  53055.         }
  53056.         $resourcePath '/Contacts/{ContactID}';
  53057.         $formParams = [];
  53058.         $queryParams = [];
  53059.         $headerParams = [];
  53060.         $httpBody '';
  53061.         $multipart false;
  53062.         // header params
  53063.         if ($xero_tenant_id !== null) {
  53064.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  53065.         }
  53066.         // path params
  53067.         if ($contact_id !== null) {
  53068.             $resourcePath str_replace(
  53069.                 '{' 'ContactID' '}',
  53070.                 AccountingObjectSerializer::toPathValue($contact_id),
  53071.                 $resourcePath
  53072.             );
  53073.         }
  53074.         // body params
  53075.         $_tempBody null;
  53076.         if (isset($contacts)) {
  53077.             $_tempBody $contacts;
  53078.         }
  53079.         if ($multipart) {
  53080.             $headers $this->headerSelector->selectHeadersForMultipart(
  53081.                 ['application/json']
  53082.             );
  53083.         } else {
  53084.             $headers $this->headerSelector->selectHeaders(
  53085.                 ['application/json'],
  53086.                 ['application/json']
  53087.             );
  53088.         }
  53089.         // for model (json/xml)
  53090.         if (isset($_tempBody)) {
  53091.             // $_tempBody is the method argument, if present
  53092.             if ($headers['Content-Type'] === 'application/json') {
  53093.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  53094.             } else {
  53095.                 $httpBody $_tempBody;
  53096.             }
  53097.         } elseif (count($formParams) > 0) {
  53098.             if ($multipart) {
  53099.                 $multipartContents = [
  53100.                     [
  53101.                         'Content-type' => 'multipart/form-data',
  53102.                     ]
  53103.                 ];
  53104.                 
  53105.                 // for HTTP post (form)
  53106.                 $httpBody = new MultipartStream($multipartContents);
  53107.             } elseif ($headers['Content-Type'] === 'application/json') {
  53108.                 $httpBody \GuzzleHttp\json_encode($formParams);
  53109.             } else {
  53110.                 // for HTTP post (form)
  53111.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  53112.             }
  53113.         }
  53114.         // this endpoint requires OAuth (access token)
  53115.         if ($this->config->getAccessToken() !== null) {
  53116.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  53117.         }
  53118.         $defaultHeaders = [];
  53119.         if ($this->config->getUserAgent()) {
  53120.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  53121.         }
  53122.         $headers array_merge(
  53123.             $defaultHeaders,
  53124.             $headerParams,
  53125.             $headers
  53126.         );
  53127.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  53128.         return new Request(
  53129.             'POST',
  53130.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  53131.             $headers,
  53132.             $httpBody
  53133.         );
  53134.     }
  53135.     /**
  53136.      * Operation updateContactAttachmentByFileName
  53137.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  53138.      * @param  string $contact_id Unique identifier for a Contact (required)
  53139.      * @param  string $file_name Name of the attachment (required)
  53140.      * @param  string $body Byte array of file in body of request (required)
  53141.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  53142.      * @throws \InvalidArgumentException
  53143.      * @return \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error
  53144.      */
  53145.     public function updateContactAttachmentByFileName($xero_tenant_id$contact_id$file_name$body)
  53146.     {
  53147.         list($response) = $this->updateContactAttachmentByFileNameWithHttpInfo($xero_tenant_id$contact_id$file_name$body);
  53148.         return $response;
  53149.     }
  53150.     /**
  53151.      * Operation updateContactAttachmentByFileNameWithHttpInfo
  53152.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  53153.      * @param  string $contact_id Unique identifier for a Contact (required)
  53154.      * @param  string $file_name Name of the attachment (required)
  53155.      * @param  string $body Byte array of file in body of request (required)
  53156.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  53157.      * @throws \InvalidArgumentException
  53158.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  53159.      */
  53160.     public function updateContactAttachmentByFileNameWithHttpInfo($xero_tenant_id$contact_id$file_name$body)
  53161.     {
  53162.         $request $this->updateContactAttachmentByFileNameRequest($xero_tenant_id$contact_id$file_name$body);
  53163.         try {
  53164.             $options $this->createHttpClientOption();
  53165.             try {
  53166.                 $response $this->client->send($request$options);
  53167.             } catch (RequestException $e) {
  53168.                 throw new ApiException(
  53169.                     "[{$e->getCode()}{$e->getMessage()}",
  53170.                     $e->getCode(),
  53171.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  53172.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  53173.                 );
  53174.             }
  53175.             $statusCode $response->getStatusCode();
  53176.             if ($statusCode 200 || $statusCode 299) {
  53177.                 throw new ApiException(
  53178.                     sprintf(
  53179.                         '[%d] Error connecting to the API (%s)',
  53180.                         $statusCode,
  53181.                         $request->getUri()
  53182.                     ),
  53183.                     $statusCode,
  53184.                     $response->getHeaders(),
  53185.                     $response->getBody()
  53186.                 );
  53187.             }
  53188.             $responseBody $response->getBody();
  53189.             switch($statusCode) {
  53190.                 case 200:
  53191.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Attachments' === '\SplFileObject') {
  53192.                         $content $responseBody//stream goes to serializer
  53193.                     } else {
  53194.                         $content $responseBody->getContents();
  53195.                     }
  53196.                     return [
  53197.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Attachments', []),
  53198.                         $response->getStatusCode(),
  53199.                         $response->getHeaders()
  53200.                     ];
  53201.                 case 400:
  53202.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  53203.                         $content $responseBody//stream goes to serializer
  53204.                     } else {
  53205.                         $content $responseBody->getContents();
  53206.                     }
  53207.                     return [
  53208.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  53209.                         $response->getStatusCode(),
  53210.                         $response->getHeaders()
  53211.                     ];
  53212.             }
  53213.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  53214.             $responseBody $response->getBody();
  53215.             if ($returnType === '\SplFileObject') {
  53216.                 $content $responseBody//stream goes to serializer
  53217.             } else {
  53218.                 $content $responseBody->getContents();
  53219.             }
  53220.             return [
  53221.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  53222.                 $response->getStatusCode(),
  53223.                 $response->getHeaders()
  53224.             ];
  53225.         } catch (ApiException $e) {
  53226.             switch ($e->getCode()) {
  53227.                 case 200:
  53228.                     $data AccountingObjectSerializer::deserialize(
  53229.                         $e->getResponseBody(),
  53230.                         '\XeroAPI\XeroPHP\Models\Accounting\Attachments',
  53231.                         $e->getResponseHeaders()
  53232.                     );
  53233.                     $e->setResponseObject($data);
  53234.                     break;
  53235.                 case 400:
  53236.                     $data AccountingObjectSerializer::deserialize(
  53237.                         $e->getResponseBody(),
  53238.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  53239.                         $e->getResponseHeaders()
  53240.                     );
  53241.                     $e->setResponseObject($data);
  53242.                     break;
  53243.             }
  53244.             throw $e;
  53245.         }
  53246.     }
  53247.     /**
  53248.      * Operation updateContactAttachmentByFileNameAsync
  53249.      * 
  53250.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  53251.      * @param  string $contact_id Unique identifier for a Contact (required)
  53252.      * @param  string $file_name Name of the attachment (required)
  53253.      * @param  string $body Byte array of file in body of request (required)
  53254.      * @throws \InvalidArgumentException
  53255.      * @return \GuzzleHttp\Promise\PromiseInterface
  53256.      */
  53257.     public function updateContactAttachmentByFileNameAsync($xero_tenant_id$contact_id$file_name$body)
  53258.     {
  53259.         return $this->updateContactAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$contact_id$file_name$body)
  53260.             ->then(
  53261.                 function ($response) {
  53262.                     return $response[0];
  53263.                 }
  53264.             );
  53265.     }
  53266.     /**
  53267.      * Operation updateContactAttachmentByFileNameAsyncWithHttpInfo
  53268.      * 
  53269.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  53270.      * @param  string $contact_id Unique identifier for a Contact (required)
  53271.      * @param  string $file_name Name of the attachment (required)
  53272.      * @param  string $body Byte array of file in body of request (required)
  53273.      * @throws \InvalidArgumentException
  53274.      * @return \GuzzleHttp\Promise\PromiseInterface */
  53275.     public function updateContactAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$contact_id$file_name$body)
  53276.     {
  53277.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  53278.         $request $this->updateContactAttachmentByFileNameRequest($xero_tenant_id$contact_id$file_name$body);
  53279.         return $this->client
  53280.             ->sendAsync($request$this->createHttpClientOption())
  53281.             ->then(
  53282.                 function ($response) use ($returnType) {
  53283.                     $responseBody $response->getBody();
  53284.                     if ($returnType === '\SplFileObject') {
  53285.                         $content $responseBody//stream goes to serializer
  53286.                     } else {
  53287.                         $content $responseBody->getContents();
  53288.                     }
  53289.                     return [
  53290.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  53291.                         $response->getStatusCode(),
  53292.                         $response->getHeaders()
  53293.                     ];
  53294.                 },
  53295.                 function ($exception) {
  53296.                     $response $exception->getResponse();
  53297.                     $statusCode $response->getStatusCode();
  53298.                     throw new ApiException(
  53299.                         sprintf(
  53300.                             '[%d] Error connecting to the API (%s)',
  53301.                             $statusCode,
  53302.                             $exception->getRequest()->getUri()
  53303.                         ),
  53304.                         $statusCode,
  53305.                         $response->getHeaders(),
  53306.                         $response->getBody()
  53307.                     );
  53308.                 }
  53309.             );
  53310.     }
  53311.     /**
  53312.      * Create request for operation 'updateContactAttachmentByFileName'
  53313.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  53314.      * @param  string $contact_id Unique identifier for a Contact (required)
  53315.      * @param  string $file_name Name of the attachment (required)
  53316.      * @param  string $body Byte array of file in body of request (required)
  53317.      * @throws \InvalidArgumentException
  53318.      * @return \GuzzleHttp\Psr7\Request  */
  53319.     protected function updateContactAttachmentByFileNameRequest($xero_tenant_id$contact_id$file_name$body)
  53320.     {
  53321.         // verify the required parameter 'xero_tenant_id' is set
  53322.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  53323.             throw new \InvalidArgumentException(
  53324.                 'Missing the required parameter $xero_tenant_id when calling updateContactAttachmentByFileName'
  53325.             );
  53326.         }
  53327.         // verify the required parameter 'contact_id' is set
  53328.         if ($contact_id === null || (is_array($contact_id) && count($contact_id) === 0)) {
  53329.             throw new \InvalidArgumentException(
  53330.                 'Missing the required parameter $contact_id when calling updateContactAttachmentByFileName'
  53331.             );
  53332.         }
  53333.         // verify the required parameter 'file_name' is set
  53334.         if ($file_name === null || (is_array($file_name) && count($file_name) === 0)) {
  53335.             throw new \InvalidArgumentException(
  53336.                 'Missing the required parameter $file_name when calling updateContactAttachmentByFileName'
  53337.             );
  53338.         }
  53339.         // verify the required parameter 'body' is set
  53340.         if ($body === null || (is_array($body) && count($body) === 0)) {
  53341.             throw new \InvalidArgumentException(
  53342.                 'Missing the required parameter $body when calling updateContactAttachmentByFileName'
  53343.             );
  53344.         }
  53345.         $resourcePath '/Contacts/{ContactID}/Attachments/{FileName}';
  53346.         $formParams = [];
  53347.         $queryParams = [];
  53348.         $headerParams = [];
  53349.         $httpBody '';
  53350.         $multipart false;
  53351.         // header params
  53352.         if ($xero_tenant_id !== null) {
  53353.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  53354.         }
  53355.         // path params
  53356.         if ($contact_id !== null) {
  53357.             $resourcePath str_replace(
  53358.                 '{' 'ContactID' '}',
  53359.                 AccountingObjectSerializer::toPathValue($contact_id),
  53360.                 $resourcePath
  53361.             );
  53362.         }
  53363.         // path params
  53364.         if ($file_name !== null) {
  53365.             $resourcePath str_replace(
  53366.                 '{' 'FileName' '}',
  53367.                 AccountingObjectSerializer::toPathValue($file_name),
  53368.                 $resourcePath
  53369.             );
  53370.         }
  53371.         // body params
  53372.         $_tempBody null;
  53373.         if (isset($body)) {
  53374.             $_tempBody $body;
  53375.         }
  53376.         if ($multipart) {
  53377.             $headers $this->headerSelector->selectHeadersForMultipart(
  53378.                 ['application/json']
  53379.             );
  53380.         } else {
  53381.             $headers $this->headerSelector->selectHeaders(
  53382.                 ['application/json'],
  53383.                 ['application/octet-stream']
  53384.             );
  53385.         }
  53386.         // for model (json/xml)
  53387.         if (isset($_tempBody)) {
  53388.             // $_tempBody is the method argument, if present
  53389.             if ($headers['Content-Type'] === 'application/json') {
  53390.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  53391.             } else {
  53392.                 $httpBody $_tempBody;
  53393.             }
  53394.         } elseif (count($formParams) > 0) {
  53395.             if ($multipart) {
  53396.                 $multipartContents = [
  53397.                     [
  53398.                         'Content-type' => 'multipart/form-data',
  53399.                     ]
  53400.                 ];
  53401.                 
  53402.                 // for HTTP post (form)
  53403.                 $httpBody = new MultipartStream($multipartContents);
  53404.             } elseif ($headers['Content-Type'] === 'application/json') {
  53405.                 $httpBody \GuzzleHttp\json_encode($formParams);
  53406.             } else {
  53407.                 // for HTTP post (form)
  53408.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  53409.             }
  53410.         }
  53411.         // this endpoint requires OAuth (access token)
  53412.         if ($this->config->getAccessToken() !== null) {
  53413.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  53414.         }
  53415.         $defaultHeaders = [];
  53416.         if ($this->config->getUserAgent()) {
  53417.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  53418.         }
  53419.         $headers array_merge(
  53420.             $defaultHeaders,
  53421.             $headerParams,
  53422.             $headers
  53423.         );
  53424.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  53425.         return new Request(
  53426.             'POST',
  53427.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  53428.             $headers,
  53429.             $httpBody
  53430.         );
  53431.     }
  53432.     /**
  53433.      * Operation updateContactGroup
  53434.      * Updates a specific contact group
  53435.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  53436.      * @param  string $contact_group_id Unique identifier for a Contact Group (required)
  53437.      * @param  \XeroAPI\XeroPHP\Models\Accounting\ContactGroups $contact_groups an array of Contact groups with Name of specific group to update (required)
  53438.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  53439.      * @throws \InvalidArgumentException
  53440.      * @return \XeroAPI\XeroPHP\Models\Accounting\ContactGroups|\XeroAPI\XeroPHP\Models\Accounting\Error
  53441.      */
  53442.     public function updateContactGroup($xero_tenant_id$contact_group_id$contact_groups)
  53443.     {
  53444.         list($response) = $this->updateContactGroupWithHttpInfo($xero_tenant_id$contact_group_id$contact_groups);
  53445.         return $response;
  53446.     }
  53447.     /**
  53448.      * Operation updateContactGroupWithHttpInfo
  53449.      * Updates a specific contact group
  53450.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  53451.      * @param  string $contact_group_id Unique identifier for a Contact Group (required)
  53452.      * @param  \XeroAPI\XeroPHP\Models\Accounting\ContactGroups $contact_groups an array of Contact groups with Name of specific group to update (required)
  53453.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  53454.      * @throws \InvalidArgumentException
  53455.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\ContactGroups|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  53456.      */
  53457.     public function updateContactGroupWithHttpInfo($xero_tenant_id$contact_group_id$contact_groups)
  53458.     {
  53459.         $request $this->updateContactGroupRequest($xero_tenant_id$contact_group_id$contact_groups);
  53460.         try {
  53461.             $options $this->createHttpClientOption();
  53462.             try {
  53463.                 $response $this->client->send($request$options);
  53464.             } catch (RequestException $e) {
  53465.                 throw new ApiException(
  53466.                     "[{$e->getCode()}{$e->getMessage()}",
  53467.                     $e->getCode(),
  53468.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  53469.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  53470.                 );
  53471.             }
  53472.             $statusCode $response->getStatusCode();
  53473.             if ($statusCode 200 || $statusCode 299) {
  53474.                 throw new ApiException(
  53475.                     sprintf(
  53476.                         '[%d] Error connecting to the API (%s)',
  53477.                         $statusCode,
  53478.                         $request->getUri()
  53479.                     ),
  53480.                     $statusCode,
  53481.                     $response->getHeaders(),
  53482.                     $response->getBody()
  53483.                 );
  53484.             }
  53485.             $responseBody $response->getBody();
  53486.             switch($statusCode) {
  53487.                 case 200:
  53488.                     if ('\XeroAPI\XeroPHP\Models\Accounting\ContactGroups' === '\SplFileObject') {
  53489.                         $content $responseBody//stream goes to serializer
  53490.                     } else {
  53491.                         $content $responseBody->getContents();
  53492.                     }
  53493.                     return [
  53494.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\ContactGroups', []),
  53495.                         $response->getStatusCode(),
  53496.                         $response->getHeaders()
  53497.                     ];
  53498.                 case 400:
  53499.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  53500.                         $content $responseBody//stream goes to serializer
  53501.                     } else {
  53502.                         $content $responseBody->getContents();
  53503.                     }
  53504.                     return [
  53505.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  53506.                         $response->getStatusCode(),
  53507.                         $response->getHeaders()
  53508.                     ];
  53509.             }
  53510.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\ContactGroups';
  53511.             $responseBody $response->getBody();
  53512.             if ($returnType === '\SplFileObject') {
  53513.                 $content $responseBody//stream goes to serializer
  53514.             } else {
  53515.                 $content $responseBody->getContents();
  53516.             }
  53517.             return [
  53518.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  53519.                 $response->getStatusCode(),
  53520.                 $response->getHeaders()
  53521.             ];
  53522.         } catch (ApiException $e) {
  53523.             switch ($e->getCode()) {
  53524.                 case 200:
  53525.                     $data AccountingObjectSerializer::deserialize(
  53526.                         $e->getResponseBody(),
  53527.                         '\XeroAPI\XeroPHP\Models\Accounting\ContactGroups',
  53528.                         $e->getResponseHeaders()
  53529.                     );
  53530.                     $e->setResponseObject($data);
  53531.                     break;
  53532.                 case 400:
  53533.                     $data AccountingObjectSerializer::deserialize(
  53534.                         $e->getResponseBody(),
  53535.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  53536.                         $e->getResponseHeaders()
  53537.                     );
  53538.                     $e->setResponseObject($data);
  53539.                     break;
  53540.             }
  53541.             throw $e;
  53542.         }
  53543.     }
  53544.     /**
  53545.      * Operation updateContactGroupAsync
  53546.      * Updates a specific contact group
  53547.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  53548.      * @param  string $contact_group_id Unique identifier for a Contact Group (required)
  53549.      * @param  \XeroAPI\XeroPHP\Models\Accounting\ContactGroups $contact_groups an array of Contact groups with Name of specific group to update (required)
  53550.      * @throws \InvalidArgumentException
  53551.      * @return \GuzzleHttp\Promise\PromiseInterface
  53552.      */
  53553.     public function updateContactGroupAsync($xero_tenant_id$contact_group_id$contact_groups)
  53554.     {
  53555.         return $this->updateContactGroupAsyncWithHttpInfo($xero_tenant_id$contact_group_id$contact_groups)
  53556.             ->then(
  53557.                 function ($response) {
  53558.                     return $response[0];
  53559.                 }
  53560.             );
  53561.     }
  53562.     /**
  53563.      * Operation updateContactGroupAsyncWithHttpInfo
  53564.      * Updates a specific contact group
  53565.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  53566.      * @param  string $contact_group_id Unique identifier for a Contact Group (required)
  53567.      * @param  \XeroAPI\XeroPHP\Models\Accounting\ContactGroups $contact_groups an array of Contact groups with Name of specific group to update (required)
  53568.      * @throws \InvalidArgumentException
  53569.      * @return \GuzzleHttp\Promise\PromiseInterface */
  53570.     public function updateContactGroupAsyncWithHttpInfo($xero_tenant_id$contact_group_id$contact_groups)
  53571.     {
  53572.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\ContactGroups';
  53573.         $request $this->updateContactGroupRequest($xero_tenant_id$contact_group_id$contact_groups);
  53574.         return $this->client
  53575.             ->sendAsync($request$this->createHttpClientOption())
  53576.             ->then(
  53577.                 function ($response) use ($returnType) {
  53578.                     $responseBody $response->getBody();
  53579.                     if ($returnType === '\SplFileObject') {
  53580.                         $content $responseBody//stream goes to serializer
  53581.                     } else {
  53582.                         $content $responseBody->getContents();
  53583.                     }
  53584.                     return [
  53585.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  53586.                         $response->getStatusCode(),
  53587.                         $response->getHeaders()
  53588.                     ];
  53589.                 },
  53590.                 function ($exception) {
  53591.                     $response $exception->getResponse();
  53592.                     $statusCode $response->getStatusCode();
  53593.                     throw new ApiException(
  53594.                         sprintf(
  53595.                             '[%d] Error connecting to the API (%s)',
  53596.                             $statusCode,
  53597.                             $exception->getRequest()->getUri()
  53598.                         ),
  53599.                         $statusCode,
  53600.                         $response->getHeaders(),
  53601.                         $response->getBody()
  53602.                     );
  53603.                 }
  53604.             );
  53605.     }
  53606.     /**
  53607.      * Create request for operation 'updateContactGroup'
  53608.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  53609.      * @param  string $contact_group_id Unique identifier for a Contact Group (required)
  53610.      * @param  \XeroAPI\XeroPHP\Models\Accounting\ContactGroups $contact_groups an array of Contact groups with Name of specific group to update (required)
  53611.      * @throws \InvalidArgumentException
  53612.      * @return \GuzzleHttp\Psr7\Request  */
  53613.     protected function updateContactGroupRequest($xero_tenant_id$contact_group_id$contact_groups)
  53614.     {
  53615.         // verify the required parameter 'xero_tenant_id' is set
  53616.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  53617.             throw new \InvalidArgumentException(
  53618.                 'Missing the required parameter $xero_tenant_id when calling updateContactGroup'
  53619.             );
  53620.         }
  53621.         // verify the required parameter 'contact_group_id' is set
  53622.         if ($contact_group_id === null || (is_array($contact_group_id) && count($contact_group_id) === 0)) {
  53623.             throw new \InvalidArgumentException(
  53624.                 'Missing the required parameter $contact_group_id when calling updateContactGroup'
  53625.             );
  53626.         }
  53627.         // verify the required parameter 'contact_groups' is set
  53628.         if ($contact_groups === null || (is_array($contact_groups) && count($contact_groups) === 0)) {
  53629.             throw new \InvalidArgumentException(
  53630.                 'Missing the required parameter $contact_groups when calling updateContactGroup'
  53631.             );
  53632.         }
  53633.         $resourcePath '/ContactGroups/{ContactGroupID}';
  53634.         $formParams = [];
  53635.         $queryParams = [];
  53636.         $headerParams = [];
  53637.         $httpBody '';
  53638.         $multipart false;
  53639.         // header params
  53640.         if ($xero_tenant_id !== null) {
  53641.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  53642.         }
  53643.         // path params
  53644.         if ($contact_group_id !== null) {
  53645.             $resourcePath str_replace(
  53646.                 '{' 'ContactGroupID' '}',
  53647.                 AccountingObjectSerializer::toPathValue($contact_group_id),
  53648.                 $resourcePath
  53649.             );
  53650.         }
  53651.         // body params
  53652.         $_tempBody null;
  53653.         if (isset($contact_groups)) {
  53654.             $_tempBody $contact_groups;
  53655.         }
  53656.         if ($multipart) {
  53657.             $headers $this->headerSelector->selectHeadersForMultipart(
  53658.                 ['application/json']
  53659.             );
  53660.         } else {
  53661.             $headers $this->headerSelector->selectHeaders(
  53662.                 ['application/json'],
  53663.                 ['application/json']
  53664.             );
  53665.         }
  53666.         // for model (json/xml)
  53667.         if (isset($_tempBody)) {
  53668.             // $_tempBody is the method argument, if present
  53669.             if ($headers['Content-Type'] === 'application/json') {
  53670.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  53671.             } else {
  53672.                 $httpBody $_tempBody;
  53673.             }
  53674.         } elseif (count($formParams) > 0) {
  53675.             if ($multipart) {
  53676.                 $multipartContents = [
  53677.                     [
  53678.                         'Content-type' => 'multipart/form-data',
  53679.                     ]
  53680.                 ];
  53681.                 
  53682.                 // for HTTP post (form)
  53683.                 $httpBody = new MultipartStream($multipartContents);
  53684.             } elseif ($headers['Content-Type'] === 'application/json') {
  53685.                 $httpBody \GuzzleHttp\json_encode($formParams);
  53686.             } else {
  53687.                 // for HTTP post (form)
  53688.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  53689.             }
  53690.         }
  53691.         // this endpoint requires OAuth (access token)
  53692.         if ($this->config->getAccessToken() !== null) {
  53693.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  53694.         }
  53695.         $defaultHeaders = [];
  53696.         if ($this->config->getUserAgent()) {
  53697.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  53698.         }
  53699.         $headers array_merge(
  53700.             $defaultHeaders,
  53701.             $headerParams,
  53702.             $headers
  53703.         );
  53704.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  53705.         return new Request(
  53706.             'POST',
  53707.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  53708.             $headers,
  53709.             $httpBody
  53710.         );
  53711.     }
  53712.     /**
  53713.      * Operation updateCreditNote
  53714.      * Updates a specific credit note
  53715.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  53716.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  53717.      * @param  \XeroAPI\XeroPHP\Models\Accounting\CreditNotes $credit_notes an array of Credit Notes containing credit note details to update (required)
  53718.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  53719.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  53720.      * @throws \InvalidArgumentException
  53721.      * @return \XeroAPI\XeroPHP\Models\Accounting\CreditNotes|\XeroAPI\XeroPHP\Models\Accounting\Error
  53722.      */
  53723.     public function updateCreditNote($xero_tenant_id$credit_note_id$credit_notes$unitdp null)
  53724.     {
  53725.         list($response) = $this->updateCreditNoteWithHttpInfo($xero_tenant_id$credit_note_id$credit_notes$unitdp);
  53726.         return $response;
  53727.     }
  53728.     /**
  53729.      * Operation updateCreditNoteWithHttpInfo
  53730.      * Updates a specific credit note
  53731.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  53732.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  53733.      * @param  \XeroAPI\XeroPHP\Models\Accounting\CreditNotes $credit_notes an array of Credit Notes containing credit note details to update (required)
  53734.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  53735.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  53736.      * @throws \InvalidArgumentException
  53737.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\CreditNotes|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  53738.      */
  53739.     public function updateCreditNoteWithHttpInfo($xero_tenant_id$credit_note_id$credit_notes$unitdp null)
  53740.     {
  53741.         $request $this->updateCreditNoteRequest($xero_tenant_id$credit_note_id$credit_notes$unitdp);
  53742.         try {
  53743.             $options $this->createHttpClientOption();
  53744.             try {
  53745.                 $response $this->client->send($request$options);
  53746.             } catch (RequestException $e) {
  53747.                 throw new ApiException(
  53748.                     "[{$e->getCode()}{$e->getMessage()}",
  53749.                     $e->getCode(),
  53750.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  53751.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  53752.                 );
  53753.             }
  53754.             $statusCode $response->getStatusCode();
  53755.             if ($statusCode 200 || $statusCode 299) {
  53756.                 throw new ApiException(
  53757.                     sprintf(
  53758.                         '[%d] Error connecting to the API (%s)',
  53759.                         $statusCode,
  53760.                         $request->getUri()
  53761.                     ),
  53762.                     $statusCode,
  53763.                     $response->getHeaders(),
  53764.                     $response->getBody()
  53765.                 );
  53766.             }
  53767.             $responseBody $response->getBody();
  53768.             switch($statusCode) {
  53769.                 case 200:
  53770.                     if ('\XeroAPI\XeroPHP\Models\Accounting\CreditNotes' === '\SplFileObject') {
  53771.                         $content $responseBody//stream goes to serializer
  53772.                     } else {
  53773.                         $content $responseBody->getContents();
  53774.                     }
  53775.                     return [
  53776.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\CreditNotes', []),
  53777.                         $response->getStatusCode(),
  53778.                         $response->getHeaders()
  53779.                     ];
  53780.                 case 400:
  53781.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  53782.                         $content $responseBody//stream goes to serializer
  53783.                     } else {
  53784.                         $content $responseBody->getContents();
  53785.                     }
  53786.                     return [
  53787.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  53788.                         $response->getStatusCode(),
  53789.                         $response->getHeaders()
  53790.                     ];
  53791.             }
  53792.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\CreditNotes';
  53793.             $responseBody $response->getBody();
  53794.             if ($returnType === '\SplFileObject') {
  53795.                 $content $responseBody//stream goes to serializer
  53796.             } else {
  53797.                 $content $responseBody->getContents();
  53798.             }
  53799.             return [
  53800.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  53801.                 $response->getStatusCode(),
  53802.                 $response->getHeaders()
  53803.             ];
  53804.         } catch (ApiException $e) {
  53805.             switch ($e->getCode()) {
  53806.                 case 200:
  53807.                     $data AccountingObjectSerializer::deserialize(
  53808.                         $e->getResponseBody(),
  53809.                         '\XeroAPI\XeroPHP\Models\Accounting\CreditNotes',
  53810.                         $e->getResponseHeaders()
  53811.                     );
  53812.                     $e->setResponseObject($data);
  53813.                     break;
  53814.                 case 400:
  53815.                     $data AccountingObjectSerializer::deserialize(
  53816.                         $e->getResponseBody(),
  53817.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  53818.                         $e->getResponseHeaders()
  53819.                     );
  53820.                     $e->setResponseObject($data);
  53821.                     break;
  53822.             }
  53823.             throw $e;
  53824.         }
  53825.     }
  53826.     /**
  53827.      * Operation updateCreditNoteAsync
  53828.      * Updates a specific credit note
  53829.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  53830.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  53831.      * @param  \XeroAPI\XeroPHP\Models\Accounting\CreditNotes $credit_notes an array of Credit Notes containing credit note details to update (required)
  53832.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  53833.      * @throws \InvalidArgumentException
  53834.      * @return \GuzzleHttp\Promise\PromiseInterface
  53835.      */
  53836.     public function updateCreditNoteAsync($xero_tenant_id$credit_note_id$credit_notes$unitdp null)
  53837.     {
  53838.         return $this->updateCreditNoteAsyncWithHttpInfo($xero_tenant_id$credit_note_id$credit_notes$unitdp)
  53839.             ->then(
  53840.                 function ($response) {
  53841.                     return $response[0];
  53842.                 }
  53843.             );
  53844.     }
  53845.     /**
  53846.      * Operation updateCreditNoteAsyncWithHttpInfo
  53847.      * Updates a specific credit note
  53848.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  53849.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  53850.      * @param  \XeroAPI\XeroPHP\Models\Accounting\CreditNotes $credit_notes an array of Credit Notes containing credit note details to update (required)
  53851.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  53852.      * @throws \InvalidArgumentException
  53853.      * @return \GuzzleHttp\Promise\PromiseInterface */
  53854.     public function updateCreditNoteAsyncWithHttpInfo($xero_tenant_id$credit_note_id$credit_notes$unitdp null)
  53855.     {
  53856.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\CreditNotes';
  53857.         $request $this->updateCreditNoteRequest($xero_tenant_id$credit_note_id$credit_notes$unitdp);
  53858.         return $this->client
  53859.             ->sendAsync($request$this->createHttpClientOption())
  53860.             ->then(
  53861.                 function ($response) use ($returnType) {
  53862.                     $responseBody $response->getBody();
  53863.                     if ($returnType === '\SplFileObject') {
  53864.                         $content $responseBody//stream goes to serializer
  53865.                     } else {
  53866.                         $content $responseBody->getContents();
  53867.                     }
  53868.                     return [
  53869.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  53870.                         $response->getStatusCode(),
  53871.                         $response->getHeaders()
  53872.                     ];
  53873.                 },
  53874.                 function ($exception) {
  53875.                     $response $exception->getResponse();
  53876.                     $statusCode $response->getStatusCode();
  53877.                     throw new ApiException(
  53878.                         sprintf(
  53879.                             '[%d] Error connecting to the API (%s)',
  53880.                             $statusCode,
  53881.                             $exception->getRequest()->getUri()
  53882.                         ),
  53883.                         $statusCode,
  53884.                         $response->getHeaders(),
  53885.                         $response->getBody()
  53886.                     );
  53887.                 }
  53888.             );
  53889.     }
  53890.     /**
  53891.      * Create request for operation 'updateCreditNote'
  53892.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  53893.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  53894.      * @param  \XeroAPI\XeroPHP\Models\Accounting\CreditNotes $credit_notes an array of Credit Notes containing credit note details to update (required)
  53895.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  53896.      * @throws \InvalidArgumentException
  53897.      * @return \GuzzleHttp\Psr7\Request  */
  53898.     protected function updateCreditNoteRequest($xero_tenant_id$credit_note_id$credit_notes$unitdp null)
  53899.     {
  53900.         // verify the required parameter 'xero_tenant_id' is set
  53901.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  53902.             throw new \InvalidArgumentException(
  53903.                 'Missing the required parameter $xero_tenant_id when calling updateCreditNote'
  53904.             );
  53905.         }
  53906.         // verify the required parameter 'credit_note_id' is set
  53907.         if ($credit_note_id === null || (is_array($credit_note_id) && count($credit_note_id) === 0)) {
  53908.             throw new \InvalidArgumentException(
  53909.                 'Missing the required parameter $credit_note_id when calling updateCreditNote'
  53910.             );
  53911.         }
  53912.         // verify the required parameter 'credit_notes' is set
  53913.         if ($credit_notes === null || (is_array($credit_notes) && count($credit_notes) === 0)) {
  53914.             throw new \InvalidArgumentException(
  53915.                 'Missing the required parameter $credit_notes when calling updateCreditNote'
  53916.             );
  53917.         }
  53918.         $resourcePath '/CreditNotes/{CreditNoteID}';
  53919.         $formParams = [];
  53920.         $queryParams = [];
  53921.         $headerParams = [];
  53922.         $httpBody '';
  53923.         $multipart false;
  53924.         // query params
  53925.         if ($unitdp !== null) {
  53926.             $queryParams['unitdp'] = AccountingObjectSerializer::toQueryValue($unitdp);
  53927.         }
  53928.         // header params
  53929.         if ($xero_tenant_id !== null) {
  53930.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  53931.         }
  53932.         // path params
  53933.         if ($credit_note_id !== null) {
  53934.             $resourcePath str_replace(
  53935.                 '{' 'CreditNoteID' '}',
  53936.                 AccountingObjectSerializer::toPathValue($credit_note_id),
  53937.                 $resourcePath
  53938.             );
  53939.         }
  53940.         // body params
  53941.         $_tempBody null;
  53942.         if (isset($credit_notes)) {
  53943.             $_tempBody $credit_notes;
  53944.         }
  53945.         if ($multipart) {
  53946.             $headers $this->headerSelector->selectHeadersForMultipart(
  53947.                 ['application/json']
  53948.             );
  53949.         } else {
  53950.             $headers $this->headerSelector->selectHeaders(
  53951.                 ['application/json'],
  53952.                 ['application/json']
  53953.             );
  53954.         }
  53955.         // for model (json/xml)
  53956.         if (isset($_tempBody)) {
  53957.             // $_tempBody is the method argument, if present
  53958.             if ($headers['Content-Type'] === 'application/json') {
  53959.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  53960.             } else {
  53961.                 $httpBody $_tempBody;
  53962.             }
  53963.         } elseif (count($formParams) > 0) {
  53964.             if ($multipart) {
  53965.                 $multipartContents = [
  53966.                     [
  53967.                         'Content-type' => 'multipart/form-data',
  53968.                     ]
  53969.                 ];
  53970.                 
  53971.                 // for HTTP post (form)
  53972.                 $httpBody = new MultipartStream($multipartContents);
  53973.             } elseif ($headers['Content-Type'] === 'application/json') {
  53974.                 $httpBody \GuzzleHttp\json_encode($formParams);
  53975.             } else {
  53976.                 // for HTTP post (form)
  53977.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  53978.             }
  53979.         }
  53980.         // this endpoint requires OAuth (access token)
  53981.         if ($this->config->getAccessToken() !== null) {
  53982.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  53983.         }
  53984.         $defaultHeaders = [];
  53985.         if ($this->config->getUserAgent()) {
  53986.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  53987.         }
  53988.         $headers array_merge(
  53989.             $defaultHeaders,
  53990.             $headerParams,
  53991.             $headers
  53992.         );
  53993.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  53994.         return new Request(
  53995.             'POST',
  53996.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  53997.             $headers,
  53998.             $httpBody
  53999.         );
  54000.     }
  54001.     /**
  54002.      * Operation updateCreditNoteAttachmentByFileName
  54003.      * Updates attachments on a specific credit note by file name
  54004.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  54005.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  54006.      * @param  string $file_name Name of the attachment (required)
  54007.      * @param  string $body Byte array of file in body of request (required)
  54008.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  54009.      * @throws \InvalidArgumentException
  54010.      * @return \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error
  54011.      */
  54012.     public function updateCreditNoteAttachmentByFileName($xero_tenant_id$credit_note_id$file_name$body)
  54013.     {
  54014.         list($response) = $this->updateCreditNoteAttachmentByFileNameWithHttpInfo($xero_tenant_id$credit_note_id$file_name$body);
  54015.         return $response;
  54016.     }
  54017.     /**
  54018.      * Operation updateCreditNoteAttachmentByFileNameWithHttpInfo
  54019.      * Updates attachments on a specific credit note by file name
  54020.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  54021.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  54022.      * @param  string $file_name Name of the attachment (required)
  54023.      * @param  string $body Byte array of file in body of request (required)
  54024.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  54025.      * @throws \InvalidArgumentException
  54026.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  54027.      */
  54028.     public function updateCreditNoteAttachmentByFileNameWithHttpInfo($xero_tenant_id$credit_note_id$file_name$body)
  54029.     {
  54030.         $request $this->updateCreditNoteAttachmentByFileNameRequest($xero_tenant_id$credit_note_id$file_name$body);
  54031.         try {
  54032.             $options $this->createHttpClientOption();
  54033.             try {
  54034.                 $response $this->client->send($request$options);
  54035.             } catch (RequestException $e) {
  54036.                 throw new ApiException(
  54037.                     "[{$e->getCode()}{$e->getMessage()}",
  54038.                     $e->getCode(),
  54039.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  54040.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  54041.                 );
  54042.             }
  54043.             $statusCode $response->getStatusCode();
  54044.             if ($statusCode 200 || $statusCode 299) {
  54045.                 throw new ApiException(
  54046.                     sprintf(
  54047.                         '[%d] Error connecting to the API (%s)',
  54048.                         $statusCode,
  54049.                         $request->getUri()
  54050.                     ),
  54051.                     $statusCode,
  54052.                     $response->getHeaders(),
  54053.                     $response->getBody()
  54054.                 );
  54055.             }
  54056.             $responseBody $response->getBody();
  54057.             switch($statusCode) {
  54058.                 case 200:
  54059.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Attachments' === '\SplFileObject') {
  54060.                         $content $responseBody//stream goes to serializer
  54061.                     } else {
  54062.                         $content $responseBody->getContents();
  54063.                     }
  54064.                     return [
  54065.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Attachments', []),
  54066.                         $response->getStatusCode(),
  54067.                         $response->getHeaders()
  54068.                     ];
  54069.                 case 400:
  54070.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  54071.                         $content $responseBody//stream goes to serializer
  54072.                     } else {
  54073.                         $content $responseBody->getContents();
  54074.                     }
  54075.                     return [
  54076.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  54077.                         $response->getStatusCode(),
  54078.                         $response->getHeaders()
  54079.                     ];
  54080.             }
  54081.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  54082.             $responseBody $response->getBody();
  54083.             if ($returnType === '\SplFileObject') {
  54084.                 $content $responseBody//stream goes to serializer
  54085.             } else {
  54086.                 $content $responseBody->getContents();
  54087.             }
  54088.             return [
  54089.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  54090.                 $response->getStatusCode(),
  54091.                 $response->getHeaders()
  54092.             ];
  54093.         } catch (ApiException $e) {
  54094.             switch ($e->getCode()) {
  54095.                 case 200:
  54096.                     $data AccountingObjectSerializer::deserialize(
  54097.                         $e->getResponseBody(),
  54098.                         '\XeroAPI\XeroPHP\Models\Accounting\Attachments',
  54099.                         $e->getResponseHeaders()
  54100.                     );
  54101.                     $e->setResponseObject($data);
  54102.                     break;
  54103.                 case 400:
  54104.                     $data AccountingObjectSerializer::deserialize(
  54105.                         $e->getResponseBody(),
  54106.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  54107.                         $e->getResponseHeaders()
  54108.                     );
  54109.                     $e->setResponseObject($data);
  54110.                     break;
  54111.             }
  54112.             throw $e;
  54113.         }
  54114.     }
  54115.     /**
  54116.      * Operation updateCreditNoteAttachmentByFileNameAsync
  54117.      * Updates attachments on a specific credit note by file name
  54118.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  54119.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  54120.      * @param  string $file_name Name of the attachment (required)
  54121.      * @param  string $body Byte array of file in body of request (required)
  54122.      * @throws \InvalidArgumentException
  54123.      * @return \GuzzleHttp\Promise\PromiseInterface
  54124.      */
  54125.     public function updateCreditNoteAttachmentByFileNameAsync($xero_tenant_id$credit_note_id$file_name$body)
  54126.     {
  54127.         return $this->updateCreditNoteAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$credit_note_id$file_name$body)
  54128.             ->then(
  54129.                 function ($response) {
  54130.                     return $response[0];
  54131.                 }
  54132.             );
  54133.     }
  54134.     /**
  54135.      * Operation updateCreditNoteAttachmentByFileNameAsyncWithHttpInfo
  54136.      * Updates attachments on a specific credit note by file name
  54137.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  54138.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  54139.      * @param  string $file_name Name of the attachment (required)
  54140.      * @param  string $body Byte array of file in body of request (required)
  54141.      * @throws \InvalidArgumentException
  54142.      * @return \GuzzleHttp\Promise\PromiseInterface */
  54143.     public function updateCreditNoteAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$credit_note_id$file_name$body)
  54144.     {
  54145.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  54146.         $request $this->updateCreditNoteAttachmentByFileNameRequest($xero_tenant_id$credit_note_id$file_name$body);
  54147.         return $this->client
  54148.             ->sendAsync($request$this->createHttpClientOption())
  54149.             ->then(
  54150.                 function ($response) use ($returnType) {
  54151.                     $responseBody $response->getBody();
  54152.                     if ($returnType === '\SplFileObject') {
  54153.                         $content $responseBody//stream goes to serializer
  54154.                     } else {
  54155.                         $content $responseBody->getContents();
  54156.                     }
  54157.                     return [
  54158.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  54159.                         $response->getStatusCode(),
  54160.                         $response->getHeaders()
  54161.                     ];
  54162.                 },
  54163.                 function ($exception) {
  54164.                     $response $exception->getResponse();
  54165.                     $statusCode $response->getStatusCode();
  54166.                     throw new ApiException(
  54167.                         sprintf(
  54168.                             '[%d] Error connecting to the API (%s)',
  54169.                             $statusCode,
  54170.                             $exception->getRequest()->getUri()
  54171.                         ),
  54172.                         $statusCode,
  54173.                         $response->getHeaders(),
  54174.                         $response->getBody()
  54175.                     );
  54176.                 }
  54177.             );
  54178.     }
  54179.     /**
  54180.      * Create request for operation 'updateCreditNoteAttachmentByFileName'
  54181.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  54182.      * @param  string $credit_note_id Unique identifier for a Credit Note (required)
  54183.      * @param  string $file_name Name of the attachment (required)
  54184.      * @param  string $body Byte array of file in body of request (required)
  54185.      * @throws \InvalidArgumentException
  54186.      * @return \GuzzleHttp\Psr7\Request  */
  54187.     protected function updateCreditNoteAttachmentByFileNameRequest($xero_tenant_id$credit_note_id$file_name$body)
  54188.     {
  54189.         // verify the required parameter 'xero_tenant_id' is set
  54190.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  54191.             throw new \InvalidArgumentException(
  54192.                 'Missing the required parameter $xero_tenant_id when calling updateCreditNoteAttachmentByFileName'
  54193.             );
  54194.         }
  54195.         // verify the required parameter 'credit_note_id' is set
  54196.         if ($credit_note_id === null || (is_array($credit_note_id) && count($credit_note_id) === 0)) {
  54197.             throw new \InvalidArgumentException(
  54198.                 'Missing the required parameter $credit_note_id when calling updateCreditNoteAttachmentByFileName'
  54199.             );
  54200.         }
  54201.         // verify the required parameter 'file_name' is set
  54202.         if ($file_name === null || (is_array($file_name) && count($file_name) === 0)) {
  54203.             throw new \InvalidArgumentException(
  54204.                 'Missing the required parameter $file_name when calling updateCreditNoteAttachmentByFileName'
  54205.             );
  54206.         }
  54207.         // verify the required parameter 'body' is set
  54208.         if ($body === null || (is_array($body) && count($body) === 0)) {
  54209.             throw new \InvalidArgumentException(
  54210.                 'Missing the required parameter $body when calling updateCreditNoteAttachmentByFileName'
  54211.             );
  54212.         }
  54213.         $resourcePath '/CreditNotes/{CreditNoteID}/Attachments/{FileName}';
  54214.         $formParams = [];
  54215.         $queryParams = [];
  54216.         $headerParams = [];
  54217.         $httpBody '';
  54218.         $multipart false;
  54219.         // header params
  54220.         if ($xero_tenant_id !== null) {
  54221.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  54222.         }
  54223.         // path params
  54224.         if ($credit_note_id !== null) {
  54225.             $resourcePath str_replace(
  54226.                 '{' 'CreditNoteID' '}',
  54227.                 AccountingObjectSerializer::toPathValue($credit_note_id),
  54228.                 $resourcePath
  54229.             );
  54230.         }
  54231.         // path params
  54232.         if ($file_name !== null) {
  54233.             $resourcePath str_replace(
  54234.                 '{' 'FileName' '}',
  54235.                 AccountingObjectSerializer::toPathValue($file_name),
  54236.                 $resourcePath
  54237.             );
  54238.         }
  54239.         // body params
  54240.         $_tempBody null;
  54241.         if (isset($body)) {
  54242.             $_tempBody $body;
  54243.         }
  54244.         if ($multipart) {
  54245.             $headers $this->headerSelector->selectHeadersForMultipart(
  54246.                 ['application/json']
  54247.             );
  54248.         } else {
  54249.             $headers $this->headerSelector->selectHeaders(
  54250.                 ['application/json'],
  54251.                 ['application/octet-stream']
  54252.             );
  54253.         }
  54254.         // for model (json/xml)
  54255.         if (isset($_tempBody)) {
  54256.             // $_tempBody is the method argument, if present
  54257.             if ($headers['Content-Type'] === 'application/json') {
  54258.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  54259.             } else {
  54260.                 $httpBody $_tempBody;
  54261.             }
  54262.         } elseif (count($formParams) > 0) {
  54263.             if ($multipart) {
  54264.                 $multipartContents = [
  54265.                     [
  54266.                         'Content-type' => 'multipart/form-data',
  54267.                     ]
  54268.                 ];
  54269.                 
  54270.                 // for HTTP post (form)
  54271.                 $httpBody = new MultipartStream($multipartContents);
  54272.             } elseif ($headers['Content-Type'] === 'application/json') {
  54273.                 $httpBody \GuzzleHttp\json_encode($formParams);
  54274.             } else {
  54275.                 // for HTTP post (form)
  54276.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  54277.             }
  54278.         }
  54279.         // this endpoint requires OAuth (access token)
  54280.         if ($this->config->getAccessToken() !== null) {
  54281.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  54282.         }
  54283.         $defaultHeaders = [];
  54284.         if ($this->config->getUserAgent()) {
  54285.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  54286.         }
  54287.         $headers array_merge(
  54288.             $defaultHeaders,
  54289.             $headerParams,
  54290.             $headers
  54291.         );
  54292.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  54293.         return new Request(
  54294.             'POST',
  54295.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  54296.             $headers,
  54297.             $httpBody
  54298.         );
  54299.     }
  54300.     /**
  54301.      * Operation updateExpenseClaim
  54302.      * Updates a specific expense claims
  54303.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  54304.      * @param  string $expense_claim_id Unique identifier for a ExpenseClaim (required)
  54305.      * @param  \XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims $expense_claims expense_claims (required)
  54306.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  54307.      * @throws \InvalidArgumentException
  54308.      * @return \XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims|\XeroAPI\XeroPHP\Models\Accounting\Error
  54309.      */
  54310.     public function updateExpenseClaim($xero_tenant_id$expense_claim_id$expense_claims)
  54311.     {
  54312.         list($response) = $this->updateExpenseClaimWithHttpInfo($xero_tenant_id$expense_claim_id$expense_claims);
  54313.         return $response;
  54314.     }
  54315.     /**
  54316.      * Operation updateExpenseClaimWithHttpInfo
  54317.      * Updates a specific expense claims
  54318.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  54319.      * @param  string $expense_claim_id Unique identifier for a ExpenseClaim (required)
  54320.      * @param  \XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims $expense_claims (required)
  54321.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  54322.      * @throws \InvalidArgumentException
  54323.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  54324.      */
  54325.     public function updateExpenseClaimWithHttpInfo($xero_tenant_id$expense_claim_id$expense_claims)
  54326.     {
  54327.         $request $this->updateExpenseClaimRequest($xero_tenant_id$expense_claim_id$expense_claims);
  54328.         try {
  54329.             $options $this->createHttpClientOption();
  54330.             try {
  54331.                 $response $this->client->send($request$options);
  54332.             } catch (RequestException $e) {
  54333.                 throw new ApiException(
  54334.                     "[{$e->getCode()}{$e->getMessage()}",
  54335.                     $e->getCode(),
  54336.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  54337.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  54338.                 );
  54339.             }
  54340.             $statusCode $response->getStatusCode();
  54341.             if ($statusCode 200 || $statusCode 299) {
  54342.                 throw new ApiException(
  54343.                     sprintf(
  54344.                         '[%d] Error connecting to the API (%s)',
  54345.                         $statusCode,
  54346.                         $request->getUri()
  54347.                     ),
  54348.                     $statusCode,
  54349.                     $response->getHeaders(),
  54350.                     $response->getBody()
  54351.                 );
  54352.             }
  54353.             $responseBody $response->getBody();
  54354.             switch($statusCode) {
  54355.                 case 200:
  54356.                     if ('\XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims' === '\SplFileObject') {
  54357.                         $content $responseBody//stream goes to serializer
  54358.                     } else {
  54359.                         $content $responseBody->getContents();
  54360.                     }
  54361.                     return [
  54362.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims', []),
  54363.                         $response->getStatusCode(),
  54364.                         $response->getHeaders()
  54365.                     ];
  54366.                 case 400:
  54367.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  54368.                         $content $responseBody//stream goes to serializer
  54369.                     } else {
  54370.                         $content $responseBody->getContents();
  54371.                     }
  54372.                     return [
  54373.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  54374.                         $response->getStatusCode(),
  54375.                         $response->getHeaders()
  54376.                     ];
  54377.             }
  54378.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims';
  54379.             $responseBody $response->getBody();
  54380.             if ($returnType === '\SplFileObject') {
  54381.                 $content $responseBody//stream goes to serializer
  54382.             } else {
  54383.                 $content $responseBody->getContents();
  54384.             }
  54385.             return [
  54386.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  54387.                 $response->getStatusCode(),
  54388.                 $response->getHeaders()
  54389.             ];
  54390.         } catch (ApiException $e) {
  54391.             switch ($e->getCode()) {
  54392.                 case 200:
  54393.                     $data AccountingObjectSerializer::deserialize(
  54394.                         $e->getResponseBody(),
  54395.                         '\XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims',
  54396.                         $e->getResponseHeaders()
  54397.                     );
  54398.                     $e->setResponseObject($data);
  54399.                     break;
  54400.                 case 400:
  54401.                     $data AccountingObjectSerializer::deserialize(
  54402.                         $e->getResponseBody(),
  54403.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  54404.                         $e->getResponseHeaders()
  54405.                     );
  54406.                     $e->setResponseObject($data);
  54407.                     break;
  54408.             }
  54409.             throw $e;
  54410.         }
  54411.     }
  54412.     /**
  54413.      * Operation updateExpenseClaimAsync
  54414.      * Updates a specific expense claims
  54415.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  54416.      * @param  string $expense_claim_id Unique identifier for a ExpenseClaim (required)
  54417.      * @param  \XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims $expense_claims (required)
  54418.      * @throws \InvalidArgumentException
  54419.      * @return \GuzzleHttp\Promise\PromiseInterface
  54420.      */
  54421.     public function updateExpenseClaimAsync($xero_tenant_id$expense_claim_id$expense_claims)
  54422.     {
  54423.         return $this->updateExpenseClaimAsyncWithHttpInfo($xero_tenant_id$expense_claim_id$expense_claims)
  54424.             ->then(
  54425.                 function ($response) {
  54426.                     return $response[0];
  54427.                 }
  54428.             );
  54429.     }
  54430.     /**
  54431.      * Operation updateExpenseClaimAsyncWithHttpInfo
  54432.      * Updates a specific expense claims
  54433.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  54434.      * @param  string $expense_claim_id Unique identifier for a ExpenseClaim (required)
  54435.      * @param  \XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims $expense_claims (required)
  54436.      * @throws \InvalidArgumentException
  54437.      * @return \GuzzleHttp\Promise\PromiseInterface */
  54438.     public function updateExpenseClaimAsyncWithHttpInfo($xero_tenant_id$expense_claim_id$expense_claims)
  54439.     {
  54440.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims';
  54441.         $request $this->updateExpenseClaimRequest($xero_tenant_id$expense_claim_id$expense_claims);
  54442.         return $this->client
  54443.             ->sendAsync($request$this->createHttpClientOption())
  54444.             ->then(
  54445.                 function ($response) use ($returnType) {
  54446.                     $responseBody $response->getBody();
  54447.                     if ($returnType === '\SplFileObject') {
  54448.                         $content $responseBody//stream goes to serializer
  54449.                     } else {
  54450.                         $content $responseBody->getContents();
  54451.                     }
  54452.                     return [
  54453.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  54454.                         $response->getStatusCode(),
  54455.                         $response->getHeaders()
  54456.                     ];
  54457.                 },
  54458.                 function ($exception) {
  54459.                     $response $exception->getResponse();
  54460.                     $statusCode $response->getStatusCode();
  54461.                     throw new ApiException(
  54462.                         sprintf(
  54463.                             '[%d] Error connecting to the API (%s)',
  54464.                             $statusCode,
  54465.                             $exception->getRequest()->getUri()
  54466.                         ),
  54467.                         $statusCode,
  54468.                         $response->getHeaders(),
  54469.                         $response->getBody()
  54470.                     );
  54471.                 }
  54472.             );
  54473.     }
  54474.     /**
  54475.      * Create request for operation 'updateExpenseClaim'
  54476.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  54477.      * @param  string $expense_claim_id Unique identifier for a ExpenseClaim (required)
  54478.      * @param  \XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims $expense_claims (required)
  54479.      * @throws \InvalidArgumentException
  54480.      * @return \GuzzleHttp\Psr7\Request  */
  54481.     protected function updateExpenseClaimRequest($xero_tenant_id$expense_claim_id$expense_claims)
  54482.     {
  54483.         // verify the required parameter 'xero_tenant_id' is set
  54484.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  54485.             throw new \InvalidArgumentException(
  54486.                 'Missing the required parameter $xero_tenant_id when calling updateExpenseClaim'
  54487.             );
  54488.         }
  54489.         // verify the required parameter 'expense_claim_id' is set
  54490.         if ($expense_claim_id === null || (is_array($expense_claim_id) && count($expense_claim_id) === 0)) {
  54491.             throw new \InvalidArgumentException(
  54492.                 'Missing the required parameter $expense_claim_id when calling updateExpenseClaim'
  54493.             );
  54494.         }
  54495.         // verify the required parameter 'expense_claims' is set
  54496.         if ($expense_claims === null || (is_array($expense_claims) && count($expense_claims) === 0)) {
  54497.             throw new \InvalidArgumentException(
  54498.                 'Missing the required parameter $expense_claims when calling updateExpenseClaim'
  54499.             );
  54500.         }
  54501.         $resourcePath '/ExpenseClaims/{ExpenseClaimID}';
  54502.         $formParams = [];
  54503.         $queryParams = [];
  54504.         $headerParams = [];
  54505.         $httpBody '';
  54506.         $multipart false;
  54507.         // header params
  54508.         if ($xero_tenant_id !== null) {
  54509.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  54510.         }
  54511.         // path params
  54512.         if ($expense_claim_id !== null) {
  54513.             $resourcePath str_replace(
  54514.                 '{' 'ExpenseClaimID' '}',
  54515.                 AccountingObjectSerializer::toPathValue($expense_claim_id),
  54516.                 $resourcePath
  54517.             );
  54518.         }
  54519.         // body params
  54520.         $_tempBody null;
  54521.         if (isset($expense_claims)) {
  54522.             $_tempBody $expense_claims;
  54523.         }
  54524.         if ($multipart) {
  54525.             $headers $this->headerSelector->selectHeadersForMultipart(
  54526.                 ['application/json']
  54527.             );
  54528.         } else {
  54529.             $headers $this->headerSelector->selectHeaders(
  54530.                 ['application/json'],
  54531.                 ['application/json']
  54532.             );
  54533.         }
  54534.         // for model (json/xml)
  54535.         if (isset($_tempBody)) {
  54536.             // $_tempBody is the method argument, if present
  54537.             if ($headers['Content-Type'] === 'application/json') {
  54538.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  54539.             } else {
  54540.                 $httpBody $_tempBody;
  54541.             }
  54542.         } elseif (count($formParams) > 0) {
  54543.             if ($multipart) {
  54544.                 $multipartContents = [
  54545.                     [
  54546.                         'Content-type' => 'multipart/form-data',
  54547.                     ]
  54548.                 ];
  54549.                 
  54550.                 // for HTTP post (form)
  54551.                 $httpBody = new MultipartStream($multipartContents);
  54552.             } elseif ($headers['Content-Type'] === 'application/json') {
  54553.                 $httpBody \GuzzleHttp\json_encode($formParams);
  54554.             } else {
  54555.                 // for HTTP post (form)
  54556.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  54557.             }
  54558.         }
  54559.         // this endpoint requires OAuth (access token)
  54560.         if ($this->config->getAccessToken() !== null) {
  54561.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  54562.         }
  54563.         $defaultHeaders = [];
  54564.         if ($this->config->getUserAgent()) {
  54565.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  54566.         }
  54567.         $headers array_merge(
  54568.             $defaultHeaders,
  54569.             $headerParams,
  54570.             $headers
  54571.         );
  54572.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  54573.         return new Request(
  54574.             'POST',
  54575.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  54576.             $headers,
  54577.             $httpBody
  54578.         );
  54579.     }
  54580.     /**
  54581.      * Operation updateInvoice
  54582.      * Updates a specific sales invoices or purchase bills
  54583.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  54584.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  54585.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Invoices $invoices invoices (required)
  54586.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  54587.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  54588.      * @throws \InvalidArgumentException
  54589.      * @return \XeroAPI\XeroPHP\Models\Accounting\Invoices|\XeroAPI\XeroPHP\Models\Accounting\Error
  54590.      */
  54591.     public function updateInvoice($xero_tenant_id$invoice_id$invoices$unitdp null)
  54592.     {
  54593.         list($response) = $this->updateInvoiceWithHttpInfo($xero_tenant_id$invoice_id$invoices$unitdp);
  54594.         return $response;
  54595.     }
  54596.     /**
  54597.      * Operation updateInvoiceWithHttpInfo
  54598.      * Updates a specific sales invoices or purchase bills
  54599.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  54600.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  54601.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Invoices $invoices (required)
  54602.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  54603.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  54604.      * @throws \InvalidArgumentException
  54605.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Invoices|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  54606.      */
  54607.     public function updateInvoiceWithHttpInfo($xero_tenant_id$invoice_id$invoices$unitdp null)
  54608.     {
  54609.         $request $this->updateInvoiceRequest($xero_tenant_id$invoice_id$invoices$unitdp);
  54610.         try {
  54611.             $options $this->createHttpClientOption();
  54612.             try {
  54613.                 $response $this->client->send($request$options);
  54614.             } catch (RequestException $e) {
  54615.                 throw new ApiException(
  54616.                     "[{$e->getCode()}{$e->getMessage()}",
  54617.                     $e->getCode(),
  54618.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  54619.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  54620.                 );
  54621.             }
  54622.             $statusCode $response->getStatusCode();
  54623.             if ($statusCode 200 || $statusCode 299) {
  54624.                 throw new ApiException(
  54625.                     sprintf(
  54626.                         '[%d] Error connecting to the API (%s)',
  54627.                         $statusCode,
  54628.                         $request->getUri()
  54629.                     ),
  54630.                     $statusCode,
  54631.                     $response->getHeaders(),
  54632.                     $response->getBody()
  54633.                 );
  54634.             }
  54635.             $responseBody $response->getBody();
  54636.             switch($statusCode) {
  54637.                 case 200:
  54638.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Invoices' === '\SplFileObject') {
  54639.                         $content $responseBody//stream goes to serializer
  54640.                     } else {
  54641.                         $content $responseBody->getContents();
  54642.                     }
  54643.                     return [
  54644.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Invoices', []),
  54645.                         $response->getStatusCode(),
  54646.                         $response->getHeaders()
  54647.                     ];
  54648.                 case 400:
  54649.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  54650.                         $content $responseBody//stream goes to serializer
  54651.                     } else {
  54652.                         $content $responseBody->getContents();
  54653.                     }
  54654.                     return [
  54655.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  54656.                         $response->getStatusCode(),
  54657.                         $response->getHeaders()
  54658.                     ];
  54659.             }
  54660.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Invoices';
  54661.             $responseBody $response->getBody();
  54662.             if ($returnType === '\SplFileObject') {
  54663.                 $content $responseBody//stream goes to serializer
  54664.             } else {
  54665.                 $content $responseBody->getContents();
  54666.             }
  54667.             return [
  54668.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  54669.                 $response->getStatusCode(),
  54670.                 $response->getHeaders()
  54671.             ];
  54672.         } catch (ApiException $e) {
  54673.             switch ($e->getCode()) {
  54674.                 case 200:
  54675.                     $data AccountingObjectSerializer::deserialize(
  54676.                         $e->getResponseBody(),
  54677.                         '\XeroAPI\XeroPHP\Models\Accounting\Invoices',
  54678.                         $e->getResponseHeaders()
  54679.                     );
  54680.                     $e->setResponseObject($data);
  54681.                     break;
  54682.                 case 400:
  54683.                     $data AccountingObjectSerializer::deserialize(
  54684.                         $e->getResponseBody(),
  54685.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  54686.                         $e->getResponseHeaders()
  54687.                     );
  54688.                     $e->setResponseObject($data);
  54689.                     break;
  54690.             }
  54691.             throw $e;
  54692.         }
  54693.     }
  54694.     /**
  54695.      * Operation updateInvoiceAsync
  54696.      * Updates a specific sales invoices or purchase bills
  54697.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  54698.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  54699.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Invoices $invoices (required)
  54700.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  54701.      * @throws \InvalidArgumentException
  54702.      * @return \GuzzleHttp\Promise\PromiseInterface
  54703.      */
  54704.     public function updateInvoiceAsync($xero_tenant_id$invoice_id$invoices$unitdp null)
  54705.     {
  54706.         return $this->updateInvoiceAsyncWithHttpInfo($xero_tenant_id$invoice_id$invoices$unitdp)
  54707.             ->then(
  54708.                 function ($response) {
  54709.                     return $response[0];
  54710.                 }
  54711.             );
  54712.     }
  54713.     /**
  54714.      * Operation updateInvoiceAsyncWithHttpInfo
  54715.      * Updates a specific sales invoices or purchase bills
  54716.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  54717.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  54718.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Invoices $invoices (required)
  54719.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  54720.      * @throws \InvalidArgumentException
  54721.      * @return \GuzzleHttp\Promise\PromiseInterface */
  54722.     public function updateInvoiceAsyncWithHttpInfo($xero_tenant_id$invoice_id$invoices$unitdp null)
  54723.     {
  54724.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Invoices';
  54725.         $request $this->updateInvoiceRequest($xero_tenant_id$invoice_id$invoices$unitdp);
  54726.         return $this->client
  54727.             ->sendAsync($request$this->createHttpClientOption())
  54728.             ->then(
  54729.                 function ($response) use ($returnType) {
  54730.                     $responseBody $response->getBody();
  54731.                     if ($returnType === '\SplFileObject') {
  54732.                         $content $responseBody//stream goes to serializer
  54733.                     } else {
  54734.                         $content $responseBody->getContents();
  54735.                     }
  54736.                     return [
  54737.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  54738.                         $response->getStatusCode(),
  54739.                         $response->getHeaders()
  54740.                     ];
  54741.                 },
  54742.                 function ($exception) {
  54743.                     $response $exception->getResponse();
  54744.                     $statusCode $response->getStatusCode();
  54745.                     throw new ApiException(
  54746.                         sprintf(
  54747.                             '[%d] Error connecting to the API (%s)',
  54748.                             $statusCode,
  54749.                             $exception->getRequest()->getUri()
  54750.                         ),
  54751.                         $statusCode,
  54752.                         $response->getHeaders(),
  54753.                         $response->getBody()
  54754.                     );
  54755.                 }
  54756.             );
  54757.     }
  54758.     /**
  54759.      * Create request for operation 'updateInvoice'
  54760.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  54761.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  54762.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Invoices $invoices (required)
  54763.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  54764.      * @throws \InvalidArgumentException
  54765.      * @return \GuzzleHttp\Psr7\Request  */
  54766.     protected function updateInvoiceRequest($xero_tenant_id$invoice_id$invoices$unitdp null)
  54767.     {
  54768.         // verify the required parameter 'xero_tenant_id' is set
  54769.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  54770.             throw new \InvalidArgumentException(
  54771.                 'Missing the required parameter $xero_tenant_id when calling updateInvoice'
  54772.             );
  54773.         }
  54774.         // verify the required parameter 'invoice_id' is set
  54775.         if ($invoice_id === null || (is_array($invoice_id) && count($invoice_id) === 0)) {
  54776.             throw new \InvalidArgumentException(
  54777.                 'Missing the required parameter $invoice_id when calling updateInvoice'
  54778.             );
  54779.         }
  54780.         // verify the required parameter 'invoices' is set
  54781.         if ($invoices === null || (is_array($invoices) && count($invoices) === 0)) {
  54782.             throw new \InvalidArgumentException(
  54783.                 'Missing the required parameter $invoices when calling updateInvoice'
  54784.             );
  54785.         }
  54786.         $resourcePath '/Invoices/{InvoiceID}';
  54787.         $formParams = [];
  54788.         $queryParams = [];
  54789.         $headerParams = [];
  54790.         $httpBody '';
  54791.         $multipart false;
  54792.         // query params
  54793.         if ($unitdp !== null) {
  54794.             $queryParams['unitdp'] = AccountingObjectSerializer::toQueryValue($unitdp);
  54795.         }
  54796.         // header params
  54797.         if ($xero_tenant_id !== null) {
  54798.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  54799.         }
  54800.         // path params
  54801.         if ($invoice_id !== null) {
  54802.             $resourcePath str_replace(
  54803.                 '{' 'InvoiceID' '}',
  54804.                 AccountingObjectSerializer::toPathValue($invoice_id),
  54805.                 $resourcePath
  54806.             );
  54807.         }
  54808.         // body params
  54809.         $_tempBody null;
  54810.         if (isset($invoices)) {
  54811.             $_tempBody $invoices;
  54812.         }
  54813.         if ($multipart) {
  54814.             $headers $this->headerSelector->selectHeadersForMultipart(
  54815.                 ['application/json']
  54816.             );
  54817.         } else {
  54818.             $headers $this->headerSelector->selectHeaders(
  54819.                 ['application/json'],
  54820.                 ['application/json']
  54821.             );
  54822.         }
  54823.         // for model (json/xml)
  54824.         if (isset($_tempBody)) {
  54825.             // $_tempBody is the method argument, if present
  54826.             if ($headers['Content-Type'] === 'application/json') {
  54827.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  54828.             } else {
  54829.                 $httpBody $_tempBody;
  54830.             }
  54831.         } elseif (count($formParams) > 0) {
  54832.             if ($multipart) {
  54833.                 $multipartContents = [
  54834.                     [
  54835.                         'Content-type' => 'multipart/form-data',
  54836.                     ]
  54837.                 ];
  54838.                 
  54839.                 // for HTTP post (form)
  54840.                 $httpBody = new MultipartStream($multipartContents);
  54841.             } elseif ($headers['Content-Type'] === 'application/json') {
  54842.                 $httpBody \GuzzleHttp\json_encode($formParams);
  54843.             } else {
  54844.                 // for HTTP post (form)
  54845.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  54846.             }
  54847.         }
  54848.         // this endpoint requires OAuth (access token)
  54849.         if ($this->config->getAccessToken() !== null) {
  54850.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  54851.         }
  54852.         $defaultHeaders = [];
  54853.         if ($this->config->getUserAgent()) {
  54854.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  54855.         }
  54856.         $headers array_merge(
  54857.             $defaultHeaders,
  54858.             $headerParams,
  54859.             $headers
  54860.         );
  54861.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  54862.         return new Request(
  54863.             'POST',
  54864.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  54865.             $headers,
  54866.             $httpBody
  54867.         );
  54868.     }
  54869.     /**
  54870.      * Operation updateInvoiceAttachmentByFileName
  54871.      * Updates an attachment from a specific invoices or purchase bill by filename
  54872.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  54873.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  54874.      * @param  string $file_name Name of the attachment (required)
  54875.      * @param  string $body Byte array of file in body of request (required)
  54876.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  54877.      * @throws \InvalidArgumentException
  54878.      * @return \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error
  54879.      */
  54880.     public function updateInvoiceAttachmentByFileName($xero_tenant_id$invoice_id$file_name$body)
  54881.     {
  54882.         list($response) = $this->updateInvoiceAttachmentByFileNameWithHttpInfo($xero_tenant_id$invoice_id$file_name$body);
  54883.         return $response;
  54884.     }
  54885.     /**
  54886.      * Operation updateInvoiceAttachmentByFileNameWithHttpInfo
  54887.      * Updates an attachment from a specific invoices or purchase bill by filename
  54888.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  54889.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  54890.      * @param  string $file_name Name of the attachment (required)
  54891.      * @param  string $body Byte array of file in body of request (required)
  54892.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  54893.      * @throws \InvalidArgumentException
  54894.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  54895.      */
  54896.     public function updateInvoiceAttachmentByFileNameWithHttpInfo($xero_tenant_id$invoice_id$file_name$body)
  54897.     {
  54898.         $request $this->updateInvoiceAttachmentByFileNameRequest($xero_tenant_id$invoice_id$file_name$body);
  54899.         try {
  54900.             $options $this->createHttpClientOption();
  54901.             try {
  54902.                 $response $this->client->send($request$options);
  54903.             } catch (RequestException $e) {
  54904.                 throw new ApiException(
  54905.                     "[{$e->getCode()}{$e->getMessage()}",
  54906.                     $e->getCode(),
  54907.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  54908.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  54909.                 );
  54910.             }
  54911.             $statusCode $response->getStatusCode();
  54912.             if ($statusCode 200 || $statusCode 299) {
  54913.                 throw new ApiException(
  54914.                     sprintf(
  54915.                         '[%d] Error connecting to the API (%s)',
  54916.                         $statusCode,
  54917.                         $request->getUri()
  54918.                     ),
  54919.                     $statusCode,
  54920.                     $response->getHeaders(),
  54921.                     $response->getBody()
  54922.                 );
  54923.             }
  54924.             $responseBody $response->getBody();
  54925.             switch($statusCode) {
  54926.                 case 200:
  54927.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Attachments' === '\SplFileObject') {
  54928.                         $content $responseBody//stream goes to serializer
  54929.                     } else {
  54930.                         $content $responseBody->getContents();
  54931.                     }
  54932.                     return [
  54933.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Attachments', []),
  54934.                         $response->getStatusCode(),
  54935.                         $response->getHeaders()
  54936.                     ];
  54937.                 case 400:
  54938.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  54939.                         $content $responseBody//stream goes to serializer
  54940.                     } else {
  54941.                         $content $responseBody->getContents();
  54942.                     }
  54943.                     return [
  54944.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  54945.                         $response->getStatusCode(),
  54946.                         $response->getHeaders()
  54947.                     ];
  54948.             }
  54949.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  54950.             $responseBody $response->getBody();
  54951.             if ($returnType === '\SplFileObject') {
  54952.                 $content $responseBody//stream goes to serializer
  54953.             } else {
  54954.                 $content $responseBody->getContents();
  54955.             }
  54956.             return [
  54957.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  54958.                 $response->getStatusCode(),
  54959.                 $response->getHeaders()
  54960.             ];
  54961.         } catch (ApiException $e) {
  54962.             switch ($e->getCode()) {
  54963.                 case 200:
  54964.                     $data AccountingObjectSerializer::deserialize(
  54965.                         $e->getResponseBody(),
  54966.                         '\XeroAPI\XeroPHP\Models\Accounting\Attachments',
  54967.                         $e->getResponseHeaders()
  54968.                     );
  54969.                     $e->setResponseObject($data);
  54970.                     break;
  54971.                 case 400:
  54972.                     $data AccountingObjectSerializer::deserialize(
  54973.                         $e->getResponseBody(),
  54974.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  54975.                         $e->getResponseHeaders()
  54976.                     );
  54977.                     $e->setResponseObject($data);
  54978.                     break;
  54979.             }
  54980.             throw $e;
  54981.         }
  54982.     }
  54983.     /**
  54984.      * Operation updateInvoiceAttachmentByFileNameAsync
  54985.      * Updates an attachment from a specific invoices or purchase bill by filename
  54986.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  54987.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  54988.      * @param  string $file_name Name of the attachment (required)
  54989.      * @param  string $body Byte array of file in body of request (required)
  54990.      * @throws \InvalidArgumentException
  54991.      * @return \GuzzleHttp\Promise\PromiseInterface
  54992.      */
  54993.     public function updateInvoiceAttachmentByFileNameAsync($xero_tenant_id$invoice_id$file_name$body)
  54994.     {
  54995.         return $this->updateInvoiceAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$invoice_id$file_name$body)
  54996.             ->then(
  54997.                 function ($response) {
  54998.                     return $response[0];
  54999.                 }
  55000.             );
  55001.     }
  55002.     /**
  55003.      * Operation updateInvoiceAttachmentByFileNameAsyncWithHttpInfo
  55004.      * Updates an attachment from a specific invoices or purchase bill by filename
  55005.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  55006.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  55007.      * @param  string $file_name Name of the attachment (required)
  55008.      * @param  string $body Byte array of file in body of request (required)
  55009.      * @throws \InvalidArgumentException
  55010.      * @return \GuzzleHttp\Promise\PromiseInterface */
  55011.     public function updateInvoiceAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$invoice_id$file_name$body)
  55012.     {
  55013.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  55014.         $request $this->updateInvoiceAttachmentByFileNameRequest($xero_tenant_id$invoice_id$file_name$body);
  55015.         return $this->client
  55016.             ->sendAsync($request$this->createHttpClientOption())
  55017.             ->then(
  55018.                 function ($response) use ($returnType) {
  55019.                     $responseBody $response->getBody();
  55020.                     if ($returnType === '\SplFileObject') {
  55021.                         $content $responseBody//stream goes to serializer
  55022.                     } else {
  55023.                         $content $responseBody->getContents();
  55024.                     }
  55025.                     return [
  55026.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  55027.                         $response->getStatusCode(),
  55028.                         $response->getHeaders()
  55029.                     ];
  55030.                 },
  55031.                 function ($exception) {
  55032.                     $response $exception->getResponse();
  55033.                     $statusCode $response->getStatusCode();
  55034.                     throw new ApiException(
  55035.                         sprintf(
  55036.                             '[%d] Error connecting to the API (%s)',
  55037.                             $statusCode,
  55038.                             $exception->getRequest()->getUri()
  55039.                         ),
  55040.                         $statusCode,
  55041.                         $response->getHeaders(),
  55042.                         $response->getBody()
  55043.                     );
  55044.                 }
  55045.             );
  55046.     }
  55047.     /**
  55048.      * Create request for operation 'updateInvoiceAttachmentByFileName'
  55049.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  55050.      * @param  string $invoice_id Unique identifier for an Invoice (required)
  55051.      * @param  string $file_name Name of the attachment (required)
  55052.      * @param  string $body Byte array of file in body of request (required)
  55053.      * @throws \InvalidArgumentException
  55054.      * @return \GuzzleHttp\Psr7\Request  */
  55055.     protected function updateInvoiceAttachmentByFileNameRequest($xero_tenant_id$invoice_id$file_name$body)
  55056.     {
  55057.         // verify the required parameter 'xero_tenant_id' is set
  55058.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  55059.             throw new \InvalidArgumentException(
  55060.                 'Missing the required parameter $xero_tenant_id when calling updateInvoiceAttachmentByFileName'
  55061.             );
  55062.         }
  55063.         // verify the required parameter 'invoice_id' is set
  55064.         if ($invoice_id === null || (is_array($invoice_id) && count($invoice_id) === 0)) {
  55065.             throw new \InvalidArgumentException(
  55066.                 'Missing the required parameter $invoice_id when calling updateInvoiceAttachmentByFileName'
  55067.             );
  55068.         }
  55069.         // verify the required parameter 'file_name' is set
  55070.         if ($file_name === null || (is_array($file_name) && count($file_name) === 0)) {
  55071.             throw new \InvalidArgumentException(
  55072.                 'Missing the required parameter $file_name when calling updateInvoiceAttachmentByFileName'
  55073.             );
  55074.         }
  55075.         // verify the required parameter 'body' is set
  55076.         if ($body === null || (is_array($body) && count($body) === 0)) {
  55077.             throw new \InvalidArgumentException(
  55078.                 'Missing the required parameter $body when calling updateInvoiceAttachmentByFileName'
  55079.             );
  55080.         }
  55081.         $resourcePath '/Invoices/{InvoiceID}/Attachments/{FileName}';
  55082.         $formParams = [];
  55083.         $queryParams = [];
  55084.         $headerParams = [];
  55085.         $httpBody '';
  55086.         $multipart false;
  55087.         // header params
  55088.         if ($xero_tenant_id !== null) {
  55089.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  55090.         }
  55091.         // path params
  55092.         if ($invoice_id !== null) {
  55093.             $resourcePath str_replace(
  55094.                 '{' 'InvoiceID' '}',
  55095.                 AccountingObjectSerializer::toPathValue($invoice_id),
  55096.                 $resourcePath
  55097.             );
  55098.         }
  55099.         // path params
  55100.         if ($file_name !== null) {
  55101.             $resourcePath str_replace(
  55102.                 '{' 'FileName' '}',
  55103.                 AccountingObjectSerializer::toPathValue($file_name),
  55104.                 $resourcePath
  55105.             );
  55106.         }
  55107.         // body params
  55108.         $_tempBody null;
  55109.         if (isset($body)) {
  55110.             $_tempBody $body;
  55111.         }
  55112.         if ($multipart) {
  55113.             $headers $this->headerSelector->selectHeadersForMultipart(
  55114.                 ['application/json']
  55115.             );
  55116.         } else {
  55117.             $headers $this->headerSelector->selectHeaders(
  55118.                 ['application/json'],
  55119.                 ['application/octet-stream']
  55120.             );
  55121.         }
  55122.         // for model (json/xml)
  55123.         if (isset($_tempBody)) {
  55124.             // $_tempBody is the method argument, if present
  55125.             if ($headers['Content-Type'] === 'application/json') {
  55126.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  55127.             } else {
  55128.                 $httpBody $_tempBody;
  55129.             }
  55130.         } elseif (count($formParams) > 0) {
  55131.             if ($multipart) {
  55132.                 $multipartContents = [
  55133.                     [
  55134.                         'Content-type' => 'multipart/form-data',
  55135.                     ]
  55136.                 ];
  55137.                 
  55138.                 // for HTTP post (form)
  55139.                 $httpBody = new MultipartStream($multipartContents);
  55140.             } elseif ($headers['Content-Type'] === 'application/json') {
  55141.                 $httpBody \GuzzleHttp\json_encode($formParams);
  55142.             } else {
  55143.                 // for HTTP post (form)
  55144.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  55145.             }
  55146.         }
  55147.         // this endpoint requires OAuth (access token)
  55148.         if ($this->config->getAccessToken() !== null) {
  55149.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  55150.         }
  55151.         $defaultHeaders = [];
  55152.         if ($this->config->getUserAgent()) {
  55153.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  55154.         }
  55155.         $headers array_merge(
  55156.             $defaultHeaders,
  55157.             $headerParams,
  55158.             $headers
  55159.         );
  55160.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  55161.         return new Request(
  55162.             'POST',
  55163.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  55164.             $headers,
  55165.             $httpBody
  55166.         );
  55167.     }
  55168.     /**
  55169.      * Operation updateItem
  55170.      * Updates a specific item
  55171.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  55172.      * @param  string $item_id Unique identifier for an Item (required)
  55173.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Items $items items (required)
  55174.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  55175.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  55176.      * @throws \InvalidArgumentException
  55177.      * @return \XeroAPI\XeroPHP\Models\Accounting\Items|\XeroAPI\XeroPHP\Models\Accounting\Error
  55178.      */
  55179.     public function updateItem($xero_tenant_id$item_id$items$unitdp null)
  55180.     {
  55181.         list($response) = $this->updateItemWithHttpInfo($xero_tenant_id$item_id$items$unitdp);
  55182.         return $response;
  55183.     }
  55184.     /**
  55185.      * Operation updateItemWithHttpInfo
  55186.      * Updates a specific item
  55187.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  55188.      * @param  string $item_id Unique identifier for an Item (required)
  55189.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Items $items (required)
  55190.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  55191.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  55192.      * @throws \InvalidArgumentException
  55193.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Items|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  55194.      */
  55195.     public function updateItemWithHttpInfo($xero_tenant_id$item_id$items$unitdp null)
  55196.     {
  55197.         $request $this->updateItemRequest($xero_tenant_id$item_id$items$unitdp);
  55198.         try {
  55199.             $options $this->createHttpClientOption();
  55200.             try {
  55201.                 $response $this->client->send($request$options);
  55202.             } catch (RequestException $e) {
  55203.                 throw new ApiException(
  55204.                     "[{$e->getCode()}{$e->getMessage()}",
  55205.                     $e->getCode(),
  55206.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  55207.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  55208.                 );
  55209.             }
  55210.             $statusCode $response->getStatusCode();
  55211.             if ($statusCode 200 || $statusCode 299) {
  55212.                 throw new ApiException(
  55213.                     sprintf(
  55214.                         '[%d] Error connecting to the API (%s)',
  55215.                         $statusCode,
  55216.                         $request->getUri()
  55217.                     ),
  55218.                     $statusCode,
  55219.                     $response->getHeaders(),
  55220.                     $response->getBody()
  55221.                 );
  55222.             }
  55223.             $responseBody $response->getBody();
  55224.             switch($statusCode) {
  55225.                 case 200:
  55226.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Items' === '\SplFileObject') {
  55227.                         $content $responseBody//stream goes to serializer
  55228.                     } else {
  55229.                         $content $responseBody->getContents();
  55230.                     }
  55231.                     return [
  55232.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Items', []),
  55233.                         $response->getStatusCode(),
  55234.                         $response->getHeaders()
  55235.                     ];
  55236.                 case 400:
  55237.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  55238.                         $content $responseBody//stream goes to serializer
  55239.                     } else {
  55240.                         $content $responseBody->getContents();
  55241.                     }
  55242.                     return [
  55243.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  55244.                         $response->getStatusCode(),
  55245.                         $response->getHeaders()
  55246.                     ];
  55247.             }
  55248.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Items';
  55249.             $responseBody $response->getBody();
  55250.             if ($returnType === '\SplFileObject') {
  55251.                 $content $responseBody//stream goes to serializer
  55252.             } else {
  55253.                 $content $responseBody->getContents();
  55254.             }
  55255.             return [
  55256.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  55257.                 $response->getStatusCode(),
  55258.                 $response->getHeaders()
  55259.             ];
  55260.         } catch (ApiException $e) {
  55261.             switch ($e->getCode()) {
  55262.                 case 200:
  55263.                     $data AccountingObjectSerializer::deserialize(
  55264.                         $e->getResponseBody(),
  55265.                         '\XeroAPI\XeroPHP\Models\Accounting\Items',
  55266.                         $e->getResponseHeaders()
  55267.                     );
  55268.                     $e->setResponseObject($data);
  55269.                     break;
  55270.                 case 400:
  55271.                     $data AccountingObjectSerializer::deserialize(
  55272.                         $e->getResponseBody(),
  55273.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  55274.                         $e->getResponseHeaders()
  55275.                     );
  55276.                     $e->setResponseObject($data);
  55277.                     break;
  55278.             }
  55279.             throw $e;
  55280.         }
  55281.     }
  55282.     /**
  55283.      * Operation updateItemAsync
  55284.      * Updates a specific item
  55285.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  55286.      * @param  string $item_id Unique identifier for an Item (required)
  55287.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Items $items (required)
  55288.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  55289.      * @throws \InvalidArgumentException
  55290.      * @return \GuzzleHttp\Promise\PromiseInterface
  55291.      */
  55292.     public function updateItemAsync($xero_tenant_id$item_id$items$unitdp null)
  55293.     {
  55294.         return $this->updateItemAsyncWithHttpInfo($xero_tenant_id$item_id$items$unitdp)
  55295.             ->then(
  55296.                 function ($response) {
  55297.                     return $response[0];
  55298.                 }
  55299.             );
  55300.     }
  55301.     /**
  55302.      * Operation updateItemAsyncWithHttpInfo
  55303.      * Updates a specific item
  55304.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  55305.      * @param  string $item_id Unique identifier for an Item (required)
  55306.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Items $items (required)
  55307.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  55308.      * @throws \InvalidArgumentException
  55309.      * @return \GuzzleHttp\Promise\PromiseInterface */
  55310.     public function updateItemAsyncWithHttpInfo($xero_tenant_id$item_id$items$unitdp null)
  55311.     {
  55312.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Items';
  55313.         $request $this->updateItemRequest($xero_tenant_id$item_id$items$unitdp);
  55314.         return $this->client
  55315.             ->sendAsync($request$this->createHttpClientOption())
  55316.             ->then(
  55317.                 function ($response) use ($returnType) {
  55318.                     $responseBody $response->getBody();
  55319.                     if ($returnType === '\SplFileObject') {
  55320.                         $content $responseBody//stream goes to serializer
  55321.                     } else {
  55322.                         $content $responseBody->getContents();
  55323.                     }
  55324.                     return [
  55325.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  55326.                         $response->getStatusCode(),
  55327.                         $response->getHeaders()
  55328.                     ];
  55329.                 },
  55330.                 function ($exception) {
  55331.                     $response $exception->getResponse();
  55332.                     $statusCode $response->getStatusCode();
  55333.                     throw new ApiException(
  55334.                         sprintf(
  55335.                             '[%d] Error connecting to the API (%s)',
  55336.                             $statusCode,
  55337.                             $exception->getRequest()->getUri()
  55338.                         ),
  55339.                         $statusCode,
  55340.                         $response->getHeaders(),
  55341.                         $response->getBody()
  55342.                     );
  55343.                 }
  55344.             );
  55345.     }
  55346.     /**
  55347.      * Create request for operation 'updateItem'
  55348.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  55349.      * @param  string $item_id Unique identifier for an Item (required)
  55350.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Items $items (required)
  55351.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  55352.      * @throws \InvalidArgumentException
  55353.      * @return \GuzzleHttp\Psr7\Request  */
  55354.     protected function updateItemRequest($xero_tenant_id$item_id$items$unitdp null)
  55355.     {
  55356.         // verify the required parameter 'xero_tenant_id' is set
  55357.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  55358.             throw new \InvalidArgumentException(
  55359.                 'Missing the required parameter $xero_tenant_id when calling updateItem'
  55360.             );
  55361.         }
  55362.         // verify the required parameter 'item_id' is set
  55363.         if ($item_id === null || (is_array($item_id) && count($item_id) === 0)) {
  55364.             throw new \InvalidArgumentException(
  55365.                 'Missing the required parameter $item_id when calling updateItem'
  55366.             );
  55367.         }
  55368.         // verify the required parameter 'items' is set
  55369.         if ($items === null || (is_array($items) && count($items) === 0)) {
  55370.             throw new \InvalidArgumentException(
  55371.                 'Missing the required parameter $items when calling updateItem'
  55372.             );
  55373.         }
  55374.         $resourcePath '/Items/{ItemID}';
  55375.         $formParams = [];
  55376.         $queryParams = [];
  55377.         $headerParams = [];
  55378.         $httpBody '';
  55379.         $multipart false;
  55380.         // query params
  55381.         if ($unitdp !== null) {
  55382.             $queryParams['unitdp'] = AccountingObjectSerializer::toQueryValue($unitdp);
  55383.         }
  55384.         // header params
  55385.         if ($xero_tenant_id !== null) {
  55386.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  55387.         }
  55388.         // path params
  55389.         if ($item_id !== null) {
  55390.             $resourcePath str_replace(
  55391.                 '{' 'ItemID' '}',
  55392.                 AccountingObjectSerializer::toPathValue($item_id),
  55393.                 $resourcePath
  55394.             );
  55395.         }
  55396.         // body params
  55397.         $_tempBody null;
  55398.         if (isset($items)) {
  55399.             $_tempBody $items;
  55400.         }
  55401.         if ($multipart) {
  55402.             $headers $this->headerSelector->selectHeadersForMultipart(
  55403.                 ['application/json']
  55404.             );
  55405.         } else {
  55406.             $headers $this->headerSelector->selectHeaders(
  55407.                 ['application/json'],
  55408.                 ['application/json']
  55409.             );
  55410.         }
  55411.         // for model (json/xml)
  55412.         if (isset($_tempBody)) {
  55413.             // $_tempBody is the method argument, if present
  55414.             if ($headers['Content-Type'] === 'application/json') {
  55415.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  55416.             } else {
  55417.                 $httpBody $_tempBody;
  55418.             }
  55419.         } elseif (count($formParams) > 0) {
  55420.             if ($multipart) {
  55421.                 $multipartContents = [
  55422.                     [
  55423.                         'Content-type' => 'multipart/form-data',
  55424.                     ]
  55425.                 ];
  55426.                 
  55427.                 // for HTTP post (form)
  55428.                 $httpBody = new MultipartStream($multipartContents);
  55429.             } elseif ($headers['Content-Type'] === 'application/json') {
  55430.                 $httpBody \GuzzleHttp\json_encode($formParams);
  55431.             } else {
  55432.                 // for HTTP post (form)
  55433.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  55434.             }
  55435.         }
  55436.         // this endpoint requires OAuth (access token)
  55437.         if ($this->config->getAccessToken() !== null) {
  55438.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  55439.         }
  55440.         $defaultHeaders = [];
  55441.         if ($this->config->getUserAgent()) {
  55442.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  55443.         }
  55444.         $headers array_merge(
  55445.             $defaultHeaders,
  55446.             $headerParams,
  55447.             $headers
  55448.         );
  55449.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  55450.         return new Request(
  55451.             'POST',
  55452.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  55453.             $headers,
  55454.             $httpBody
  55455.         );
  55456.     }
  55457.     /**
  55458.      * Operation updateLinkedTransaction
  55459.      * Updates a specific linked transactions (billable expenses)
  55460.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  55461.      * @param  string $linked_transaction_id Unique identifier for a LinkedTransaction (required)
  55462.      * @param  \XeroAPI\XeroPHP\Models\Accounting\LinkedTransactions $linked_transactions linked_transactions (required)
  55463.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  55464.      * @throws \InvalidArgumentException
  55465.      * @return \XeroAPI\XeroPHP\Models\Accounting\LinkedTransactions|\XeroAPI\XeroPHP\Models\Accounting\Error
  55466.      */
  55467.     public function updateLinkedTransaction($xero_tenant_id$linked_transaction_id$linked_transactions)
  55468.     {
  55469.         list($response) = $this->updateLinkedTransactionWithHttpInfo($xero_tenant_id$linked_transaction_id$linked_transactions);
  55470.         return $response;
  55471.     }
  55472.     /**
  55473.      * Operation updateLinkedTransactionWithHttpInfo
  55474.      * Updates a specific linked transactions (billable expenses)
  55475.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  55476.      * @param  string $linked_transaction_id Unique identifier for a LinkedTransaction (required)
  55477.      * @param  \XeroAPI\XeroPHP\Models\Accounting\LinkedTransactions $linked_transactions (required)
  55478.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  55479.      * @throws \InvalidArgumentException
  55480.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\LinkedTransactions|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  55481.      */
  55482.     public function updateLinkedTransactionWithHttpInfo($xero_tenant_id$linked_transaction_id$linked_transactions)
  55483.     {
  55484.         $request $this->updateLinkedTransactionRequest($xero_tenant_id$linked_transaction_id$linked_transactions);
  55485.         try {
  55486.             $options $this->createHttpClientOption();
  55487.             try {
  55488.                 $response $this->client->send($request$options);
  55489.             } catch (RequestException $e) {
  55490.                 throw new ApiException(
  55491.                     "[{$e->getCode()}{$e->getMessage()}",
  55492.                     $e->getCode(),
  55493.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  55494.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  55495.                 );
  55496.             }
  55497.             $statusCode $response->getStatusCode();
  55498.             if ($statusCode 200 || $statusCode 299) {
  55499.                 throw new ApiException(
  55500.                     sprintf(
  55501.                         '[%d] Error connecting to the API (%s)',
  55502.                         $statusCode,
  55503.                         $request->getUri()
  55504.                     ),
  55505.                     $statusCode,
  55506.                     $response->getHeaders(),
  55507.                     $response->getBody()
  55508.                 );
  55509.             }
  55510.             $responseBody $response->getBody();
  55511.             switch($statusCode) {
  55512.                 case 200:
  55513.                     if ('\XeroAPI\XeroPHP\Models\Accounting\LinkedTransactions' === '\SplFileObject') {
  55514.                         $content $responseBody//stream goes to serializer
  55515.                     } else {
  55516.                         $content $responseBody->getContents();
  55517.                     }
  55518.                     return [
  55519.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\LinkedTransactions', []),
  55520.                         $response->getStatusCode(),
  55521.                         $response->getHeaders()
  55522.                     ];
  55523.                 case 400:
  55524.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  55525.                         $content $responseBody//stream goes to serializer
  55526.                     } else {
  55527.                         $content $responseBody->getContents();
  55528.                     }
  55529.                     return [
  55530.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  55531.                         $response->getStatusCode(),
  55532.                         $response->getHeaders()
  55533.                     ];
  55534.             }
  55535.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\LinkedTransactions';
  55536.             $responseBody $response->getBody();
  55537.             if ($returnType === '\SplFileObject') {
  55538.                 $content $responseBody//stream goes to serializer
  55539.             } else {
  55540.                 $content $responseBody->getContents();
  55541.             }
  55542.             return [
  55543.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  55544.                 $response->getStatusCode(),
  55545.                 $response->getHeaders()
  55546.             ];
  55547.         } catch (ApiException $e) {
  55548.             switch ($e->getCode()) {
  55549.                 case 200:
  55550.                     $data AccountingObjectSerializer::deserialize(
  55551.                         $e->getResponseBody(),
  55552.                         '\XeroAPI\XeroPHP\Models\Accounting\LinkedTransactions',
  55553.                         $e->getResponseHeaders()
  55554.                     );
  55555.                     $e->setResponseObject($data);
  55556.                     break;
  55557.                 case 400:
  55558.                     $data AccountingObjectSerializer::deserialize(
  55559.                         $e->getResponseBody(),
  55560.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  55561.                         $e->getResponseHeaders()
  55562.                     );
  55563.                     $e->setResponseObject($data);
  55564.                     break;
  55565.             }
  55566.             throw $e;
  55567.         }
  55568.     }
  55569.     /**
  55570.      * Operation updateLinkedTransactionAsync
  55571.      * Updates a specific linked transactions (billable expenses)
  55572.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  55573.      * @param  string $linked_transaction_id Unique identifier for a LinkedTransaction (required)
  55574.      * @param  \XeroAPI\XeroPHP\Models\Accounting\LinkedTransactions $linked_transactions (required)
  55575.      * @throws \InvalidArgumentException
  55576.      * @return \GuzzleHttp\Promise\PromiseInterface
  55577.      */
  55578.     public function updateLinkedTransactionAsync($xero_tenant_id$linked_transaction_id$linked_transactions)
  55579.     {
  55580.         return $this->updateLinkedTransactionAsyncWithHttpInfo($xero_tenant_id$linked_transaction_id$linked_transactions)
  55581.             ->then(
  55582.                 function ($response) {
  55583.                     return $response[0];
  55584.                 }
  55585.             );
  55586.     }
  55587.     /**
  55588.      * Operation updateLinkedTransactionAsyncWithHttpInfo
  55589.      * Updates a specific linked transactions (billable expenses)
  55590.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  55591.      * @param  string $linked_transaction_id Unique identifier for a LinkedTransaction (required)
  55592.      * @param  \XeroAPI\XeroPHP\Models\Accounting\LinkedTransactions $linked_transactions (required)
  55593.      * @throws \InvalidArgumentException
  55594.      * @return \GuzzleHttp\Promise\PromiseInterface */
  55595.     public function updateLinkedTransactionAsyncWithHttpInfo($xero_tenant_id$linked_transaction_id$linked_transactions)
  55596.     {
  55597.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\LinkedTransactions';
  55598.         $request $this->updateLinkedTransactionRequest($xero_tenant_id$linked_transaction_id$linked_transactions);
  55599.         return $this->client
  55600.             ->sendAsync($request$this->createHttpClientOption())
  55601.             ->then(
  55602.                 function ($response) use ($returnType) {
  55603.                     $responseBody $response->getBody();
  55604.                     if ($returnType === '\SplFileObject') {
  55605.                         $content $responseBody//stream goes to serializer
  55606.                     } else {
  55607.                         $content $responseBody->getContents();
  55608.                     }
  55609.                     return [
  55610.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  55611.                         $response->getStatusCode(),
  55612.                         $response->getHeaders()
  55613.                     ];
  55614.                 },
  55615.                 function ($exception) {
  55616.                     $response $exception->getResponse();
  55617.                     $statusCode $response->getStatusCode();
  55618.                     throw new ApiException(
  55619.                         sprintf(
  55620.                             '[%d] Error connecting to the API (%s)',
  55621.                             $statusCode,
  55622.                             $exception->getRequest()->getUri()
  55623.                         ),
  55624.                         $statusCode,
  55625.                         $response->getHeaders(),
  55626.                         $response->getBody()
  55627.                     );
  55628.                 }
  55629.             );
  55630.     }
  55631.     /**
  55632.      * Create request for operation 'updateLinkedTransaction'
  55633.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  55634.      * @param  string $linked_transaction_id Unique identifier for a LinkedTransaction (required)
  55635.      * @param  \XeroAPI\XeroPHP\Models\Accounting\LinkedTransactions $linked_transactions (required)
  55636.      * @throws \InvalidArgumentException
  55637.      * @return \GuzzleHttp\Psr7\Request  */
  55638.     protected function updateLinkedTransactionRequest($xero_tenant_id$linked_transaction_id$linked_transactions)
  55639.     {
  55640.         // verify the required parameter 'xero_tenant_id' is set
  55641.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  55642.             throw new \InvalidArgumentException(
  55643.                 'Missing the required parameter $xero_tenant_id when calling updateLinkedTransaction'
  55644.             );
  55645.         }
  55646.         // verify the required parameter 'linked_transaction_id' is set
  55647.         if ($linked_transaction_id === null || (is_array($linked_transaction_id) && count($linked_transaction_id) === 0)) {
  55648.             throw new \InvalidArgumentException(
  55649.                 'Missing the required parameter $linked_transaction_id when calling updateLinkedTransaction'
  55650.             );
  55651.         }
  55652.         // verify the required parameter 'linked_transactions' is set
  55653.         if ($linked_transactions === null || (is_array($linked_transactions) && count($linked_transactions) === 0)) {
  55654.             throw new \InvalidArgumentException(
  55655.                 'Missing the required parameter $linked_transactions when calling updateLinkedTransaction'
  55656.             );
  55657.         }
  55658.         $resourcePath '/LinkedTransactions/{LinkedTransactionID}';
  55659.         $formParams = [];
  55660.         $queryParams = [];
  55661.         $headerParams = [];
  55662.         $httpBody '';
  55663.         $multipart false;
  55664.         // header params
  55665.         if ($xero_tenant_id !== null) {
  55666.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  55667.         }
  55668.         // path params
  55669.         if ($linked_transaction_id !== null) {
  55670.             $resourcePath str_replace(
  55671.                 '{' 'LinkedTransactionID' '}',
  55672.                 AccountingObjectSerializer::toPathValue($linked_transaction_id),
  55673.                 $resourcePath
  55674.             );
  55675.         }
  55676.         // body params
  55677.         $_tempBody null;
  55678.         if (isset($linked_transactions)) {
  55679.             $_tempBody $linked_transactions;
  55680.         }
  55681.         if ($multipart) {
  55682.             $headers $this->headerSelector->selectHeadersForMultipart(
  55683.                 ['application/json']
  55684.             );
  55685.         } else {
  55686.             $headers $this->headerSelector->selectHeaders(
  55687.                 ['application/json'],
  55688.                 ['application/json']
  55689.             );
  55690.         }
  55691.         // for model (json/xml)
  55692.         if (isset($_tempBody)) {
  55693.             // $_tempBody is the method argument, if present
  55694.             if ($headers['Content-Type'] === 'application/json') {
  55695.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  55696.             } else {
  55697.                 $httpBody $_tempBody;
  55698.             }
  55699.         } elseif (count($formParams) > 0) {
  55700.             if ($multipart) {
  55701.                 $multipartContents = [
  55702.                     [
  55703.                         'Content-type' => 'multipart/form-data',
  55704.                     ]
  55705.                 ];
  55706.                 
  55707.                 // for HTTP post (form)
  55708.                 $httpBody = new MultipartStream($multipartContents);
  55709.             } elseif ($headers['Content-Type'] === 'application/json') {
  55710.                 $httpBody \GuzzleHttp\json_encode($formParams);
  55711.             } else {
  55712.                 // for HTTP post (form)
  55713.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  55714.             }
  55715.         }
  55716.         // this endpoint requires OAuth (access token)
  55717.         if ($this->config->getAccessToken() !== null) {
  55718.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  55719.         }
  55720.         $defaultHeaders = [];
  55721.         if ($this->config->getUserAgent()) {
  55722.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  55723.         }
  55724.         $headers array_merge(
  55725.             $defaultHeaders,
  55726.             $headerParams,
  55727.             $headers
  55728.         );
  55729.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  55730.         return new Request(
  55731.             'POST',
  55732.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  55733.             $headers,
  55734.             $httpBody
  55735.         );
  55736.     }
  55737.     /**
  55738.      * Operation updateManualJournal
  55739.      * Updates a specific manual journal
  55740.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  55741.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  55742.      * @param  \XeroAPI\XeroPHP\Models\Accounting\ManualJournals $manual_journals manual_journals (required)
  55743.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  55744.      * @throws \InvalidArgumentException
  55745.      * @return \XeroAPI\XeroPHP\Models\Accounting\ManualJournals|\XeroAPI\XeroPHP\Models\Accounting\Error
  55746.      */
  55747.     public function updateManualJournal($xero_tenant_id$manual_journal_id$manual_journals)
  55748.     {
  55749.         list($response) = $this->updateManualJournalWithHttpInfo($xero_tenant_id$manual_journal_id$manual_journals);
  55750.         return $response;
  55751.     }
  55752.     /**
  55753.      * Operation updateManualJournalWithHttpInfo
  55754.      * Updates a specific manual journal
  55755.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  55756.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  55757.      * @param  \XeroAPI\XeroPHP\Models\Accounting\ManualJournals $manual_journals (required)
  55758.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  55759.      * @throws \InvalidArgumentException
  55760.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\ManualJournals|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  55761.      */
  55762.     public function updateManualJournalWithHttpInfo($xero_tenant_id$manual_journal_id$manual_journals)
  55763.     {
  55764.         $request $this->updateManualJournalRequest($xero_tenant_id$manual_journal_id$manual_journals);
  55765.         try {
  55766.             $options $this->createHttpClientOption();
  55767.             try {
  55768.                 $response $this->client->send($request$options);
  55769.             } catch (RequestException $e) {
  55770.                 throw new ApiException(
  55771.                     "[{$e->getCode()}{$e->getMessage()}",
  55772.                     $e->getCode(),
  55773.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  55774.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  55775.                 );
  55776.             }
  55777.             $statusCode $response->getStatusCode();
  55778.             if ($statusCode 200 || $statusCode 299) {
  55779.                 throw new ApiException(
  55780.                     sprintf(
  55781.                         '[%d] Error connecting to the API (%s)',
  55782.                         $statusCode,
  55783.                         $request->getUri()
  55784.                     ),
  55785.                     $statusCode,
  55786.                     $response->getHeaders(),
  55787.                     $response->getBody()
  55788.                 );
  55789.             }
  55790.             $responseBody $response->getBody();
  55791.             switch($statusCode) {
  55792.                 case 200:
  55793.                     if ('\XeroAPI\XeroPHP\Models\Accounting\ManualJournals' === '\SplFileObject') {
  55794.                         $content $responseBody//stream goes to serializer
  55795.                     } else {
  55796.                         $content $responseBody->getContents();
  55797.                     }
  55798.                     return [
  55799.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\ManualJournals', []),
  55800.                         $response->getStatusCode(),
  55801.                         $response->getHeaders()
  55802.                     ];
  55803.                 case 400:
  55804.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  55805.                         $content $responseBody//stream goes to serializer
  55806.                     } else {
  55807.                         $content $responseBody->getContents();
  55808.                     }
  55809.                     return [
  55810.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  55811.                         $response->getStatusCode(),
  55812.                         $response->getHeaders()
  55813.                     ];
  55814.             }
  55815.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\ManualJournals';
  55816.             $responseBody $response->getBody();
  55817.             if ($returnType === '\SplFileObject') {
  55818.                 $content $responseBody//stream goes to serializer
  55819.             } else {
  55820.                 $content $responseBody->getContents();
  55821.             }
  55822.             return [
  55823.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  55824.                 $response->getStatusCode(),
  55825.                 $response->getHeaders()
  55826.             ];
  55827.         } catch (ApiException $e) {
  55828.             switch ($e->getCode()) {
  55829.                 case 200:
  55830.                     $data AccountingObjectSerializer::deserialize(
  55831.                         $e->getResponseBody(),
  55832.                         '\XeroAPI\XeroPHP\Models\Accounting\ManualJournals',
  55833.                         $e->getResponseHeaders()
  55834.                     );
  55835.                     $e->setResponseObject($data);
  55836.                     break;
  55837.                 case 400:
  55838.                     $data AccountingObjectSerializer::deserialize(
  55839.                         $e->getResponseBody(),
  55840.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  55841.                         $e->getResponseHeaders()
  55842.                     );
  55843.                     $e->setResponseObject($data);
  55844.                     break;
  55845.             }
  55846.             throw $e;
  55847.         }
  55848.     }
  55849.     /**
  55850.      * Operation updateManualJournalAsync
  55851.      * Updates a specific manual journal
  55852.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  55853.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  55854.      * @param  \XeroAPI\XeroPHP\Models\Accounting\ManualJournals $manual_journals (required)
  55855.      * @throws \InvalidArgumentException
  55856.      * @return \GuzzleHttp\Promise\PromiseInterface
  55857.      */
  55858.     public function updateManualJournalAsync($xero_tenant_id$manual_journal_id$manual_journals)
  55859.     {
  55860.         return $this->updateManualJournalAsyncWithHttpInfo($xero_tenant_id$manual_journal_id$manual_journals)
  55861.             ->then(
  55862.                 function ($response) {
  55863.                     return $response[0];
  55864.                 }
  55865.             );
  55866.     }
  55867.     /**
  55868.      * Operation updateManualJournalAsyncWithHttpInfo
  55869.      * Updates a specific manual journal
  55870.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  55871.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  55872.      * @param  \XeroAPI\XeroPHP\Models\Accounting\ManualJournals $manual_journals (required)
  55873.      * @throws \InvalidArgumentException
  55874.      * @return \GuzzleHttp\Promise\PromiseInterface */
  55875.     public function updateManualJournalAsyncWithHttpInfo($xero_tenant_id$manual_journal_id$manual_journals)
  55876.     {
  55877.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\ManualJournals';
  55878.         $request $this->updateManualJournalRequest($xero_tenant_id$manual_journal_id$manual_journals);
  55879.         return $this->client
  55880.             ->sendAsync($request$this->createHttpClientOption())
  55881.             ->then(
  55882.                 function ($response) use ($returnType) {
  55883.                     $responseBody $response->getBody();
  55884.                     if ($returnType === '\SplFileObject') {
  55885.                         $content $responseBody//stream goes to serializer
  55886.                     } else {
  55887.                         $content $responseBody->getContents();
  55888.                     }
  55889.                     return [
  55890.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  55891.                         $response->getStatusCode(),
  55892.                         $response->getHeaders()
  55893.                     ];
  55894.                 },
  55895.                 function ($exception) {
  55896.                     $response $exception->getResponse();
  55897.                     $statusCode $response->getStatusCode();
  55898.                     throw new ApiException(
  55899.                         sprintf(
  55900.                             '[%d] Error connecting to the API (%s)',
  55901.                             $statusCode,
  55902.                             $exception->getRequest()->getUri()
  55903.                         ),
  55904.                         $statusCode,
  55905.                         $response->getHeaders(),
  55906.                         $response->getBody()
  55907.                     );
  55908.                 }
  55909.             );
  55910.     }
  55911.     /**
  55912.      * Create request for operation 'updateManualJournal'
  55913.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  55914.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  55915.      * @param  \XeroAPI\XeroPHP\Models\Accounting\ManualJournals $manual_journals (required)
  55916.      * @throws \InvalidArgumentException
  55917.      * @return \GuzzleHttp\Psr7\Request  */
  55918.     protected function updateManualJournalRequest($xero_tenant_id$manual_journal_id$manual_journals)
  55919.     {
  55920.         // verify the required parameter 'xero_tenant_id' is set
  55921.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  55922.             throw new \InvalidArgumentException(
  55923.                 'Missing the required parameter $xero_tenant_id when calling updateManualJournal'
  55924.             );
  55925.         }
  55926.         // verify the required parameter 'manual_journal_id' is set
  55927.         if ($manual_journal_id === null || (is_array($manual_journal_id) && count($manual_journal_id) === 0)) {
  55928.             throw new \InvalidArgumentException(
  55929.                 'Missing the required parameter $manual_journal_id when calling updateManualJournal'
  55930.             );
  55931.         }
  55932.         // verify the required parameter 'manual_journals' is set
  55933.         if ($manual_journals === null || (is_array($manual_journals) && count($manual_journals) === 0)) {
  55934.             throw new \InvalidArgumentException(
  55935.                 'Missing the required parameter $manual_journals when calling updateManualJournal'
  55936.             );
  55937.         }
  55938.         $resourcePath '/ManualJournals/{ManualJournalID}';
  55939.         $formParams = [];
  55940.         $queryParams = [];
  55941.         $headerParams = [];
  55942.         $httpBody '';
  55943.         $multipart false;
  55944.         // header params
  55945.         if ($xero_tenant_id !== null) {
  55946.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  55947.         }
  55948.         // path params
  55949.         if ($manual_journal_id !== null) {
  55950.             $resourcePath str_replace(
  55951.                 '{' 'ManualJournalID' '}',
  55952.                 AccountingObjectSerializer::toPathValue($manual_journal_id),
  55953.                 $resourcePath
  55954.             );
  55955.         }
  55956.         // body params
  55957.         $_tempBody null;
  55958.         if (isset($manual_journals)) {
  55959.             $_tempBody $manual_journals;
  55960.         }
  55961.         if ($multipart) {
  55962.             $headers $this->headerSelector->selectHeadersForMultipart(
  55963.                 ['application/json']
  55964.             );
  55965.         } else {
  55966.             $headers $this->headerSelector->selectHeaders(
  55967.                 ['application/json'],
  55968.                 ['application/json']
  55969.             );
  55970.         }
  55971.         // for model (json/xml)
  55972.         if (isset($_tempBody)) {
  55973.             // $_tempBody is the method argument, if present
  55974.             if ($headers['Content-Type'] === 'application/json') {
  55975.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  55976.             } else {
  55977.                 $httpBody $_tempBody;
  55978.             }
  55979.         } elseif (count($formParams) > 0) {
  55980.             if ($multipart) {
  55981.                 $multipartContents = [
  55982.                     [
  55983.                         'Content-type' => 'multipart/form-data',
  55984.                     ]
  55985.                 ];
  55986.                 
  55987.                 // for HTTP post (form)
  55988.                 $httpBody = new MultipartStream($multipartContents);
  55989.             } elseif ($headers['Content-Type'] === 'application/json') {
  55990.                 $httpBody \GuzzleHttp\json_encode($formParams);
  55991.             } else {
  55992.                 // for HTTP post (form)
  55993.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  55994.             }
  55995.         }
  55996.         // this endpoint requires OAuth (access token)
  55997.         if ($this->config->getAccessToken() !== null) {
  55998.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  55999.         }
  56000.         $defaultHeaders = [];
  56001.         if ($this->config->getUserAgent()) {
  56002.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  56003.         }
  56004.         $headers array_merge(
  56005.             $defaultHeaders,
  56006.             $headerParams,
  56007.             $headers
  56008.         );
  56009.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  56010.         return new Request(
  56011.             'POST',
  56012.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  56013.             $headers,
  56014.             $httpBody
  56015.         );
  56016.     }
  56017.     /**
  56018.      * Operation updateManualJournalAttachmentByFileName
  56019.      * Updates a specific attachment from a specific manual journal by file name
  56020.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  56021.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  56022.      * @param  string $file_name Name of the attachment (required)
  56023.      * @param  string $body Byte array of file in body of request (required)
  56024.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  56025.      * @throws \InvalidArgumentException
  56026.      * @return \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error
  56027.      */
  56028.     public function updateManualJournalAttachmentByFileName($xero_tenant_id$manual_journal_id$file_name$body)
  56029.     {
  56030.         list($response) = $this->updateManualJournalAttachmentByFileNameWithHttpInfo($xero_tenant_id$manual_journal_id$file_name$body);
  56031.         return $response;
  56032.     }
  56033.     /**
  56034.      * Operation updateManualJournalAttachmentByFileNameWithHttpInfo
  56035.      * Updates a specific attachment from a specific manual journal by file name
  56036.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  56037.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  56038.      * @param  string $file_name Name of the attachment (required)
  56039.      * @param  string $body Byte array of file in body of request (required)
  56040.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  56041.      * @throws \InvalidArgumentException
  56042.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  56043.      */
  56044.     public function updateManualJournalAttachmentByFileNameWithHttpInfo($xero_tenant_id$manual_journal_id$file_name$body)
  56045.     {
  56046.         $request $this->updateManualJournalAttachmentByFileNameRequest($xero_tenant_id$manual_journal_id$file_name$body);
  56047.         try {
  56048.             $options $this->createHttpClientOption();
  56049.             try {
  56050.                 $response $this->client->send($request$options);
  56051.             } catch (RequestException $e) {
  56052.                 throw new ApiException(
  56053.                     "[{$e->getCode()}{$e->getMessage()}",
  56054.                     $e->getCode(),
  56055.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  56056.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  56057.                 );
  56058.             }
  56059.             $statusCode $response->getStatusCode();
  56060.             if ($statusCode 200 || $statusCode 299) {
  56061.                 throw new ApiException(
  56062.                     sprintf(
  56063.                         '[%d] Error connecting to the API (%s)',
  56064.                         $statusCode,
  56065.                         $request->getUri()
  56066.                     ),
  56067.                     $statusCode,
  56068.                     $response->getHeaders(),
  56069.                     $response->getBody()
  56070.                 );
  56071.             }
  56072.             $responseBody $response->getBody();
  56073.             switch($statusCode) {
  56074.                 case 200:
  56075.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Attachments' === '\SplFileObject') {
  56076.                         $content $responseBody//stream goes to serializer
  56077.                     } else {
  56078.                         $content $responseBody->getContents();
  56079.                     }
  56080.                     return [
  56081.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Attachments', []),
  56082.                         $response->getStatusCode(),
  56083.                         $response->getHeaders()
  56084.                     ];
  56085.                 case 400:
  56086.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  56087.                         $content $responseBody//stream goes to serializer
  56088.                     } else {
  56089.                         $content $responseBody->getContents();
  56090.                     }
  56091.                     return [
  56092.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  56093.                         $response->getStatusCode(),
  56094.                         $response->getHeaders()
  56095.                     ];
  56096.             }
  56097.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  56098.             $responseBody $response->getBody();
  56099.             if ($returnType === '\SplFileObject') {
  56100.                 $content $responseBody//stream goes to serializer
  56101.             } else {
  56102.                 $content $responseBody->getContents();
  56103.             }
  56104.             return [
  56105.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  56106.                 $response->getStatusCode(),
  56107.                 $response->getHeaders()
  56108.             ];
  56109.         } catch (ApiException $e) {
  56110.             switch ($e->getCode()) {
  56111.                 case 200:
  56112.                     $data AccountingObjectSerializer::deserialize(
  56113.                         $e->getResponseBody(),
  56114.                         '\XeroAPI\XeroPHP\Models\Accounting\Attachments',
  56115.                         $e->getResponseHeaders()
  56116.                     );
  56117.                     $e->setResponseObject($data);
  56118.                     break;
  56119.                 case 400:
  56120.                     $data AccountingObjectSerializer::deserialize(
  56121.                         $e->getResponseBody(),
  56122.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  56123.                         $e->getResponseHeaders()
  56124.                     );
  56125.                     $e->setResponseObject($data);
  56126.                     break;
  56127.             }
  56128.             throw $e;
  56129.         }
  56130.     }
  56131.     /**
  56132.      * Operation updateManualJournalAttachmentByFileNameAsync
  56133.      * Updates a specific attachment from a specific manual journal by file name
  56134.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  56135.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  56136.      * @param  string $file_name Name of the attachment (required)
  56137.      * @param  string $body Byte array of file in body of request (required)
  56138.      * @throws \InvalidArgumentException
  56139.      * @return \GuzzleHttp\Promise\PromiseInterface
  56140.      */
  56141.     public function updateManualJournalAttachmentByFileNameAsync($xero_tenant_id$manual_journal_id$file_name$body)
  56142.     {
  56143.         return $this->updateManualJournalAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$manual_journal_id$file_name$body)
  56144.             ->then(
  56145.                 function ($response) {
  56146.                     return $response[0];
  56147.                 }
  56148.             );
  56149.     }
  56150.     /**
  56151.      * Operation updateManualJournalAttachmentByFileNameAsyncWithHttpInfo
  56152.      * Updates a specific attachment from a specific manual journal by file name
  56153.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  56154.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  56155.      * @param  string $file_name Name of the attachment (required)
  56156.      * @param  string $body Byte array of file in body of request (required)
  56157.      * @throws \InvalidArgumentException
  56158.      * @return \GuzzleHttp\Promise\PromiseInterface */
  56159.     public function updateManualJournalAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$manual_journal_id$file_name$body)
  56160.     {
  56161.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  56162.         $request $this->updateManualJournalAttachmentByFileNameRequest($xero_tenant_id$manual_journal_id$file_name$body);
  56163.         return $this->client
  56164.             ->sendAsync($request$this->createHttpClientOption())
  56165.             ->then(
  56166.                 function ($response) use ($returnType) {
  56167.                     $responseBody $response->getBody();
  56168.                     if ($returnType === '\SplFileObject') {
  56169.                         $content $responseBody//stream goes to serializer
  56170.                     } else {
  56171.                         $content $responseBody->getContents();
  56172.                     }
  56173.                     return [
  56174.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  56175.                         $response->getStatusCode(),
  56176.                         $response->getHeaders()
  56177.                     ];
  56178.                 },
  56179.                 function ($exception) {
  56180.                     $response $exception->getResponse();
  56181.                     $statusCode $response->getStatusCode();
  56182.                     throw new ApiException(
  56183.                         sprintf(
  56184.                             '[%d] Error connecting to the API (%s)',
  56185.                             $statusCode,
  56186.                             $exception->getRequest()->getUri()
  56187.                         ),
  56188.                         $statusCode,
  56189.                         $response->getHeaders(),
  56190.                         $response->getBody()
  56191.                     );
  56192.                 }
  56193.             );
  56194.     }
  56195.     /**
  56196.      * Create request for operation 'updateManualJournalAttachmentByFileName'
  56197.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  56198.      * @param  string $manual_journal_id Unique identifier for a ManualJournal (required)
  56199.      * @param  string $file_name Name of the attachment (required)
  56200.      * @param  string $body Byte array of file in body of request (required)
  56201.      * @throws \InvalidArgumentException
  56202.      * @return \GuzzleHttp\Psr7\Request  */
  56203.     protected function updateManualJournalAttachmentByFileNameRequest($xero_tenant_id$manual_journal_id$file_name$body)
  56204.     {
  56205.         // verify the required parameter 'xero_tenant_id' is set
  56206.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  56207.             throw new \InvalidArgumentException(
  56208.                 'Missing the required parameter $xero_tenant_id when calling updateManualJournalAttachmentByFileName'
  56209.             );
  56210.         }
  56211.         // verify the required parameter 'manual_journal_id' is set
  56212.         if ($manual_journal_id === null || (is_array($manual_journal_id) && count($manual_journal_id) === 0)) {
  56213.             throw new \InvalidArgumentException(
  56214.                 'Missing the required parameter $manual_journal_id when calling updateManualJournalAttachmentByFileName'
  56215.             );
  56216.         }
  56217.         // verify the required parameter 'file_name' is set
  56218.         if ($file_name === null || (is_array($file_name) && count($file_name) === 0)) {
  56219.             throw new \InvalidArgumentException(
  56220.                 'Missing the required parameter $file_name when calling updateManualJournalAttachmentByFileName'
  56221.             );
  56222.         }
  56223.         // verify the required parameter 'body' is set
  56224.         if ($body === null || (is_array($body) && count($body) === 0)) {
  56225.             throw new \InvalidArgumentException(
  56226.                 'Missing the required parameter $body when calling updateManualJournalAttachmentByFileName'
  56227.             );
  56228.         }
  56229.         $resourcePath '/ManualJournals/{ManualJournalID}/Attachments/{FileName}';
  56230.         $formParams = [];
  56231.         $queryParams = [];
  56232.         $headerParams = [];
  56233.         $httpBody '';
  56234.         $multipart false;
  56235.         // header params
  56236.         if ($xero_tenant_id !== null) {
  56237.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  56238.         }
  56239.         // path params
  56240.         if ($manual_journal_id !== null) {
  56241.             $resourcePath str_replace(
  56242.                 '{' 'ManualJournalID' '}',
  56243.                 AccountingObjectSerializer::toPathValue($manual_journal_id),
  56244.                 $resourcePath
  56245.             );
  56246.         }
  56247.         // path params
  56248.         if ($file_name !== null) {
  56249.             $resourcePath str_replace(
  56250.                 '{' 'FileName' '}',
  56251.                 AccountingObjectSerializer::toPathValue($file_name),
  56252.                 $resourcePath
  56253.             );
  56254.         }
  56255.         // body params
  56256.         $_tempBody null;
  56257.         if (isset($body)) {
  56258.             $_tempBody $body;
  56259.         }
  56260.         if ($multipart) {
  56261.             $headers $this->headerSelector->selectHeadersForMultipart(
  56262.                 ['application/json']
  56263.             );
  56264.         } else {
  56265.             $headers $this->headerSelector->selectHeaders(
  56266.                 ['application/json'],
  56267.                 ['application/octet-stream']
  56268.             );
  56269.         }
  56270.         // for model (json/xml)
  56271.         if (isset($_tempBody)) {
  56272.             // $_tempBody is the method argument, if present
  56273.             if ($headers['Content-Type'] === 'application/json') {
  56274.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  56275.             } else {
  56276.                 $httpBody $_tempBody;
  56277.             }
  56278.         } elseif (count($formParams) > 0) {
  56279.             if ($multipart) {
  56280.                 $multipartContents = [
  56281.                     [
  56282.                         'Content-type' => 'multipart/form-data',
  56283.                     ]
  56284.                 ];
  56285.                 
  56286.                 // for HTTP post (form)
  56287.                 $httpBody = new MultipartStream($multipartContents);
  56288.             } elseif ($headers['Content-Type'] === 'application/json') {
  56289.                 $httpBody \GuzzleHttp\json_encode($formParams);
  56290.             } else {
  56291.                 // for HTTP post (form)
  56292.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  56293.             }
  56294.         }
  56295.         // this endpoint requires OAuth (access token)
  56296.         if ($this->config->getAccessToken() !== null) {
  56297.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  56298.         }
  56299.         $defaultHeaders = [];
  56300.         if ($this->config->getUserAgent()) {
  56301.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  56302.         }
  56303.         $headers array_merge(
  56304.             $defaultHeaders,
  56305.             $headerParams,
  56306.             $headers
  56307.         );
  56308.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  56309.         return new Request(
  56310.             'POST',
  56311.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  56312.             $headers,
  56313.             $httpBody
  56314.         );
  56315.     }
  56316.     /**
  56317.      * Operation updateOrCreateBankTransactions
  56318.      * Updates or creates one or more spent or received money transaction
  56319.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  56320.      * @param  \XeroAPI\XeroPHP\Models\Accounting\BankTransactions $bank_transactions bank_transactions (required)
  56321.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  56322.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  56323.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  56324.      * @throws \InvalidArgumentException
  56325.      * @return \XeroAPI\XeroPHP\Models\Accounting\BankTransactions|\XeroAPI\XeroPHP\Models\Accounting\Error
  56326.      */
  56327.     public function updateOrCreateBankTransactions($xero_tenant_id$bank_transactions$summarize_errors false$unitdp null)
  56328.     {
  56329.         list($response) = $this->updateOrCreateBankTransactionsWithHttpInfo($xero_tenant_id$bank_transactions$summarize_errors$unitdp);
  56330.         return $response;
  56331.     }
  56332.     /**
  56333.      * Operation updateOrCreateBankTransactionsWithHttpInfo
  56334.      * Updates or creates one or more spent or received money transaction
  56335.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  56336.      * @param  \XeroAPI\XeroPHP\Models\Accounting\BankTransactions $bank_transactions (required)
  56337.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  56338.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  56339.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  56340.      * @throws \InvalidArgumentException
  56341.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\BankTransactions|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  56342.      */
  56343.     public function updateOrCreateBankTransactionsWithHttpInfo($xero_tenant_id$bank_transactions$summarize_errors false$unitdp null)
  56344.     {
  56345.         $request $this->updateOrCreateBankTransactionsRequest($xero_tenant_id$bank_transactions$summarize_errors$unitdp);
  56346.         try {
  56347.             $options $this->createHttpClientOption();
  56348.             try {
  56349.                 $response $this->client->send($request$options);
  56350.             } catch (RequestException $e) {
  56351.                 throw new ApiException(
  56352.                     "[{$e->getCode()}{$e->getMessage()}",
  56353.                     $e->getCode(),
  56354.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  56355.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  56356.                 );
  56357.             }
  56358.             $statusCode $response->getStatusCode();
  56359.             if ($statusCode 200 || $statusCode 299) {
  56360.                 throw new ApiException(
  56361.                     sprintf(
  56362.                         '[%d] Error connecting to the API (%s)',
  56363.                         $statusCode,
  56364.                         $request->getUri()
  56365.                     ),
  56366.                     $statusCode,
  56367.                     $response->getHeaders(),
  56368.                     $response->getBody()
  56369.                 );
  56370.             }
  56371.             $responseBody $response->getBody();
  56372.             switch($statusCode) {
  56373.                 case 200:
  56374.                     if ('\XeroAPI\XeroPHP\Models\Accounting\BankTransactions' === '\SplFileObject') {
  56375.                         $content $responseBody//stream goes to serializer
  56376.                     } else {
  56377.                         $content $responseBody->getContents();
  56378.                     }
  56379.                     return [
  56380.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\BankTransactions', []),
  56381.                         $response->getStatusCode(),
  56382.                         $response->getHeaders()
  56383.                     ];
  56384.                 case 400:
  56385.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  56386.                         $content $responseBody//stream goes to serializer
  56387.                     } else {
  56388.                         $content $responseBody->getContents();
  56389.                     }
  56390.                     return [
  56391.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  56392.                         $response->getStatusCode(),
  56393.                         $response->getHeaders()
  56394.                     ];
  56395.             }
  56396.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\BankTransactions';
  56397.             $responseBody $response->getBody();
  56398.             if ($returnType === '\SplFileObject') {
  56399.                 $content $responseBody//stream goes to serializer
  56400.             } else {
  56401.                 $content $responseBody->getContents();
  56402.             }
  56403.             return [
  56404.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  56405.                 $response->getStatusCode(),
  56406.                 $response->getHeaders()
  56407.             ];
  56408.         } catch (ApiException $e) {
  56409.             switch ($e->getCode()) {
  56410.                 case 200:
  56411.                     $data AccountingObjectSerializer::deserialize(
  56412.                         $e->getResponseBody(),
  56413.                         '\XeroAPI\XeroPHP\Models\Accounting\BankTransactions',
  56414.                         $e->getResponseHeaders()
  56415.                     );
  56416.                     $e->setResponseObject($data);
  56417.                     break;
  56418.                 case 400:
  56419.                     $data AccountingObjectSerializer::deserialize(
  56420.                         $e->getResponseBody(),
  56421.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  56422.                         $e->getResponseHeaders()
  56423.                     );
  56424.                     $e->setResponseObject($data);
  56425.                     break;
  56426.             }
  56427.             throw $e;
  56428.         }
  56429.     }
  56430.     /**
  56431.      * Operation updateOrCreateBankTransactionsAsync
  56432.      * Updates or creates one or more spent or received money transaction
  56433.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  56434.      * @param  \XeroAPI\XeroPHP\Models\Accounting\BankTransactions $bank_transactions (required)
  56435.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  56436.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  56437.      * @throws \InvalidArgumentException
  56438.      * @return \GuzzleHttp\Promise\PromiseInterface
  56439.      */
  56440.     public function updateOrCreateBankTransactionsAsync($xero_tenant_id$bank_transactions$summarize_errors false$unitdp null)
  56441.     {
  56442.         return $this->updateOrCreateBankTransactionsAsyncWithHttpInfo($xero_tenant_id$bank_transactions$summarize_errors$unitdp)
  56443.             ->then(
  56444.                 function ($response) {
  56445.                     return $response[0];
  56446.                 }
  56447.             );
  56448.     }
  56449.     /**
  56450.      * Operation updateOrCreateBankTransactionsAsyncWithHttpInfo
  56451.      * Updates or creates one or more spent or received money transaction
  56452.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  56453.      * @param  \XeroAPI\XeroPHP\Models\Accounting\BankTransactions $bank_transactions (required)
  56454.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  56455.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  56456.      * @throws \InvalidArgumentException
  56457.      * @return \GuzzleHttp\Promise\PromiseInterface */
  56458.     public function updateOrCreateBankTransactionsAsyncWithHttpInfo($xero_tenant_id$bank_transactions$summarize_errors false$unitdp null)
  56459.     {
  56460.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\BankTransactions';
  56461.         $request $this->updateOrCreateBankTransactionsRequest($xero_tenant_id$bank_transactions$summarize_errors$unitdp);
  56462.         return $this->client
  56463.             ->sendAsync($request$this->createHttpClientOption())
  56464.             ->then(
  56465.                 function ($response) use ($returnType) {
  56466.                     $responseBody $response->getBody();
  56467.                     if ($returnType === '\SplFileObject') {
  56468.                         $content $responseBody//stream goes to serializer
  56469.                     } else {
  56470.                         $content $responseBody->getContents();
  56471.                     }
  56472.                     return [
  56473.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  56474.                         $response->getStatusCode(),
  56475.                         $response->getHeaders()
  56476.                     ];
  56477.                 },
  56478.                 function ($exception) {
  56479.                     $response $exception->getResponse();
  56480.                     $statusCode $response->getStatusCode();
  56481.                     throw new ApiException(
  56482.                         sprintf(
  56483.                             '[%d] Error connecting to the API (%s)',
  56484.                             $statusCode,
  56485.                             $exception->getRequest()->getUri()
  56486.                         ),
  56487.                         $statusCode,
  56488.                         $response->getHeaders(),
  56489.                         $response->getBody()
  56490.                     );
  56491.                 }
  56492.             );
  56493.     }
  56494.     /**
  56495.      * Create request for operation 'updateOrCreateBankTransactions'
  56496.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  56497.      * @param  \XeroAPI\XeroPHP\Models\Accounting\BankTransactions $bank_transactions (required)
  56498.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  56499.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  56500.      * @throws \InvalidArgumentException
  56501.      * @return \GuzzleHttp\Psr7\Request  */
  56502.     protected function updateOrCreateBankTransactionsRequest($xero_tenant_id$bank_transactions$summarize_errors false$unitdp null)
  56503.     {
  56504.         // verify the required parameter 'xero_tenant_id' is set
  56505.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  56506.             throw new \InvalidArgumentException(
  56507.                 'Missing the required parameter $xero_tenant_id when calling updateOrCreateBankTransactions'
  56508.             );
  56509.         }
  56510.         // verify the required parameter 'bank_transactions' is set
  56511.         if ($bank_transactions === null || (is_array($bank_transactions) && count($bank_transactions) === 0)) {
  56512.             throw new \InvalidArgumentException(
  56513.                 'Missing the required parameter $bank_transactions when calling updateOrCreateBankTransactions'
  56514.             );
  56515.         }
  56516.         $resourcePath '/BankTransactions';
  56517.         $formParams = [];
  56518.         $queryParams = [];
  56519.         $headerParams = [];
  56520.         $httpBody '';
  56521.         $multipart false;
  56522.         // query params
  56523.         if ($summarize_errors !== null) {
  56524.             $queryParams['summarizeErrors'] = $summarize_errors 'true' 'false';
  56525.         }
  56526.         // query params
  56527.         if ($unitdp !== null) {
  56528.             $queryParams['unitdp'] = AccountingObjectSerializer::toQueryValue($unitdp);
  56529.         }
  56530.         // header params
  56531.         if ($xero_tenant_id !== null) {
  56532.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  56533.         }
  56534.         // body params
  56535.         $_tempBody null;
  56536.         if (isset($bank_transactions)) {
  56537.             $_tempBody $bank_transactions;
  56538.         }
  56539.         if ($multipart) {
  56540.             $headers $this->headerSelector->selectHeadersForMultipart(
  56541.                 ['application/json']
  56542.             );
  56543.         } else {
  56544.             $headers $this->headerSelector->selectHeaders(
  56545.                 ['application/json'],
  56546.                 ['application/json']
  56547.             );
  56548.         }
  56549.         // for model (json/xml)
  56550.         if (isset($_tempBody)) {
  56551.             // $_tempBody is the method argument, if present
  56552.             if ($headers['Content-Type'] === 'application/json') {
  56553.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  56554.             } else {
  56555.                 $httpBody $_tempBody;
  56556.             }
  56557.         } elseif (count($formParams) > 0) {
  56558.             if ($multipart) {
  56559.                 $multipartContents = [
  56560.                     [
  56561.                         'Content-type' => 'multipart/form-data',
  56562.                     ]
  56563.                 ];
  56564.                 
  56565.                 // for HTTP post (form)
  56566.                 $httpBody = new MultipartStream($multipartContents);
  56567.             } elseif ($headers['Content-Type'] === 'application/json') {
  56568.                 $httpBody \GuzzleHttp\json_encode($formParams);
  56569.             } else {
  56570.                 // for HTTP post (form)
  56571.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  56572.             }
  56573.         }
  56574.         // this endpoint requires OAuth (access token)
  56575.         if ($this->config->getAccessToken() !== null) {
  56576.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  56577.         }
  56578.         $defaultHeaders = [];
  56579.         if ($this->config->getUserAgent()) {
  56580.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  56581.         }
  56582.         $headers array_merge(
  56583.             $defaultHeaders,
  56584.             $headerParams,
  56585.             $headers
  56586.         );
  56587.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  56588.         return new Request(
  56589.             'POST',
  56590.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  56591.             $headers,
  56592.             $httpBody
  56593.         );
  56594.     }
  56595.     /**
  56596.      * Operation updateOrCreateContacts
  56597.      * Updates or creates one or more contacts in a Xero organisation
  56598.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  56599.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Contacts $contacts contacts (required)
  56600.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  56601.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  56602.      * @throws \InvalidArgumentException
  56603.      * @return \XeroAPI\XeroPHP\Models\Accounting\Contacts|\XeroAPI\XeroPHP\Models\Accounting\Error
  56604.      */
  56605.     public function updateOrCreateContacts($xero_tenant_id$contacts$summarize_errors false)
  56606.     {
  56607.         list($response) = $this->updateOrCreateContactsWithHttpInfo($xero_tenant_id$contacts$summarize_errors);
  56608.         return $response;
  56609.     }
  56610.     /**
  56611.      * Operation updateOrCreateContactsWithHttpInfo
  56612.      * Updates or creates one or more contacts in a Xero organisation
  56613.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  56614.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Contacts $contacts (required)
  56615.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  56616.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  56617.      * @throws \InvalidArgumentException
  56618.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Contacts|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  56619.      */
  56620.     public function updateOrCreateContactsWithHttpInfo($xero_tenant_id$contacts$summarize_errors false)
  56621.     {
  56622.         $request $this->updateOrCreateContactsRequest($xero_tenant_id$contacts$summarize_errors);
  56623.         try {
  56624.             $options $this->createHttpClientOption();
  56625.             try {
  56626.                 $response $this->client->send($request$options);
  56627.             } catch (RequestException $e) {
  56628.                 throw new ApiException(
  56629.                     "[{$e->getCode()}{$e->getMessage()}",
  56630.                     $e->getCode(),
  56631.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  56632.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  56633.                 );
  56634.             }
  56635.             $statusCode $response->getStatusCode();
  56636.             if ($statusCode 200 || $statusCode 299) {
  56637.                 throw new ApiException(
  56638.                     sprintf(
  56639.                         '[%d] Error connecting to the API (%s)',
  56640.                         $statusCode,
  56641.                         $request->getUri()
  56642.                     ),
  56643.                     $statusCode,
  56644.                     $response->getHeaders(),
  56645.                     $response->getBody()
  56646.                 );
  56647.             }
  56648.             $responseBody $response->getBody();
  56649.             switch($statusCode) {
  56650.                 case 200:
  56651.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Contacts' === '\SplFileObject') {
  56652.                         $content $responseBody//stream goes to serializer
  56653.                     } else {
  56654.                         $content $responseBody->getContents();
  56655.                     }
  56656.                     return [
  56657.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Contacts', []),
  56658.                         $response->getStatusCode(),
  56659.                         $response->getHeaders()
  56660.                     ];
  56661.                 case 400:
  56662.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  56663.                         $content $responseBody//stream goes to serializer
  56664.                     } else {
  56665.                         $content $responseBody->getContents();
  56666.                     }
  56667.                     return [
  56668.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  56669.                         $response->getStatusCode(),
  56670.                         $response->getHeaders()
  56671.                     ];
  56672.             }
  56673.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Contacts';
  56674.             $responseBody $response->getBody();
  56675.             if ($returnType === '\SplFileObject') {
  56676.                 $content $responseBody//stream goes to serializer
  56677.             } else {
  56678.                 $content $responseBody->getContents();
  56679.             }
  56680.             return [
  56681.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  56682.                 $response->getStatusCode(),
  56683.                 $response->getHeaders()
  56684.             ];
  56685.         } catch (ApiException $e) {
  56686.             switch ($e->getCode()) {
  56687.                 case 200:
  56688.                     $data AccountingObjectSerializer::deserialize(
  56689.                         $e->getResponseBody(),
  56690.                         '\XeroAPI\XeroPHP\Models\Accounting\Contacts',
  56691.                         $e->getResponseHeaders()
  56692.                     );
  56693.                     $e->setResponseObject($data);
  56694.                     break;
  56695.                 case 400:
  56696.                     $data AccountingObjectSerializer::deserialize(
  56697.                         $e->getResponseBody(),
  56698.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  56699.                         $e->getResponseHeaders()
  56700.                     );
  56701.                     $e->setResponseObject($data);
  56702.                     break;
  56703.             }
  56704.             throw $e;
  56705.         }
  56706.     }
  56707.     /**
  56708.      * Operation updateOrCreateContactsAsync
  56709.      * Updates or creates one or more contacts in a Xero organisation
  56710.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  56711.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Contacts $contacts (required)
  56712.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  56713.      * @throws \InvalidArgumentException
  56714.      * @return \GuzzleHttp\Promise\PromiseInterface
  56715.      */
  56716.     public function updateOrCreateContactsAsync($xero_tenant_id$contacts$summarize_errors false)
  56717.     {
  56718.         return $this->updateOrCreateContactsAsyncWithHttpInfo($xero_tenant_id$contacts$summarize_errors)
  56719.             ->then(
  56720.                 function ($response) {
  56721.                     return $response[0];
  56722.                 }
  56723.             );
  56724.     }
  56725.     /**
  56726.      * Operation updateOrCreateContactsAsyncWithHttpInfo
  56727.      * Updates or creates one or more contacts in a Xero organisation
  56728.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  56729.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Contacts $contacts (required)
  56730.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  56731.      * @throws \InvalidArgumentException
  56732.      * @return \GuzzleHttp\Promise\PromiseInterface */
  56733.     public function updateOrCreateContactsAsyncWithHttpInfo($xero_tenant_id$contacts$summarize_errors false)
  56734.     {
  56735.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Contacts';
  56736.         $request $this->updateOrCreateContactsRequest($xero_tenant_id$contacts$summarize_errors);
  56737.         return $this->client
  56738.             ->sendAsync($request$this->createHttpClientOption())
  56739.             ->then(
  56740.                 function ($response) use ($returnType) {
  56741.                     $responseBody $response->getBody();
  56742.                     if ($returnType === '\SplFileObject') {
  56743.                         $content $responseBody//stream goes to serializer
  56744.                     } else {
  56745.                         $content $responseBody->getContents();
  56746.                     }
  56747.                     return [
  56748.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  56749.                         $response->getStatusCode(),
  56750.                         $response->getHeaders()
  56751.                     ];
  56752.                 },
  56753.                 function ($exception) {
  56754.                     $response $exception->getResponse();
  56755.                     $statusCode $response->getStatusCode();
  56756.                     throw new ApiException(
  56757.                         sprintf(
  56758.                             '[%d] Error connecting to the API (%s)',
  56759.                             $statusCode,
  56760.                             $exception->getRequest()->getUri()
  56761.                         ),
  56762.                         $statusCode,
  56763.                         $response->getHeaders(),
  56764.                         $response->getBody()
  56765.                     );
  56766.                 }
  56767.             );
  56768.     }
  56769.     /**
  56770.      * Create request for operation 'updateOrCreateContacts'
  56771.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  56772.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Contacts $contacts (required)
  56773.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  56774.      * @throws \InvalidArgumentException
  56775.      * @return \GuzzleHttp\Psr7\Request  */
  56776.     protected function updateOrCreateContactsRequest($xero_tenant_id$contacts$summarize_errors false)
  56777.     {
  56778.         // verify the required parameter 'xero_tenant_id' is set
  56779.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  56780.             throw new \InvalidArgumentException(
  56781.                 'Missing the required parameter $xero_tenant_id when calling updateOrCreateContacts'
  56782.             );
  56783.         }
  56784.         // verify the required parameter 'contacts' is set
  56785.         if ($contacts === null || (is_array($contacts) && count($contacts) === 0)) {
  56786.             throw new \InvalidArgumentException(
  56787.                 'Missing the required parameter $contacts when calling updateOrCreateContacts'
  56788.             );
  56789.         }
  56790.         $resourcePath '/Contacts';
  56791.         $formParams = [];
  56792.         $queryParams = [];
  56793.         $headerParams = [];
  56794.         $httpBody '';
  56795.         $multipart false;
  56796.         // query params
  56797.         if ($summarize_errors !== null) {
  56798.             $queryParams['summarizeErrors'] = $summarize_errors 'true' 'false';
  56799.         }
  56800.         // header params
  56801.         if ($xero_tenant_id !== null) {
  56802.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  56803.         }
  56804.         // body params
  56805.         $_tempBody null;
  56806.         if (isset($contacts)) {
  56807.             $_tempBody $contacts;
  56808.         }
  56809.         if ($multipart) {
  56810.             $headers $this->headerSelector->selectHeadersForMultipart(
  56811.                 ['application/json']
  56812.             );
  56813.         } else {
  56814.             $headers $this->headerSelector->selectHeaders(
  56815.                 ['application/json'],
  56816.                 ['application/json']
  56817.             );
  56818.         }
  56819.         // for model (json/xml)
  56820.         if (isset($_tempBody)) {
  56821.             // $_tempBody is the method argument, if present
  56822.             if ($headers['Content-Type'] === 'application/json') {
  56823.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  56824.             } else {
  56825.                 $httpBody $_tempBody;
  56826.             }
  56827.         } elseif (count($formParams) > 0) {
  56828.             if ($multipart) {
  56829.                 $multipartContents = [
  56830.                     [
  56831.                         'Content-type' => 'multipart/form-data',
  56832.                     ]
  56833.                 ];
  56834.                 
  56835.                 // for HTTP post (form)
  56836.                 $httpBody = new MultipartStream($multipartContents);
  56837.             } elseif ($headers['Content-Type'] === 'application/json') {
  56838.                 $httpBody \GuzzleHttp\json_encode($formParams);
  56839.             } else {
  56840.                 // for HTTP post (form)
  56841.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  56842.             }
  56843.         }
  56844.         // this endpoint requires OAuth (access token)
  56845.         if ($this->config->getAccessToken() !== null) {
  56846.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  56847.         }
  56848.         $defaultHeaders = [];
  56849.         if ($this->config->getUserAgent()) {
  56850.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  56851.         }
  56852.         $headers array_merge(
  56853.             $defaultHeaders,
  56854.             $headerParams,
  56855.             $headers
  56856.         );
  56857.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  56858.         return new Request(
  56859.             'POST',
  56860.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  56861.             $headers,
  56862.             $httpBody
  56863.         );
  56864.     }
  56865.     /**
  56866.      * Operation updateOrCreateCreditNotes
  56867.      * Updates or creates one or more credit notes
  56868.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  56869.      * @param  \XeroAPI\XeroPHP\Models\Accounting\CreditNotes $credit_notes an array of Credit Notes with a single CreditNote object. (required)
  56870.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  56871.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  56872.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  56873.      * @throws \InvalidArgumentException
  56874.      * @return \XeroAPI\XeroPHP\Models\Accounting\CreditNotes|\XeroAPI\XeroPHP\Models\Accounting\Error
  56875.      */
  56876.     public function updateOrCreateCreditNotes($xero_tenant_id$credit_notes$summarize_errors false$unitdp null)
  56877.     {
  56878.         list($response) = $this->updateOrCreateCreditNotesWithHttpInfo($xero_tenant_id$credit_notes$summarize_errors$unitdp);
  56879.         return $response;
  56880.     }
  56881.     /**
  56882.      * Operation updateOrCreateCreditNotesWithHttpInfo
  56883.      * Updates or creates one or more credit notes
  56884.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  56885.      * @param  \XeroAPI\XeroPHP\Models\Accounting\CreditNotes $credit_notes an array of Credit Notes with a single CreditNote object. (required)
  56886.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  56887.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  56888.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  56889.      * @throws \InvalidArgumentException
  56890.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\CreditNotes|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  56891.      */
  56892.     public function updateOrCreateCreditNotesWithHttpInfo($xero_tenant_id$credit_notes$summarize_errors false$unitdp null)
  56893.     {
  56894.         $request $this->updateOrCreateCreditNotesRequest($xero_tenant_id$credit_notes$summarize_errors$unitdp);
  56895.         try {
  56896.             $options $this->createHttpClientOption();
  56897.             try {
  56898.                 $response $this->client->send($request$options);
  56899.             } catch (RequestException $e) {
  56900.                 throw new ApiException(
  56901.                     "[{$e->getCode()}{$e->getMessage()}",
  56902.                     $e->getCode(),
  56903.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  56904.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  56905.                 );
  56906.             }
  56907.             $statusCode $response->getStatusCode();
  56908.             if ($statusCode 200 || $statusCode 299) {
  56909.                 throw new ApiException(
  56910.                     sprintf(
  56911.                         '[%d] Error connecting to the API (%s)',
  56912.                         $statusCode,
  56913.                         $request->getUri()
  56914.                     ),
  56915.                     $statusCode,
  56916.                     $response->getHeaders(),
  56917.                     $response->getBody()
  56918.                 );
  56919.             }
  56920.             $responseBody $response->getBody();
  56921.             switch($statusCode) {
  56922.                 case 200:
  56923.                     if ('\XeroAPI\XeroPHP\Models\Accounting\CreditNotes' === '\SplFileObject') {
  56924.                         $content $responseBody//stream goes to serializer
  56925.                     } else {
  56926.                         $content $responseBody->getContents();
  56927.                     }
  56928.                     return [
  56929.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\CreditNotes', []),
  56930.                         $response->getStatusCode(),
  56931.                         $response->getHeaders()
  56932.                     ];
  56933.                 case 400:
  56934.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  56935.                         $content $responseBody//stream goes to serializer
  56936.                     } else {
  56937.                         $content $responseBody->getContents();
  56938.                     }
  56939.                     return [
  56940.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  56941.                         $response->getStatusCode(),
  56942.                         $response->getHeaders()
  56943.                     ];
  56944.             }
  56945.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\CreditNotes';
  56946.             $responseBody $response->getBody();
  56947.             if ($returnType === '\SplFileObject') {
  56948.                 $content $responseBody//stream goes to serializer
  56949.             } else {
  56950.                 $content $responseBody->getContents();
  56951.             }
  56952.             return [
  56953.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  56954.                 $response->getStatusCode(),
  56955.                 $response->getHeaders()
  56956.             ];
  56957.         } catch (ApiException $e) {
  56958.             switch ($e->getCode()) {
  56959.                 case 200:
  56960.                     $data AccountingObjectSerializer::deserialize(
  56961.                         $e->getResponseBody(),
  56962.                         '\XeroAPI\XeroPHP\Models\Accounting\CreditNotes',
  56963.                         $e->getResponseHeaders()
  56964.                     );
  56965.                     $e->setResponseObject($data);
  56966.                     break;
  56967.                 case 400:
  56968.                     $data AccountingObjectSerializer::deserialize(
  56969.                         $e->getResponseBody(),
  56970.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  56971.                         $e->getResponseHeaders()
  56972.                     );
  56973.                     $e->setResponseObject($data);
  56974.                     break;
  56975.             }
  56976.             throw $e;
  56977.         }
  56978.     }
  56979.     /**
  56980.      * Operation updateOrCreateCreditNotesAsync
  56981.      * Updates or creates one or more credit notes
  56982.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  56983.      * @param  \XeroAPI\XeroPHP\Models\Accounting\CreditNotes $credit_notes an array of Credit Notes with a single CreditNote object. (required)
  56984.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  56985.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  56986.      * @throws \InvalidArgumentException
  56987.      * @return \GuzzleHttp\Promise\PromiseInterface
  56988.      */
  56989.     public function updateOrCreateCreditNotesAsync($xero_tenant_id$credit_notes$summarize_errors false$unitdp null)
  56990.     {
  56991.         return $this->updateOrCreateCreditNotesAsyncWithHttpInfo($xero_tenant_id$credit_notes$summarize_errors$unitdp)
  56992.             ->then(
  56993.                 function ($response) {
  56994.                     return $response[0];
  56995.                 }
  56996.             );
  56997.     }
  56998.     /**
  56999.      * Operation updateOrCreateCreditNotesAsyncWithHttpInfo
  57000.      * Updates or creates one or more credit notes
  57001.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  57002.      * @param  \XeroAPI\XeroPHP\Models\Accounting\CreditNotes $credit_notes an array of Credit Notes with a single CreditNote object. (required)
  57003.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  57004.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  57005.      * @throws \InvalidArgumentException
  57006.      * @return \GuzzleHttp\Promise\PromiseInterface */
  57007.     public function updateOrCreateCreditNotesAsyncWithHttpInfo($xero_tenant_id$credit_notes$summarize_errors false$unitdp null)
  57008.     {
  57009.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\CreditNotes';
  57010.         $request $this->updateOrCreateCreditNotesRequest($xero_tenant_id$credit_notes$summarize_errors$unitdp);
  57011.         return $this->client
  57012.             ->sendAsync($request$this->createHttpClientOption())
  57013.             ->then(
  57014.                 function ($response) use ($returnType) {
  57015.                     $responseBody $response->getBody();
  57016.                     if ($returnType === '\SplFileObject') {
  57017.                         $content $responseBody//stream goes to serializer
  57018.                     } else {
  57019.                         $content $responseBody->getContents();
  57020.                     }
  57021.                     return [
  57022.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  57023.                         $response->getStatusCode(),
  57024.                         $response->getHeaders()
  57025.                     ];
  57026.                 },
  57027.                 function ($exception) {
  57028.                     $response $exception->getResponse();
  57029.                     $statusCode $response->getStatusCode();
  57030.                     throw new ApiException(
  57031.                         sprintf(
  57032.                             '[%d] Error connecting to the API (%s)',
  57033.                             $statusCode,
  57034.                             $exception->getRequest()->getUri()
  57035.                         ),
  57036.                         $statusCode,
  57037.                         $response->getHeaders(),
  57038.                         $response->getBody()
  57039.                     );
  57040.                 }
  57041.             );
  57042.     }
  57043.     /**
  57044.      * Create request for operation 'updateOrCreateCreditNotes'
  57045.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  57046.      * @param  \XeroAPI\XeroPHP\Models\Accounting\CreditNotes $credit_notes an array of Credit Notes with a single CreditNote object. (required)
  57047.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  57048.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  57049.      * @throws \InvalidArgumentException
  57050.      * @return \GuzzleHttp\Psr7\Request  */
  57051.     protected function updateOrCreateCreditNotesRequest($xero_tenant_id$credit_notes$summarize_errors false$unitdp null)
  57052.     {
  57053.         // verify the required parameter 'xero_tenant_id' is set
  57054.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  57055.             throw new \InvalidArgumentException(
  57056.                 'Missing the required parameter $xero_tenant_id when calling updateOrCreateCreditNotes'
  57057.             );
  57058.         }
  57059.         // verify the required parameter 'credit_notes' is set
  57060.         if ($credit_notes === null || (is_array($credit_notes) && count($credit_notes) === 0)) {
  57061.             throw new \InvalidArgumentException(
  57062.                 'Missing the required parameter $credit_notes when calling updateOrCreateCreditNotes'
  57063.             );
  57064.         }
  57065.         $resourcePath '/CreditNotes';
  57066.         $formParams = [];
  57067.         $queryParams = [];
  57068.         $headerParams = [];
  57069.         $httpBody '';
  57070.         $multipart false;
  57071.         // query params
  57072.         if ($summarize_errors !== null) {
  57073.             $queryParams['summarizeErrors'] = $summarize_errors 'true' 'false';
  57074.         }
  57075.         // query params
  57076.         if ($unitdp !== null) {
  57077.             $queryParams['unitdp'] = AccountingObjectSerializer::toQueryValue($unitdp);
  57078.         }
  57079.         // header params
  57080.         if ($xero_tenant_id !== null) {
  57081.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  57082.         }
  57083.         // body params
  57084.         $_tempBody null;
  57085.         if (isset($credit_notes)) {
  57086.             $_tempBody $credit_notes;
  57087.         }
  57088.         if ($multipart) {
  57089.             $headers $this->headerSelector->selectHeadersForMultipart(
  57090.                 ['application/json']
  57091.             );
  57092.         } else {
  57093.             $headers $this->headerSelector->selectHeaders(
  57094.                 ['application/json'],
  57095.                 ['application/json']
  57096.             );
  57097.         }
  57098.         // for model (json/xml)
  57099.         if (isset($_tempBody)) {
  57100.             // $_tempBody is the method argument, if present
  57101.             if ($headers['Content-Type'] === 'application/json') {
  57102.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  57103.             } else {
  57104.                 $httpBody $_tempBody;
  57105.             }
  57106.         } elseif (count($formParams) > 0) {
  57107.             if ($multipart) {
  57108.                 $multipartContents = [
  57109.                     [
  57110.                         'Content-type' => 'multipart/form-data',
  57111.                     ]
  57112.                 ];
  57113.                 
  57114.                 // for HTTP post (form)
  57115.                 $httpBody = new MultipartStream($multipartContents);
  57116.             } elseif ($headers['Content-Type'] === 'application/json') {
  57117.                 $httpBody \GuzzleHttp\json_encode($formParams);
  57118.             } else {
  57119.                 // for HTTP post (form)
  57120.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  57121.             }
  57122.         }
  57123.         // this endpoint requires OAuth (access token)
  57124.         if ($this->config->getAccessToken() !== null) {
  57125.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  57126.         }
  57127.         $defaultHeaders = [];
  57128.         if ($this->config->getUserAgent()) {
  57129.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  57130.         }
  57131.         $headers array_merge(
  57132.             $defaultHeaders,
  57133.             $headerParams,
  57134.             $headers
  57135.         );
  57136.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  57137.         return new Request(
  57138.             'POST',
  57139.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  57140.             $headers,
  57141.             $httpBody
  57142.         );
  57143.     }
  57144.     /**
  57145.      * Operation updateOrCreateEmployees
  57146.      * Creates a single new employees used in Xero payrun
  57147.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  57148.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Employees $employees Employees with array of Employee object in body of request (required)
  57149.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  57150.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  57151.      * @throws \InvalidArgumentException
  57152.      * @return \XeroAPI\XeroPHP\Models\Accounting\Employees|\XeroAPI\XeroPHP\Models\Accounting\Error
  57153.      */
  57154.     public function updateOrCreateEmployees($xero_tenant_id$employees$summarize_errors false)
  57155.     {
  57156.         list($response) = $this->updateOrCreateEmployeesWithHttpInfo($xero_tenant_id$employees$summarize_errors);
  57157.         return $response;
  57158.     }
  57159.     /**
  57160.      * Operation updateOrCreateEmployeesWithHttpInfo
  57161.      * Creates a single new employees used in Xero payrun
  57162.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  57163.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Employees $employees Employees with array of Employee object in body of request (required)
  57164.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  57165.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  57166.      * @throws \InvalidArgumentException
  57167.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Employees|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  57168.      */
  57169.     public function updateOrCreateEmployeesWithHttpInfo($xero_tenant_id$employees$summarize_errors false)
  57170.     {
  57171.         $request $this->updateOrCreateEmployeesRequest($xero_tenant_id$employees$summarize_errors);
  57172.         try {
  57173.             $options $this->createHttpClientOption();
  57174.             try {
  57175.                 $response $this->client->send($request$options);
  57176.             } catch (RequestException $e) {
  57177.                 throw new ApiException(
  57178.                     "[{$e->getCode()}{$e->getMessage()}",
  57179.                     $e->getCode(),
  57180.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  57181.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  57182.                 );
  57183.             }
  57184.             $statusCode $response->getStatusCode();
  57185.             if ($statusCode 200 || $statusCode 299) {
  57186.                 throw new ApiException(
  57187.                     sprintf(
  57188.                         '[%d] Error connecting to the API (%s)',
  57189.                         $statusCode,
  57190.                         $request->getUri()
  57191.                     ),
  57192.                     $statusCode,
  57193.                     $response->getHeaders(),
  57194.                     $response->getBody()
  57195.                 );
  57196.             }
  57197.             $responseBody $response->getBody();
  57198.             switch($statusCode) {
  57199.                 case 200:
  57200.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Employees' === '\SplFileObject') {
  57201.                         $content $responseBody//stream goes to serializer
  57202.                     } else {
  57203.                         $content $responseBody->getContents();
  57204.                     }
  57205.                     return [
  57206.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Employees', []),
  57207.                         $response->getStatusCode(),
  57208.                         $response->getHeaders()
  57209.                     ];
  57210.                 case 400:
  57211.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  57212.                         $content $responseBody//stream goes to serializer
  57213.                     } else {
  57214.                         $content $responseBody->getContents();
  57215.                     }
  57216.                     return [
  57217.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  57218.                         $response->getStatusCode(),
  57219.                         $response->getHeaders()
  57220.                     ];
  57221.             }
  57222.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Employees';
  57223.             $responseBody $response->getBody();
  57224.             if ($returnType === '\SplFileObject') {
  57225.                 $content $responseBody//stream goes to serializer
  57226.             } else {
  57227.                 $content $responseBody->getContents();
  57228.             }
  57229.             return [
  57230.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  57231.                 $response->getStatusCode(),
  57232.                 $response->getHeaders()
  57233.             ];
  57234.         } catch (ApiException $e) {
  57235.             switch ($e->getCode()) {
  57236.                 case 200:
  57237.                     $data AccountingObjectSerializer::deserialize(
  57238.                         $e->getResponseBody(),
  57239.                         '\XeroAPI\XeroPHP\Models\Accounting\Employees',
  57240.                         $e->getResponseHeaders()
  57241.                     );
  57242.                     $e->setResponseObject($data);
  57243.                     break;
  57244.                 case 400:
  57245.                     $data AccountingObjectSerializer::deserialize(
  57246.                         $e->getResponseBody(),
  57247.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  57248.                         $e->getResponseHeaders()
  57249.                     );
  57250.                     $e->setResponseObject($data);
  57251.                     break;
  57252.             }
  57253.             throw $e;
  57254.         }
  57255.     }
  57256.     /**
  57257.      * Operation updateOrCreateEmployeesAsync
  57258.      * Creates a single new employees used in Xero payrun
  57259.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  57260.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Employees $employees Employees with array of Employee object in body of request (required)
  57261.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  57262.      * @throws \InvalidArgumentException
  57263.      * @return \GuzzleHttp\Promise\PromiseInterface
  57264.      */
  57265.     public function updateOrCreateEmployeesAsync($xero_tenant_id$employees$summarize_errors false)
  57266.     {
  57267.         return $this->updateOrCreateEmployeesAsyncWithHttpInfo($xero_tenant_id$employees$summarize_errors)
  57268.             ->then(
  57269.                 function ($response) {
  57270.                     return $response[0];
  57271.                 }
  57272.             );
  57273.     }
  57274.     /**
  57275.      * Operation updateOrCreateEmployeesAsyncWithHttpInfo
  57276.      * Creates a single new employees used in Xero payrun
  57277.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  57278.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Employees $employees Employees with array of Employee object in body of request (required)
  57279.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  57280.      * @throws \InvalidArgumentException
  57281.      * @return \GuzzleHttp\Promise\PromiseInterface */
  57282.     public function updateOrCreateEmployeesAsyncWithHttpInfo($xero_tenant_id$employees$summarize_errors false)
  57283.     {
  57284.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Employees';
  57285.         $request $this->updateOrCreateEmployeesRequest($xero_tenant_id$employees$summarize_errors);
  57286.         return $this->client
  57287.             ->sendAsync($request$this->createHttpClientOption())
  57288.             ->then(
  57289.                 function ($response) use ($returnType) {
  57290.                     $responseBody $response->getBody();
  57291.                     if ($returnType === '\SplFileObject') {
  57292.                         $content $responseBody//stream goes to serializer
  57293.                     } else {
  57294.                         $content $responseBody->getContents();
  57295.                     }
  57296.                     return [
  57297.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  57298.                         $response->getStatusCode(),
  57299.                         $response->getHeaders()
  57300.                     ];
  57301.                 },
  57302.                 function ($exception) {
  57303.                     $response $exception->getResponse();
  57304.                     $statusCode $response->getStatusCode();
  57305.                     throw new ApiException(
  57306.                         sprintf(
  57307.                             '[%d] Error connecting to the API (%s)',
  57308.                             $statusCode,
  57309.                             $exception->getRequest()->getUri()
  57310.                         ),
  57311.                         $statusCode,
  57312.                         $response->getHeaders(),
  57313.                         $response->getBody()
  57314.                     );
  57315.                 }
  57316.             );
  57317.     }
  57318.     /**
  57319.      * Create request for operation 'updateOrCreateEmployees'
  57320.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  57321.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Employees $employees Employees with array of Employee object in body of request (required)
  57322.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  57323.      * @throws \InvalidArgumentException
  57324.      * @return \GuzzleHttp\Psr7\Request  */
  57325.     protected function updateOrCreateEmployeesRequest($xero_tenant_id$employees$summarize_errors false)
  57326.     {
  57327.         // verify the required parameter 'xero_tenant_id' is set
  57328.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  57329.             throw new \InvalidArgumentException(
  57330.                 'Missing the required parameter $xero_tenant_id when calling updateOrCreateEmployees'
  57331.             );
  57332.         }
  57333.         // verify the required parameter 'employees' is set
  57334.         if ($employees === null || (is_array($employees) && count($employees) === 0)) {
  57335.             throw new \InvalidArgumentException(
  57336.                 'Missing the required parameter $employees when calling updateOrCreateEmployees'
  57337.             );
  57338.         }
  57339.         $resourcePath '/Employees';
  57340.         $formParams = [];
  57341.         $queryParams = [];
  57342.         $headerParams = [];
  57343.         $httpBody '';
  57344.         $multipart false;
  57345.         // query params
  57346.         if ($summarize_errors !== null) {
  57347.             $queryParams['summarizeErrors'] = $summarize_errors 'true' 'false';
  57348.         }
  57349.         // header params
  57350.         if ($xero_tenant_id !== null) {
  57351.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  57352.         }
  57353.         // body params
  57354.         $_tempBody null;
  57355.         if (isset($employees)) {
  57356.             $_tempBody $employees;
  57357.         }
  57358.         if ($multipart) {
  57359.             $headers $this->headerSelector->selectHeadersForMultipart(
  57360.                 ['application/json']
  57361.             );
  57362.         } else {
  57363.             $headers $this->headerSelector->selectHeaders(
  57364.                 ['application/json'],
  57365.                 ['application/json']
  57366.             );
  57367.         }
  57368.         // for model (json/xml)
  57369.         if (isset($_tempBody)) {
  57370.             // $_tempBody is the method argument, if present
  57371.             if ($headers['Content-Type'] === 'application/json') {
  57372.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  57373.             } else {
  57374.                 $httpBody $_tempBody;
  57375.             }
  57376.         } elseif (count($formParams) > 0) {
  57377.             if ($multipart) {
  57378.                 $multipartContents = [
  57379.                     [
  57380.                         'Content-type' => 'multipart/form-data',
  57381.                     ]
  57382.                 ];
  57383.                 
  57384.                 // for HTTP post (form)
  57385.                 $httpBody = new MultipartStream($multipartContents);
  57386.             } elseif ($headers['Content-Type'] === 'application/json') {
  57387.                 $httpBody \GuzzleHttp\json_encode($formParams);
  57388.             } else {
  57389.                 // for HTTP post (form)
  57390.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  57391.             }
  57392.         }
  57393.         // this endpoint requires OAuth (access token)
  57394.         if ($this->config->getAccessToken() !== null) {
  57395.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  57396.         }
  57397.         $defaultHeaders = [];
  57398.         if ($this->config->getUserAgent()) {
  57399.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  57400.         }
  57401.         $headers array_merge(
  57402.             $defaultHeaders,
  57403.             $headerParams,
  57404.             $headers
  57405.         );
  57406.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  57407.         return new Request(
  57408.             'POST',
  57409.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  57410.             $headers,
  57411.             $httpBody
  57412.         );
  57413.     }
  57414.     /**
  57415.      * Operation updateOrCreateInvoices
  57416.      * Updates or creates one or more sales invoices or purchase bills
  57417.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  57418.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Invoices $invoices invoices (required)
  57419.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  57420.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  57421.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  57422.      * @throws \InvalidArgumentException
  57423.      * @return \XeroAPI\XeroPHP\Models\Accounting\Invoices|\XeroAPI\XeroPHP\Models\Accounting\Error
  57424.      */
  57425.     public function updateOrCreateInvoices($xero_tenant_id$invoices$summarize_errors false$unitdp null)
  57426.     {
  57427.         list($response) = $this->updateOrCreateInvoicesWithHttpInfo($xero_tenant_id$invoices$summarize_errors$unitdp);
  57428.         return $response;
  57429.     }
  57430.     /**
  57431.      * Operation updateOrCreateInvoicesWithHttpInfo
  57432.      * Updates or creates one or more sales invoices or purchase bills
  57433.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  57434.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Invoices $invoices (required)
  57435.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  57436.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  57437.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  57438.      * @throws \InvalidArgumentException
  57439.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Invoices|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  57440.      */
  57441.     public function updateOrCreateInvoicesWithHttpInfo($xero_tenant_id$invoices$summarize_errors false$unitdp null)
  57442.     {
  57443.         $request $this->updateOrCreateInvoicesRequest($xero_tenant_id$invoices$summarize_errors$unitdp);
  57444.         try {
  57445.             $options $this->createHttpClientOption();
  57446.             try {
  57447.                 $response $this->client->send($request$options);
  57448.             } catch (RequestException $e) {
  57449.                 throw new ApiException(
  57450.                     "[{$e->getCode()}{$e->getMessage()}",
  57451.                     $e->getCode(),
  57452.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  57453.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  57454.                 );
  57455.             }
  57456.             $statusCode $response->getStatusCode();
  57457.             if ($statusCode 200 || $statusCode 299) {
  57458.                 throw new ApiException(
  57459.                     sprintf(
  57460.                         '[%d] Error connecting to the API (%s)',
  57461.                         $statusCode,
  57462.                         $request->getUri()
  57463.                     ),
  57464.                     $statusCode,
  57465.                     $response->getHeaders(),
  57466.                     $response->getBody()
  57467.                 );
  57468.             }
  57469.             $responseBody $response->getBody();
  57470.             switch($statusCode) {
  57471.                 case 200:
  57472.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Invoices' === '\SplFileObject') {
  57473.                         $content $responseBody//stream goes to serializer
  57474.                     } else {
  57475.                         $content $responseBody->getContents();
  57476.                     }
  57477.                     return [
  57478.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Invoices', []),
  57479.                         $response->getStatusCode(),
  57480.                         $response->getHeaders()
  57481.                     ];
  57482.                 case 400:
  57483.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  57484.                         $content $responseBody//stream goes to serializer
  57485.                     } else {
  57486.                         $content $responseBody->getContents();
  57487.                     }
  57488.                     return [
  57489.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  57490.                         $response->getStatusCode(),
  57491.                         $response->getHeaders()
  57492.                     ];
  57493.             }
  57494.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Invoices';
  57495.             $responseBody $response->getBody();
  57496.             if ($returnType === '\SplFileObject') {
  57497.                 $content $responseBody//stream goes to serializer
  57498.             } else {
  57499.                 $content $responseBody->getContents();
  57500.             }
  57501.             return [
  57502.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  57503.                 $response->getStatusCode(),
  57504.                 $response->getHeaders()
  57505.             ];
  57506.         } catch (ApiException $e) {
  57507.             switch ($e->getCode()) {
  57508.                 case 200:
  57509.                     $data AccountingObjectSerializer::deserialize(
  57510.                         $e->getResponseBody(),
  57511.                         '\XeroAPI\XeroPHP\Models\Accounting\Invoices',
  57512.                         $e->getResponseHeaders()
  57513.                     );
  57514.                     $e->setResponseObject($data);
  57515.                     break;
  57516.                 case 400:
  57517.                     $data AccountingObjectSerializer::deserialize(
  57518.                         $e->getResponseBody(),
  57519.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  57520.                         $e->getResponseHeaders()
  57521.                     );
  57522.                     $e->setResponseObject($data);
  57523.                     break;
  57524.             }
  57525.             throw $e;
  57526.         }
  57527.     }
  57528.     /**
  57529.      * Operation updateOrCreateInvoicesAsync
  57530.      * Updates or creates one or more sales invoices or purchase bills
  57531.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  57532.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Invoices $invoices (required)
  57533.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  57534.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  57535.      * @throws \InvalidArgumentException
  57536.      * @return \GuzzleHttp\Promise\PromiseInterface
  57537.      */
  57538.     public function updateOrCreateInvoicesAsync($xero_tenant_id$invoices$summarize_errors false$unitdp null)
  57539.     {
  57540.         return $this->updateOrCreateInvoicesAsyncWithHttpInfo($xero_tenant_id$invoices$summarize_errors$unitdp)
  57541.             ->then(
  57542.                 function ($response) {
  57543.                     return $response[0];
  57544.                 }
  57545.             );
  57546.     }
  57547.     /**
  57548.      * Operation updateOrCreateInvoicesAsyncWithHttpInfo
  57549.      * Updates or creates one or more sales invoices or purchase bills
  57550.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  57551.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Invoices $invoices (required)
  57552.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  57553.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  57554.      * @throws \InvalidArgumentException
  57555.      * @return \GuzzleHttp\Promise\PromiseInterface */
  57556.     public function updateOrCreateInvoicesAsyncWithHttpInfo($xero_tenant_id$invoices$summarize_errors false$unitdp null)
  57557.     {
  57558.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Invoices';
  57559.         $request $this->updateOrCreateInvoicesRequest($xero_tenant_id$invoices$summarize_errors$unitdp);
  57560.         return $this->client
  57561.             ->sendAsync($request$this->createHttpClientOption())
  57562.             ->then(
  57563.                 function ($response) use ($returnType) {
  57564.                     $responseBody $response->getBody();
  57565.                     if ($returnType === '\SplFileObject') {
  57566.                         $content $responseBody//stream goes to serializer
  57567.                     } else {
  57568.                         $content $responseBody->getContents();
  57569.                     }
  57570.                     return [
  57571.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  57572.                         $response->getStatusCode(),
  57573.                         $response->getHeaders()
  57574.                     ];
  57575.                 },
  57576.                 function ($exception) {
  57577.                     $response $exception->getResponse();
  57578.                     $statusCode $response->getStatusCode();
  57579.                     throw new ApiException(
  57580.                         sprintf(
  57581.                             '[%d] Error connecting to the API (%s)',
  57582.                             $statusCode,
  57583.                             $exception->getRequest()->getUri()
  57584.                         ),
  57585.                         $statusCode,
  57586.                         $response->getHeaders(),
  57587.                         $response->getBody()
  57588.                     );
  57589.                 }
  57590.             );
  57591.     }
  57592.     /**
  57593.      * Create request for operation 'updateOrCreateInvoices'
  57594.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  57595.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Invoices $invoices (required)
  57596.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  57597.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  57598.      * @throws \InvalidArgumentException
  57599.      * @return \GuzzleHttp\Psr7\Request  */
  57600.     protected function updateOrCreateInvoicesRequest($xero_tenant_id$invoices$summarize_errors false$unitdp null)
  57601.     {
  57602.         // verify the required parameter 'xero_tenant_id' is set
  57603.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  57604.             throw new \InvalidArgumentException(
  57605.                 'Missing the required parameter $xero_tenant_id when calling updateOrCreateInvoices'
  57606.             );
  57607.         }
  57608.         // verify the required parameter 'invoices' is set
  57609.         if ($invoices === null || (is_array($invoices) && count($invoices) === 0)) {
  57610.             throw new \InvalidArgumentException(
  57611.                 'Missing the required parameter $invoices when calling updateOrCreateInvoices'
  57612.             );
  57613.         }
  57614.         $resourcePath '/Invoices';
  57615.         $formParams = [];
  57616.         $queryParams = [];
  57617.         $headerParams = [];
  57618.         $httpBody '';
  57619.         $multipart false;
  57620.         // query params
  57621.         if ($summarize_errors !== null) {
  57622.             $queryParams['summarizeErrors'] = $summarize_errors 'true' 'false';
  57623.         }
  57624.         // query params
  57625.         if ($unitdp !== null) {
  57626.             $queryParams['unitdp'] = AccountingObjectSerializer::toQueryValue($unitdp);
  57627.         }
  57628.         // header params
  57629.         if ($xero_tenant_id !== null) {
  57630.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  57631.         }
  57632.         // body params
  57633.         $_tempBody null;
  57634.         if (isset($invoices)) {
  57635.             $_tempBody $invoices;
  57636.         }
  57637.         if ($multipart) {
  57638.             $headers $this->headerSelector->selectHeadersForMultipart(
  57639.                 ['application/json']
  57640.             );
  57641.         } else {
  57642.             $headers $this->headerSelector->selectHeaders(
  57643.                 ['application/json'],
  57644.                 ['application/json']
  57645.             );
  57646.         }
  57647.         // for model (json/xml)
  57648.         if (isset($_tempBody)) {
  57649.             // $_tempBody is the method argument, if present
  57650.             if ($headers['Content-Type'] === 'application/json') {
  57651.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  57652.             } else {
  57653.                 $httpBody $_tempBody;
  57654.             }
  57655.         } elseif (count($formParams) > 0) {
  57656.             if ($multipart) {
  57657.                 $multipartContents = [
  57658.                     [
  57659.                         'Content-type' => 'multipart/form-data',
  57660.                     ]
  57661.                 ];
  57662.                 
  57663.                 // for HTTP post (form)
  57664.                 $httpBody = new MultipartStream($multipartContents);
  57665.             } elseif ($headers['Content-Type'] === 'application/json') {
  57666.                 $httpBody \GuzzleHttp\json_encode($formParams);
  57667.             } else {
  57668.                 // for HTTP post (form)
  57669.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  57670.             }
  57671.         }
  57672.         // this endpoint requires OAuth (access token)
  57673.         if ($this->config->getAccessToken() !== null) {
  57674.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  57675.         }
  57676.         $defaultHeaders = [];
  57677.         if ($this->config->getUserAgent()) {
  57678.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  57679.         }
  57680.         $headers array_merge(
  57681.             $defaultHeaders,
  57682.             $headerParams,
  57683.             $headers
  57684.         );
  57685.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  57686.         return new Request(
  57687.             'POST',
  57688.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  57689.             $headers,
  57690.             $httpBody
  57691.         );
  57692.     }
  57693.     /**
  57694.      * Operation updateOrCreateItems
  57695.      * Updates or creates one or more items
  57696.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  57697.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Items $items items (required)
  57698.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  57699.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  57700.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  57701.      * @throws \InvalidArgumentException
  57702.      * @return \XeroAPI\XeroPHP\Models\Accounting\Items|\XeroAPI\XeroPHP\Models\Accounting\Error
  57703.      */
  57704.     public function updateOrCreateItems($xero_tenant_id$items$summarize_errors false$unitdp null)
  57705.     {
  57706.         list($response) = $this->updateOrCreateItemsWithHttpInfo($xero_tenant_id$items$summarize_errors$unitdp);
  57707.         return $response;
  57708.     }
  57709.     /**
  57710.      * Operation updateOrCreateItemsWithHttpInfo
  57711.      * Updates or creates one or more items
  57712.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  57713.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Items $items (required)
  57714.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  57715.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  57716.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  57717.      * @throws \InvalidArgumentException
  57718.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Items|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  57719.      */
  57720.     public function updateOrCreateItemsWithHttpInfo($xero_tenant_id$items$summarize_errors false$unitdp null)
  57721.     {
  57722.         $request $this->updateOrCreateItemsRequest($xero_tenant_id$items$summarize_errors$unitdp);
  57723.         try {
  57724.             $options $this->createHttpClientOption();
  57725.             try {
  57726.                 $response $this->client->send($request$options);
  57727.             } catch (RequestException $e) {
  57728.                 throw new ApiException(
  57729.                     "[{$e->getCode()}{$e->getMessage()}",
  57730.                     $e->getCode(),
  57731.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  57732.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  57733.                 );
  57734.             }
  57735.             $statusCode $response->getStatusCode();
  57736.             if ($statusCode 200 || $statusCode 299) {
  57737.                 throw new ApiException(
  57738.                     sprintf(
  57739.                         '[%d] Error connecting to the API (%s)',
  57740.                         $statusCode,
  57741.                         $request->getUri()
  57742.                     ),
  57743.                     $statusCode,
  57744.                     $response->getHeaders(),
  57745.                     $response->getBody()
  57746.                 );
  57747.             }
  57748.             $responseBody $response->getBody();
  57749.             switch($statusCode) {
  57750.                 case 200:
  57751.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Items' === '\SplFileObject') {
  57752.                         $content $responseBody//stream goes to serializer
  57753.                     } else {
  57754.                         $content $responseBody->getContents();
  57755.                     }
  57756.                     return [
  57757.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Items', []),
  57758.                         $response->getStatusCode(),
  57759.                         $response->getHeaders()
  57760.                     ];
  57761.                 case 400:
  57762.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  57763.                         $content $responseBody//stream goes to serializer
  57764.                     } else {
  57765.                         $content $responseBody->getContents();
  57766.                     }
  57767.                     return [
  57768.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  57769.                         $response->getStatusCode(),
  57770.                         $response->getHeaders()
  57771.                     ];
  57772.             }
  57773.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Items';
  57774.             $responseBody $response->getBody();
  57775.             if ($returnType === '\SplFileObject') {
  57776.                 $content $responseBody//stream goes to serializer
  57777.             } else {
  57778.                 $content $responseBody->getContents();
  57779.             }
  57780.             return [
  57781.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  57782.                 $response->getStatusCode(),
  57783.                 $response->getHeaders()
  57784.             ];
  57785.         } catch (ApiException $e) {
  57786.             switch ($e->getCode()) {
  57787.                 case 200:
  57788.                     $data AccountingObjectSerializer::deserialize(
  57789.                         $e->getResponseBody(),
  57790.                         '\XeroAPI\XeroPHP\Models\Accounting\Items',
  57791.                         $e->getResponseHeaders()
  57792.                     );
  57793.                     $e->setResponseObject($data);
  57794.                     break;
  57795.                 case 400:
  57796.                     $data AccountingObjectSerializer::deserialize(
  57797.                         $e->getResponseBody(),
  57798.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  57799.                         $e->getResponseHeaders()
  57800.                     );
  57801.                     $e->setResponseObject($data);
  57802.                     break;
  57803.             }
  57804.             throw $e;
  57805.         }
  57806.     }
  57807.     /**
  57808.      * Operation updateOrCreateItemsAsync
  57809.      * Updates or creates one or more items
  57810.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  57811.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Items $items (required)
  57812.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  57813.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  57814.      * @throws \InvalidArgumentException
  57815.      * @return \GuzzleHttp\Promise\PromiseInterface
  57816.      */
  57817.     public function updateOrCreateItemsAsync($xero_tenant_id$items$summarize_errors false$unitdp null)
  57818.     {
  57819.         return $this->updateOrCreateItemsAsyncWithHttpInfo($xero_tenant_id$items$summarize_errors$unitdp)
  57820.             ->then(
  57821.                 function ($response) {
  57822.                     return $response[0];
  57823.                 }
  57824.             );
  57825.     }
  57826.     /**
  57827.      * Operation updateOrCreateItemsAsyncWithHttpInfo
  57828.      * Updates or creates one or more items
  57829.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  57830.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Items $items (required)
  57831.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  57832.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  57833.      * @throws \InvalidArgumentException
  57834.      * @return \GuzzleHttp\Promise\PromiseInterface */
  57835.     public function updateOrCreateItemsAsyncWithHttpInfo($xero_tenant_id$items$summarize_errors false$unitdp null)
  57836.     {
  57837.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Items';
  57838.         $request $this->updateOrCreateItemsRequest($xero_tenant_id$items$summarize_errors$unitdp);
  57839.         return $this->client
  57840.             ->sendAsync($request$this->createHttpClientOption())
  57841.             ->then(
  57842.                 function ($response) use ($returnType) {
  57843.                     $responseBody $response->getBody();
  57844.                     if ($returnType === '\SplFileObject') {
  57845.                         $content $responseBody//stream goes to serializer
  57846.                     } else {
  57847.                         $content $responseBody->getContents();
  57848.                     }
  57849.                     return [
  57850.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  57851.                         $response->getStatusCode(),
  57852.                         $response->getHeaders()
  57853.                     ];
  57854.                 },
  57855.                 function ($exception) {
  57856.                     $response $exception->getResponse();
  57857.                     $statusCode $response->getStatusCode();
  57858.                     throw new ApiException(
  57859.                         sprintf(
  57860.                             '[%d] Error connecting to the API (%s)',
  57861.                             $statusCode,
  57862.                             $exception->getRequest()->getUri()
  57863.                         ),
  57864.                         $statusCode,
  57865.                         $response->getHeaders(),
  57866.                         $response->getBody()
  57867.                     );
  57868.                 }
  57869.             );
  57870.     }
  57871.     /**
  57872.      * Create request for operation 'updateOrCreateItems'
  57873.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  57874.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Items $items (required)
  57875.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  57876.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  57877.      * @throws \InvalidArgumentException
  57878.      * @return \GuzzleHttp\Psr7\Request  */
  57879.     protected function updateOrCreateItemsRequest($xero_tenant_id$items$summarize_errors false$unitdp null)
  57880.     {
  57881.         // verify the required parameter 'xero_tenant_id' is set
  57882.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  57883.             throw new \InvalidArgumentException(
  57884.                 'Missing the required parameter $xero_tenant_id when calling updateOrCreateItems'
  57885.             );
  57886.         }
  57887.         // verify the required parameter 'items' is set
  57888.         if ($items === null || (is_array($items) && count($items) === 0)) {
  57889.             throw new \InvalidArgumentException(
  57890.                 'Missing the required parameter $items when calling updateOrCreateItems'
  57891.             );
  57892.         }
  57893.         $resourcePath '/Items';
  57894.         $formParams = [];
  57895.         $queryParams = [];
  57896.         $headerParams = [];
  57897.         $httpBody '';
  57898.         $multipart false;
  57899.         // query params
  57900.         if ($summarize_errors !== null) {
  57901.             $queryParams['summarizeErrors'] = $summarize_errors 'true' 'false';
  57902.         }
  57903.         // query params
  57904.         if ($unitdp !== null) {
  57905.             $queryParams['unitdp'] = AccountingObjectSerializer::toQueryValue($unitdp);
  57906.         }
  57907.         // header params
  57908.         if ($xero_tenant_id !== null) {
  57909.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  57910.         }
  57911.         // body params
  57912.         $_tempBody null;
  57913.         if (isset($items)) {
  57914.             $_tempBody $items;
  57915.         }
  57916.         if ($multipart) {
  57917.             $headers $this->headerSelector->selectHeadersForMultipart(
  57918.                 ['application/json']
  57919.             );
  57920.         } else {
  57921.             $headers $this->headerSelector->selectHeaders(
  57922.                 ['application/json'],
  57923.                 ['application/json']
  57924.             );
  57925.         }
  57926.         // for model (json/xml)
  57927.         if (isset($_tempBody)) {
  57928.             // $_tempBody is the method argument, if present
  57929.             if ($headers['Content-Type'] === 'application/json') {
  57930.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  57931.             } else {
  57932.                 $httpBody $_tempBody;
  57933.             }
  57934.         } elseif (count($formParams) > 0) {
  57935.             if ($multipart) {
  57936.                 $multipartContents = [
  57937.                     [
  57938.                         'Content-type' => 'multipart/form-data',
  57939.                     ]
  57940.                 ];
  57941.                 
  57942.                 // for HTTP post (form)
  57943.                 $httpBody = new MultipartStream($multipartContents);
  57944.             } elseif ($headers['Content-Type'] === 'application/json') {
  57945.                 $httpBody \GuzzleHttp\json_encode($formParams);
  57946.             } else {
  57947.                 // for HTTP post (form)
  57948.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  57949.             }
  57950.         }
  57951.         // this endpoint requires OAuth (access token)
  57952.         if ($this->config->getAccessToken() !== null) {
  57953.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  57954.         }
  57955.         $defaultHeaders = [];
  57956.         if ($this->config->getUserAgent()) {
  57957.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  57958.         }
  57959.         $headers array_merge(
  57960.             $defaultHeaders,
  57961.             $headerParams,
  57962.             $headers
  57963.         );
  57964.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  57965.         return new Request(
  57966.             'POST',
  57967.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  57968.             $headers,
  57969.             $httpBody
  57970.         );
  57971.     }
  57972.     /**
  57973.      * Operation updateOrCreateManualJournals
  57974.      * Updates or creates a single manual journal
  57975.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  57976.      * @param  \XeroAPI\XeroPHP\Models\Accounting\ManualJournals $manual_journals ManualJournals array with ManualJournal object in body of request (required)
  57977.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  57978.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  57979.      * @throws \InvalidArgumentException
  57980.      * @return \XeroAPI\XeroPHP\Models\Accounting\ManualJournals|\XeroAPI\XeroPHP\Models\Accounting\Error
  57981.      */
  57982.     public function updateOrCreateManualJournals($xero_tenant_id$manual_journals$summarize_errors false)
  57983.     {
  57984.         list($response) = $this->updateOrCreateManualJournalsWithHttpInfo($xero_tenant_id$manual_journals$summarize_errors);
  57985.         return $response;
  57986.     }
  57987.     /**
  57988.      * Operation updateOrCreateManualJournalsWithHttpInfo
  57989.      * Updates or creates a single manual journal
  57990.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  57991.      * @param  \XeroAPI\XeroPHP\Models\Accounting\ManualJournals $manual_journals ManualJournals array with ManualJournal object in body of request (required)
  57992.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  57993.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  57994.      * @throws \InvalidArgumentException
  57995.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\ManualJournals|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  57996.      */
  57997.     public function updateOrCreateManualJournalsWithHttpInfo($xero_tenant_id$manual_journals$summarize_errors false)
  57998.     {
  57999.         $request $this->updateOrCreateManualJournalsRequest($xero_tenant_id$manual_journals$summarize_errors);
  58000.         try {
  58001.             $options $this->createHttpClientOption();
  58002.             try {
  58003.                 $response $this->client->send($request$options);
  58004.             } catch (RequestException $e) {
  58005.                 throw new ApiException(
  58006.                     "[{$e->getCode()}{$e->getMessage()}",
  58007.                     $e->getCode(),
  58008.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  58009.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  58010.                 );
  58011.             }
  58012.             $statusCode $response->getStatusCode();
  58013.             if ($statusCode 200 || $statusCode 299) {
  58014.                 throw new ApiException(
  58015.                     sprintf(
  58016.                         '[%d] Error connecting to the API (%s)',
  58017.                         $statusCode,
  58018.                         $request->getUri()
  58019.                     ),
  58020.                     $statusCode,
  58021.                     $response->getHeaders(),
  58022.                     $response->getBody()
  58023.                 );
  58024.             }
  58025.             $responseBody $response->getBody();
  58026.             switch($statusCode) {
  58027.                 case 200:
  58028.                     if ('\XeroAPI\XeroPHP\Models\Accounting\ManualJournals' === '\SplFileObject') {
  58029.                         $content $responseBody//stream goes to serializer
  58030.                     } else {
  58031.                         $content $responseBody->getContents();
  58032.                     }
  58033.                     return [
  58034.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\ManualJournals', []),
  58035.                         $response->getStatusCode(),
  58036.                         $response->getHeaders()
  58037.                     ];
  58038.                 case 400:
  58039.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  58040.                         $content $responseBody//stream goes to serializer
  58041.                     } else {
  58042.                         $content $responseBody->getContents();
  58043.                     }
  58044.                     return [
  58045.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  58046.                         $response->getStatusCode(),
  58047.                         $response->getHeaders()
  58048.                     ];
  58049.             }
  58050.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\ManualJournals';
  58051.             $responseBody $response->getBody();
  58052.             if ($returnType === '\SplFileObject') {
  58053.                 $content $responseBody//stream goes to serializer
  58054.             } else {
  58055.                 $content $responseBody->getContents();
  58056.             }
  58057.             return [
  58058.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  58059.                 $response->getStatusCode(),
  58060.                 $response->getHeaders()
  58061.             ];
  58062.         } catch (ApiException $e) {
  58063.             switch ($e->getCode()) {
  58064.                 case 200:
  58065.                     $data AccountingObjectSerializer::deserialize(
  58066.                         $e->getResponseBody(),
  58067.                         '\XeroAPI\XeroPHP\Models\Accounting\ManualJournals',
  58068.                         $e->getResponseHeaders()
  58069.                     );
  58070.                     $e->setResponseObject($data);
  58071.                     break;
  58072.                 case 400:
  58073.                     $data AccountingObjectSerializer::deserialize(
  58074.                         $e->getResponseBody(),
  58075.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  58076.                         $e->getResponseHeaders()
  58077.                     );
  58078.                     $e->setResponseObject($data);
  58079.                     break;
  58080.             }
  58081.             throw $e;
  58082.         }
  58083.     }
  58084.     /**
  58085.      * Operation updateOrCreateManualJournalsAsync
  58086.      * Updates or creates a single manual journal
  58087.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  58088.      * @param  \XeroAPI\XeroPHP\Models\Accounting\ManualJournals $manual_journals ManualJournals array with ManualJournal object in body of request (required)
  58089.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  58090.      * @throws \InvalidArgumentException
  58091.      * @return \GuzzleHttp\Promise\PromiseInterface
  58092.      */
  58093.     public function updateOrCreateManualJournalsAsync($xero_tenant_id$manual_journals$summarize_errors false)
  58094.     {
  58095.         return $this->updateOrCreateManualJournalsAsyncWithHttpInfo($xero_tenant_id$manual_journals$summarize_errors)
  58096.             ->then(
  58097.                 function ($response) {
  58098.                     return $response[0];
  58099.                 }
  58100.             );
  58101.     }
  58102.     /**
  58103.      * Operation updateOrCreateManualJournalsAsyncWithHttpInfo
  58104.      * Updates or creates a single manual journal
  58105.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  58106.      * @param  \XeroAPI\XeroPHP\Models\Accounting\ManualJournals $manual_journals ManualJournals array with ManualJournal object in body of request (required)
  58107.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  58108.      * @throws \InvalidArgumentException
  58109.      * @return \GuzzleHttp\Promise\PromiseInterface */
  58110.     public function updateOrCreateManualJournalsAsyncWithHttpInfo($xero_tenant_id$manual_journals$summarize_errors false)
  58111.     {
  58112.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\ManualJournals';
  58113.         $request $this->updateOrCreateManualJournalsRequest($xero_tenant_id$manual_journals$summarize_errors);
  58114.         return $this->client
  58115.             ->sendAsync($request$this->createHttpClientOption())
  58116.             ->then(
  58117.                 function ($response) use ($returnType) {
  58118.                     $responseBody $response->getBody();
  58119.                     if ($returnType === '\SplFileObject') {
  58120.                         $content $responseBody//stream goes to serializer
  58121.                     } else {
  58122.                         $content $responseBody->getContents();
  58123.                     }
  58124.                     return [
  58125.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  58126.                         $response->getStatusCode(),
  58127.                         $response->getHeaders()
  58128.                     ];
  58129.                 },
  58130.                 function ($exception) {
  58131.                     $response $exception->getResponse();
  58132.                     $statusCode $response->getStatusCode();
  58133.                     throw new ApiException(
  58134.                         sprintf(
  58135.                             '[%d] Error connecting to the API (%s)',
  58136.                             $statusCode,
  58137.                             $exception->getRequest()->getUri()
  58138.                         ),
  58139.                         $statusCode,
  58140.                         $response->getHeaders(),
  58141.                         $response->getBody()
  58142.                     );
  58143.                 }
  58144.             );
  58145.     }
  58146.     /**
  58147.      * Create request for operation 'updateOrCreateManualJournals'
  58148.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  58149.      * @param  \XeroAPI\XeroPHP\Models\Accounting\ManualJournals $manual_journals ManualJournals array with ManualJournal object in body of request (required)
  58150.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  58151.      * @throws \InvalidArgumentException
  58152.      * @return \GuzzleHttp\Psr7\Request  */
  58153.     protected function updateOrCreateManualJournalsRequest($xero_tenant_id$manual_journals$summarize_errors false)
  58154.     {
  58155.         // verify the required parameter 'xero_tenant_id' is set
  58156.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  58157.             throw new \InvalidArgumentException(
  58158.                 'Missing the required parameter $xero_tenant_id when calling updateOrCreateManualJournals'
  58159.             );
  58160.         }
  58161.         // verify the required parameter 'manual_journals' is set
  58162.         if ($manual_journals === null || (is_array($manual_journals) && count($manual_journals) === 0)) {
  58163.             throw new \InvalidArgumentException(
  58164.                 'Missing the required parameter $manual_journals when calling updateOrCreateManualJournals'
  58165.             );
  58166.         }
  58167.         $resourcePath '/ManualJournals';
  58168.         $formParams = [];
  58169.         $queryParams = [];
  58170.         $headerParams = [];
  58171.         $httpBody '';
  58172.         $multipart false;
  58173.         // query params
  58174.         if ($summarize_errors !== null) {
  58175.             $queryParams['summarizeErrors'] = $summarize_errors 'true' 'false';
  58176.         }
  58177.         // header params
  58178.         if ($xero_tenant_id !== null) {
  58179.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  58180.         }
  58181.         // body params
  58182.         $_tempBody null;
  58183.         if (isset($manual_journals)) {
  58184.             $_tempBody $manual_journals;
  58185.         }
  58186.         if ($multipart) {
  58187.             $headers $this->headerSelector->selectHeadersForMultipart(
  58188.                 ['application/json']
  58189.             );
  58190.         } else {
  58191.             $headers $this->headerSelector->selectHeaders(
  58192.                 ['application/json'],
  58193.                 ['application/json']
  58194.             );
  58195.         }
  58196.         // for model (json/xml)
  58197.         if (isset($_tempBody)) {
  58198.             // $_tempBody is the method argument, if present
  58199.             if ($headers['Content-Type'] === 'application/json') {
  58200.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  58201.             } else {
  58202.                 $httpBody $_tempBody;
  58203.             }
  58204.         } elseif (count($formParams) > 0) {
  58205.             if ($multipart) {
  58206.                 $multipartContents = [
  58207.                     [
  58208.                         'Content-type' => 'multipart/form-data',
  58209.                     ]
  58210.                 ];
  58211.                 
  58212.                 // for HTTP post (form)
  58213.                 $httpBody = new MultipartStream($multipartContents);
  58214.             } elseif ($headers['Content-Type'] === 'application/json') {
  58215.                 $httpBody \GuzzleHttp\json_encode($formParams);
  58216.             } else {
  58217.                 // for HTTP post (form)
  58218.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  58219.             }
  58220.         }
  58221.         // this endpoint requires OAuth (access token)
  58222.         if ($this->config->getAccessToken() !== null) {
  58223.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  58224.         }
  58225.         $defaultHeaders = [];
  58226.         if ($this->config->getUserAgent()) {
  58227.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  58228.         }
  58229.         $headers array_merge(
  58230.             $defaultHeaders,
  58231.             $headerParams,
  58232.             $headers
  58233.         );
  58234.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  58235.         return new Request(
  58236.             'POST',
  58237.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  58238.             $headers,
  58239.             $httpBody
  58240.         );
  58241.     }
  58242.     /**
  58243.      * Operation updateOrCreatePurchaseOrders
  58244.      * Updates or creates one or more purchase orders
  58245.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  58246.      * @param  \XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders $purchase_orders purchase_orders (required)
  58247.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  58248.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  58249.      * @throws \InvalidArgumentException
  58250.      * @return \XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders|\XeroAPI\XeroPHP\Models\Accounting\Error
  58251.      */
  58252.     public function updateOrCreatePurchaseOrders($xero_tenant_id$purchase_orders$summarize_errors false)
  58253.     {
  58254.         list($response) = $this->updateOrCreatePurchaseOrdersWithHttpInfo($xero_tenant_id$purchase_orders$summarize_errors);
  58255.         return $response;
  58256.     }
  58257.     /**
  58258.      * Operation updateOrCreatePurchaseOrdersWithHttpInfo
  58259.      * Updates or creates one or more purchase orders
  58260.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  58261.      * @param  \XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders $purchase_orders (required)
  58262.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  58263.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  58264.      * @throws \InvalidArgumentException
  58265.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  58266.      */
  58267.     public function updateOrCreatePurchaseOrdersWithHttpInfo($xero_tenant_id$purchase_orders$summarize_errors false)
  58268.     {
  58269.         $request $this->updateOrCreatePurchaseOrdersRequest($xero_tenant_id$purchase_orders$summarize_errors);
  58270.         try {
  58271.             $options $this->createHttpClientOption();
  58272.             try {
  58273.                 $response $this->client->send($request$options);
  58274.             } catch (RequestException $e) {
  58275.                 throw new ApiException(
  58276.                     "[{$e->getCode()}{$e->getMessage()}",
  58277.                     $e->getCode(),
  58278.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  58279.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  58280.                 );
  58281.             }
  58282.             $statusCode $response->getStatusCode();
  58283.             if ($statusCode 200 || $statusCode 299) {
  58284.                 throw new ApiException(
  58285.                     sprintf(
  58286.                         '[%d] Error connecting to the API (%s)',
  58287.                         $statusCode,
  58288.                         $request->getUri()
  58289.                     ),
  58290.                     $statusCode,
  58291.                     $response->getHeaders(),
  58292.                     $response->getBody()
  58293.                 );
  58294.             }
  58295.             $responseBody $response->getBody();
  58296.             switch($statusCode) {
  58297.                 case 200:
  58298.                     if ('\XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders' === '\SplFileObject') {
  58299.                         $content $responseBody//stream goes to serializer
  58300.                     } else {
  58301.                         $content $responseBody->getContents();
  58302.                     }
  58303.                     return [
  58304.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders', []),
  58305.                         $response->getStatusCode(),
  58306.                         $response->getHeaders()
  58307.                     ];
  58308.                 case 400:
  58309.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  58310.                         $content $responseBody//stream goes to serializer
  58311.                     } else {
  58312.                         $content $responseBody->getContents();
  58313.                     }
  58314.                     return [
  58315.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  58316.                         $response->getStatusCode(),
  58317.                         $response->getHeaders()
  58318.                     ];
  58319.             }
  58320.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders';
  58321.             $responseBody $response->getBody();
  58322.             if ($returnType === '\SplFileObject') {
  58323.                 $content $responseBody//stream goes to serializer
  58324.             } else {
  58325.                 $content $responseBody->getContents();
  58326.             }
  58327.             return [
  58328.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  58329.                 $response->getStatusCode(),
  58330.                 $response->getHeaders()
  58331.             ];
  58332.         } catch (ApiException $e) {
  58333.             switch ($e->getCode()) {
  58334.                 case 200:
  58335.                     $data AccountingObjectSerializer::deserialize(
  58336.                         $e->getResponseBody(),
  58337.                         '\XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders',
  58338.                         $e->getResponseHeaders()
  58339.                     );
  58340.                     $e->setResponseObject($data);
  58341.                     break;
  58342.                 case 400:
  58343.                     $data AccountingObjectSerializer::deserialize(
  58344.                         $e->getResponseBody(),
  58345.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  58346.                         $e->getResponseHeaders()
  58347.                     );
  58348.                     $e->setResponseObject($data);
  58349.                     break;
  58350.             }
  58351.             throw $e;
  58352.         }
  58353.     }
  58354.     /**
  58355.      * Operation updateOrCreatePurchaseOrdersAsync
  58356.      * Updates or creates one or more purchase orders
  58357.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  58358.      * @param  \XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders $purchase_orders (required)
  58359.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  58360.      * @throws \InvalidArgumentException
  58361.      * @return \GuzzleHttp\Promise\PromiseInterface
  58362.      */
  58363.     public function updateOrCreatePurchaseOrdersAsync($xero_tenant_id$purchase_orders$summarize_errors false)
  58364.     {
  58365.         return $this->updateOrCreatePurchaseOrdersAsyncWithHttpInfo($xero_tenant_id$purchase_orders$summarize_errors)
  58366.             ->then(
  58367.                 function ($response) {
  58368.                     return $response[0];
  58369.                 }
  58370.             );
  58371.     }
  58372.     /**
  58373.      * Operation updateOrCreatePurchaseOrdersAsyncWithHttpInfo
  58374.      * Updates or creates one or more purchase orders
  58375.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  58376.      * @param  \XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders $purchase_orders (required)
  58377.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  58378.      * @throws \InvalidArgumentException
  58379.      * @return \GuzzleHttp\Promise\PromiseInterface */
  58380.     public function updateOrCreatePurchaseOrdersAsyncWithHttpInfo($xero_tenant_id$purchase_orders$summarize_errors false)
  58381.     {
  58382.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders';
  58383.         $request $this->updateOrCreatePurchaseOrdersRequest($xero_tenant_id$purchase_orders$summarize_errors);
  58384.         return $this->client
  58385.             ->sendAsync($request$this->createHttpClientOption())
  58386.             ->then(
  58387.                 function ($response) use ($returnType) {
  58388.                     $responseBody $response->getBody();
  58389.                     if ($returnType === '\SplFileObject') {
  58390.                         $content $responseBody//stream goes to serializer
  58391.                     } else {
  58392.                         $content $responseBody->getContents();
  58393.                     }
  58394.                     return [
  58395.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  58396.                         $response->getStatusCode(),
  58397.                         $response->getHeaders()
  58398.                     ];
  58399.                 },
  58400.                 function ($exception) {
  58401.                     $response $exception->getResponse();
  58402.                     $statusCode $response->getStatusCode();
  58403.                     throw new ApiException(
  58404.                         sprintf(
  58405.                             '[%d] Error connecting to the API (%s)',
  58406.                             $statusCode,
  58407.                             $exception->getRequest()->getUri()
  58408.                         ),
  58409.                         $statusCode,
  58410.                         $response->getHeaders(),
  58411.                         $response->getBody()
  58412.                     );
  58413.                 }
  58414.             );
  58415.     }
  58416.     /**
  58417.      * Create request for operation 'updateOrCreatePurchaseOrders'
  58418.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  58419.      * @param  \XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders $purchase_orders (required)
  58420.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  58421.      * @throws \InvalidArgumentException
  58422.      * @return \GuzzleHttp\Psr7\Request  */
  58423.     protected function updateOrCreatePurchaseOrdersRequest($xero_tenant_id$purchase_orders$summarize_errors false)
  58424.     {
  58425.         // verify the required parameter 'xero_tenant_id' is set
  58426.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  58427.             throw new \InvalidArgumentException(
  58428.                 'Missing the required parameter $xero_tenant_id when calling updateOrCreatePurchaseOrders'
  58429.             );
  58430.         }
  58431.         // verify the required parameter 'purchase_orders' is set
  58432.         if ($purchase_orders === null || (is_array($purchase_orders) && count($purchase_orders) === 0)) {
  58433.             throw new \InvalidArgumentException(
  58434.                 'Missing the required parameter $purchase_orders when calling updateOrCreatePurchaseOrders'
  58435.             );
  58436.         }
  58437.         $resourcePath '/PurchaseOrders';
  58438.         $formParams = [];
  58439.         $queryParams = [];
  58440.         $headerParams = [];
  58441.         $httpBody '';
  58442.         $multipart false;
  58443.         // query params
  58444.         if ($summarize_errors !== null) {
  58445.             $queryParams['summarizeErrors'] = $summarize_errors 'true' 'false';
  58446.         }
  58447.         // header params
  58448.         if ($xero_tenant_id !== null) {
  58449.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  58450.         }
  58451.         // body params
  58452.         $_tempBody null;
  58453.         if (isset($purchase_orders)) {
  58454.             $_tempBody $purchase_orders;
  58455.         }
  58456.         if ($multipart) {
  58457.             $headers $this->headerSelector->selectHeadersForMultipart(
  58458.                 ['application/json']
  58459.             );
  58460.         } else {
  58461.             $headers $this->headerSelector->selectHeaders(
  58462.                 ['application/json'],
  58463.                 ['application/json']
  58464.             );
  58465.         }
  58466.         // for model (json/xml)
  58467.         if (isset($_tempBody)) {
  58468.             // $_tempBody is the method argument, if present
  58469.             if ($headers['Content-Type'] === 'application/json') {
  58470.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  58471.             } else {
  58472.                 $httpBody $_tempBody;
  58473.             }
  58474.         } elseif (count($formParams) > 0) {
  58475.             if ($multipart) {
  58476.                 $multipartContents = [
  58477.                     [
  58478.                         'Content-type' => 'multipart/form-data',
  58479.                     ]
  58480.                 ];
  58481.                 
  58482.                 // for HTTP post (form)
  58483.                 $httpBody = new MultipartStream($multipartContents);
  58484.             } elseif ($headers['Content-Type'] === 'application/json') {
  58485.                 $httpBody \GuzzleHttp\json_encode($formParams);
  58486.             } else {
  58487.                 // for HTTP post (form)
  58488.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  58489.             }
  58490.         }
  58491.         // this endpoint requires OAuth (access token)
  58492.         if ($this->config->getAccessToken() !== null) {
  58493.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  58494.         }
  58495.         $defaultHeaders = [];
  58496.         if ($this->config->getUserAgent()) {
  58497.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  58498.         }
  58499.         $headers array_merge(
  58500.             $defaultHeaders,
  58501.             $headerParams,
  58502.             $headers
  58503.         );
  58504.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  58505.         return new Request(
  58506.             'POST',
  58507.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  58508.             $headers,
  58509.             $httpBody
  58510.         );
  58511.     }
  58512.     /**
  58513.      * Operation updateOrCreateQuotes
  58514.      * Updates or creates one or more quotes
  58515.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  58516.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Quotes $quotes quotes (required)
  58517.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  58518.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  58519.      * @throws \InvalidArgumentException
  58520.      * @return \XeroAPI\XeroPHP\Models\Accounting\Quotes|\XeroAPI\XeroPHP\Models\Accounting\Error
  58521.      */
  58522.     public function updateOrCreateQuotes($xero_tenant_id$quotes$summarize_errors false)
  58523.     {
  58524.         list($response) = $this->updateOrCreateQuotesWithHttpInfo($xero_tenant_id$quotes$summarize_errors);
  58525.         return $response;
  58526.     }
  58527.     /**
  58528.      * Operation updateOrCreateQuotesWithHttpInfo
  58529.      * Updates or creates one or more quotes
  58530.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  58531.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Quotes $quotes (required)
  58532.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  58533.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  58534.      * @throws \InvalidArgumentException
  58535.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Quotes|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  58536.      */
  58537.     public function updateOrCreateQuotesWithHttpInfo($xero_tenant_id$quotes$summarize_errors false)
  58538.     {
  58539.         $request $this->updateOrCreateQuotesRequest($xero_tenant_id$quotes$summarize_errors);
  58540.         try {
  58541.             $options $this->createHttpClientOption();
  58542.             try {
  58543.                 $response $this->client->send($request$options);
  58544.             } catch (RequestException $e) {
  58545.                 throw new ApiException(
  58546.                     "[{$e->getCode()}{$e->getMessage()}",
  58547.                     $e->getCode(),
  58548.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  58549.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  58550.                 );
  58551.             }
  58552.             $statusCode $response->getStatusCode();
  58553.             if ($statusCode 200 || $statusCode 299) {
  58554.                 throw new ApiException(
  58555.                     sprintf(
  58556.                         '[%d] Error connecting to the API (%s)',
  58557.                         $statusCode,
  58558.                         $request->getUri()
  58559.                     ),
  58560.                     $statusCode,
  58561.                     $response->getHeaders(),
  58562.                     $response->getBody()
  58563.                 );
  58564.             }
  58565.             $responseBody $response->getBody();
  58566.             switch($statusCode) {
  58567.                 case 200:
  58568.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Quotes' === '\SplFileObject') {
  58569.                         $content $responseBody//stream goes to serializer
  58570.                     } else {
  58571.                         $content $responseBody->getContents();
  58572.                     }
  58573.                     return [
  58574.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Quotes', []),
  58575.                         $response->getStatusCode(),
  58576.                         $response->getHeaders()
  58577.                     ];
  58578.                 case 400:
  58579.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  58580.                         $content $responseBody//stream goes to serializer
  58581.                     } else {
  58582.                         $content $responseBody->getContents();
  58583.                     }
  58584.                     return [
  58585.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  58586.                         $response->getStatusCode(),
  58587.                         $response->getHeaders()
  58588.                     ];
  58589.             }
  58590.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Quotes';
  58591.             $responseBody $response->getBody();
  58592.             if ($returnType === '\SplFileObject') {
  58593.                 $content $responseBody//stream goes to serializer
  58594.             } else {
  58595.                 $content $responseBody->getContents();
  58596.             }
  58597.             return [
  58598.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  58599.                 $response->getStatusCode(),
  58600.                 $response->getHeaders()
  58601.             ];
  58602.         } catch (ApiException $e) {
  58603.             switch ($e->getCode()) {
  58604.                 case 200:
  58605.                     $data AccountingObjectSerializer::deserialize(
  58606.                         $e->getResponseBody(),
  58607.                         '\XeroAPI\XeroPHP\Models\Accounting\Quotes',
  58608.                         $e->getResponseHeaders()
  58609.                     );
  58610.                     $e->setResponseObject($data);
  58611.                     break;
  58612.                 case 400:
  58613.                     $data AccountingObjectSerializer::deserialize(
  58614.                         $e->getResponseBody(),
  58615.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  58616.                         $e->getResponseHeaders()
  58617.                     );
  58618.                     $e->setResponseObject($data);
  58619.                     break;
  58620.             }
  58621.             throw $e;
  58622.         }
  58623.     }
  58624.     /**
  58625.      * Operation updateOrCreateQuotesAsync
  58626.      * Updates or creates one or more quotes
  58627.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  58628.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Quotes $quotes (required)
  58629.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  58630.      * @throws \InvalidArgumentException
  58631.      * @return \GuzzleHttp\Promise\PromiseInterface
  58632.      */
  58633.     public function updateOrCreateQuotesAsync($xero_tenant_id$quotes$summarize_errors false)
  58634.     {
  58635.         return $this->updateOrCreateQuotesAsyncWithHttpInfo($xero_tenant_id$quotes$summarize_errors)
  58636.             ->then(
  58637.                 function ($response) {
  58638.                     return $response[0];
  58639.                 }
  58640.             );
  58641.     }
  58642.     /**
  58643.      * Operation updateOrCreateQuotesAsyncWithHttpInfo
  58644.      * Updates or creates one or more quotes
  58645.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  58646.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Quotes $quotes (required)
  58647.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  58648.      * @throws \InvalidArgumentException
  58649.      * @return \GuzzleHttp\Promise\PromiseInterface */
  58650.     public function updateOrCreateQuotesAsyncWithHttpInfo($xero_tenant_id$quotes$summarize_errors false)
  58651.     {
  58652.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Quotes';
  58653.         $request $this->updateOrCreateQuotesRequest($xero_tenant_id$quotes$summarize_errors);
  58654.         return $this->client
  58655.             ->sendAsync($request$this->createHttpClientOption())
  58656.             ->then(
  58657.                 function ($response) use ($returnType) {
  58658.                     $responseBody $response->getBody();
  58659.                     if ($returnType === '\SplFileObject') {
  58660.                         $content $responseBody//stream goes to serializer
  58661.                     } else {
  58662.                         $content $responseBody->getContents();
  58663.                     }
  58664.                     return [
  58665.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  58666.                         $response->getStatusCode(),
  58667.                         $response->getHeaders()
  58668.                     ];
  58669.                 },
  58670.                 function ($exception) {
  58671.                     $response $exception->getResponse();
  58672.                     $statusCode $response->getStatusCode();
  58673.                     throw new ApiException(
  58674.                         sprintf(
  58675.                             '[%d] Error connecting to the API (%s)',
  58676.                             $statusCode,
  58677.                             $exception->getRequest()->getUri()
  58678.                         ),
  58679.                         $statusCode,
  58680.                         $response->getHeaders(),
  58681.                         $response->getBody()
  58682.                     );
  58683.                 }
  58684.             );
  58685.     }
  58686.     /**
  58687.      * Create request for operation 'updateOrCreateQuotes'
  58688.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  58689.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Quotes $quotes (required)
  58690.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  58691.      * @throws \InvalidArgumentException
  58692.      * @return \GuzzleHttp\Psr7\Request  */
  58693.     protected function updateOrCreateQuotesRequest($xero_tenant_id$quotes$summarize_errors false)
  58694.     {
  58695.         // verify the required parameter 'xero_tenant_id' is set
  58696.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  58697.             throw new \InvalidArgumentException(
  58698.                 'Missing the required parameter $xero_tenant_id when calling updateOrCreateQuotes'
  58699.             );
  58700.         }
  58701.         // verify the required parameter 'quotes' is set
  58702.         if ($quotes === null || (is_array($quotes) && count($quotes) === 0)) {
  58703.             throw new \InvalidArgumentException(
  58704.                 'Missing the required parameter $quotes when calling updateOrCreateQuotes'
  58705.             );
  58706.         }
  58707.         $resourcePath '/Quotes';
  58708.         $formParams = [];
  58709.         $queryParams = [];
  58710.         $headerParams = [];
  58711.         $httpBody '';
  58712.         $multipart false;
  58713.         // query params
  58714.         if ($summarize_errors !== null) {
  58715.             $queryParams['summarizeErrors'] = $summarize_errors 'true' 'false';
  58716.         }
  58717.         // header params
  58718.         if ($xero_tenant_id !== null) {
  58719.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  58720.         }
  58721.         // body params
  58722.         $_tempBody null;
  58723.         if (isset($quotes)) {
  58724.             $_tempBody $quotes;
  58725.         }
  58726.         if ($multipart) {
  58727.             $headers $this->headerSelector->selectHeadersForMultipart(
  58728.                 ['application/json']
  58729.             );
  58730.         } else {
  58731.             $headers $this->headerSelector->selectHeaders(
  58732.                 ['application/json'],
  58733.                 ['application/json']
  58734.             );
  58735.         }
  58736.         // for model (json/xml)
  58737.         if (isset($_tempBody)) {
  58738.             // $_tempBody is the method argument, if present
  58739.             if ($headers['Content-Type'] === 'application/json') {
  58740.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  58741.             } else {
  58742.                 $httpBody $_tempBody;
  58743.             }
  58744.         } elseif (count($formParams) > 0) {
  58745.             if ($multipart) {
  58746.                 $multipartContents = [
  58747.                     [
  58748.                         'Content-type' => 'multipart/form-data',
  58749.                     ]
  58750.                 ];
  58751.                 
  58752.                 // for HTTP post (form)
  58753.                 $httpBody = new MultipartStream($multipartContents);
  58754.             } elseif ($headers['Content-Type'] === 'application/json') {
  58755.                 $httpBody \GuzzleHttp\json_encode($formParams);
  58756.             } else {
  58757.                 // for HTTP post (form)
  58758.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  58759.             }
  58760.         }
  58761.         // this endpoint requires OAuth (access token)
  58762.         if ($this->config->getAccessToken() !== null) {
  58763.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  58764.         }
  58765.         $defaultHeaders = [];
  58766.         if ($this->config->getUserAgent()) {
  58767.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  58768.         }
  58769.         $headers array_merge(
  58770.             $defaultHeaders,
  58771.             $headerParams,
  58772.             $headers
  58773.         );
  58774.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  58775.         return new Request(
  58776.             'POST',
  58777.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  58778.             $headers,
  58779.             $httpBody
  58780.         );
  58781.     }
  58782.     /**
  58783.      * Operation updateOrCreateRepeatingInvoices
  58784.      * Creates or deletes one or more repeating invoice templates
  58785.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  58786.      * @param  \XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices $repeating_invoices RepeatingInvoices with an array of repeating invoice objects in body of request (required)
  58787.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  58788.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  58789.      * @throws \InvalidArgumentException
  58790.      * @return \XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices|\XeroAPI\XeroPHP\Models\Accounting\Error
  58791.      */
  58792.     public function updateOrCreateRepeatingInvoices($xero_tenant_id$repeating_invoices$summarize_errors false)
  58793.     {
  58794.         list($response) = $this->updateOrCreateRepeatingInvoicesWithHttpInfo($xero_tenant_id$repeating_invoices$summarize_errors);
  58795.         return $response;
  58796.     }
  58797.     /**
  58798.      * Operation updateOrCreateRepeatingInvoicesWithHttpInfo
  58799.      * Creates or deletes one or more repeating invoice templates
  58800.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  58801.      * @param  \XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices $repeating_invoices RepeatingInvoices with an array of repeating invoice objects in body of request (required)
  58802.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  58803.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  58804.      * @throws \InvalidArgumentException
  58805.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  58806.      */
  58807.     public function updateOrCreateRepeatingInvoicesWithHttpInfo($xero_tenant_id$repeating_invoices$summarize_errors false)
  58808.     {
  58809.         $request $this->updateOrCreateRepeatingInvoicesRequest($xero_tenant_id$repeating_invoices$summarize_errors);
  58810.         try {
  58811.             $options $this->createHttpClientOption();
  58812.             try {
  58813.                 $response $this->client->send($request$options);
  58814.             } catch (RequestException $e) {
  58815.                 throw new ApiException(
  58816.                     "[{$e->getCode()}{$e->getMessage()}",
  58817.                     $e->getCode(),
  58818.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  58819.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  58820.                 );
  58821.             }
  58822.             $statusCode $response->getStatusCode();
  58823.             if ($statusCode 200 || $statusCode 299) {
  58824.                 throw new ApiException(
  58825.                     sprintf(
  58826.                         '[%d] Error connecting to the API (%s)',
  58827.                         $statusCode,
  58828.                         $request->getUri()
  58829.                     ),
  58830.                     $statusCode,
  58831.                     $response->getHeaders(),
  58832.                     $response->getBody()
  58833.                 );
  58834.             }
  58835.             $responseBody $response->getBody();
  58836.             switch($statusCode) {
  58837.                 case 200:
  58838.                     if ('\XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices' === '\SplFileObject') {
  58839.                         $content $responseBody//stream goes to serializer
  58840.                     } else {
  58841.                         $content $responseBody->getContents();
  58842.                     }
  58843.                     return [
  58844.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices', []),
  58845.                         $response->getStatusCode(),
  58846.                         $response->getHeaders()
  58847.                     ];
  58848.                 case 400:
  58849.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  58850.                         $content $responseBody//stream goes to serializer
  58851.                     } else {
  58852.                         $content $responseBody->getContents();
  58853.                     }
  58854.                     return [
  58855.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  58856.                         $response->getStatusCode(),
  58857.                         $response->getHeaders()
  58858.                     ];
  58859.             }
  58860.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices';
  58861.             $responseBody $response->getBody();
  58862.             if ($returnType === '\SplFileObject') {
  58863.                 $content $responseBody//stream goes to serializer
  58864.             } else {
  58865.                 $content $responseBody->getContents();
  58866.             }
  58867.             return [
  58868.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  58869.                 $response->getStatusCode(),
  58870.                 $response->getHeaders()
  58871.             ];
  58872.         } catch (ApiException $e) {
  58873.             switch ($e->getCode()) {
  58874.                 case 200:
  58875.                     $data AccountingObjectSerializer::deserialize(
  58876.                         $e->getResponseBody(),
  58877.                         '\XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices',
  58878.                         $e->getResponseHeaders()
  58879.                     );
  58880.                     $e->setResponseObject($data);
  58881.                     break;
  58882.                 case 400:
  58883.                     $data AccountingObjectSerializer::deserialize(
  58884.                         $e->getResponseBody(),
  58885.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  58886.                         $e->getResponseHeaders()
  58887.                     );
  58888.                     $e->setResponseObject($data);
  58889.                     break;
  58890.             }
  58891.             throw $e;
  58892.         }
  58893.     }
  58894.     /**
  58895.      * Operation updateOrCreateRepeatingInvoicesAsync
  58896.      * Creates or deletes one or more repeating invoice templates
  58897.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  58898.      * @param  \XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices $repeating_invoices RepeatingInvoices with an array of repeating invoice objects in body of request (required)
  58899.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  58900.      * @throws \InvalidArgumentException
  58901.      * @return \GuzzleHttp\Promise\PromiseInterface
  58902.      */
  58903.     public function updateOrCreateRepeatingInvoicesAsync($xero_tenant_id$repeating_invoices$summarize_errors false)
  58904.     {
  58905.         return $this->updateOrCreateRepeatingInvoicesAsyncWithHttpInfo($xero_tenant_id$repeating_invoices$summarize_errors)
  58906.             ->then(
  58907.                 function ($response) {
  58908.                     return $response[0];
  58909.                 }
  58910.             );
  58911.     }
  58912.     /**
  58913.      * Operation updateOrCreateRepeatingInvoicesAsyncWithHttpInfo
  58914.      * Creates or deletes one or more repeating invoice templates
  58915.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  58916.      * @param  \XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices $repeating_invoices RepeatingInvoices with an array of repeating invoice objects in body of request (required)
  58917.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  58918.      * @throws \InvalidArgumentException
  58919.      * @return \GuzzleHttp\Promise\PromiseInterface */
  58920.     public function updateOrCreateRepeatingInvoicesAsyncWithHttpInfo($xero_tenant_id$repeating_invoices$summarize_errors false)
  58921.     {
  58922.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices';
  58923.         $request $this->updateOrCreateRepeatingInvoicesRequest($xero_tenant_id$repeating_invoices$summarize_errors);
  58924.         return $this->client
  58925.             ->sendAsync($request$this->createHttpClientOption())
  58926.             ->then(
  58927.                 function ($response) use ($returnType) {
  58928.                     $responseBody $response->getBody();
  58929.                     if ($returnType === '\SplFileObject') {
  58930.                         $content $responseBody//stream goes to serializer
  58931.                     } else {
  58932.                         $content $responseBody->getContents();
  58933.                     }
  58934.                     return [
  58935.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  58936.                         $response->getStatusCode(),
  58937.                         $response->getHeaders()
  58938.                     ];
  58939.                 },
  58940.                 function ($exception) {
  58941.                     $response $exception->getResponse();
  58942.                     $statusCode $response->getStatusCode();
  58943.                     throw new ApiException(
  58944.                         sprintf(
  58945.                             '[%d] Error connecting to the API (%s)',
  58946.                             $statusCode,
  58947.                             $exception->getRequest()->getUri()
  58948.                         ),
  58949.                         $statusCode,
  58950.                         $response->getHeaders(),
  58951.                         $response->getBody()
  58952.                     );
  58953.                 }
  58954.             );
  58955.     }
  58956.     /**
  58957.      * Create request for operation 'updateOrCreateRepeatingInvoices'
  58958.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  58959.      * @param  \XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices $repeating_invoices RepeatingInvoices with an array of repeating invoice objects in body of request (required)
  58960.      * @param  bool $summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors (optional, default to false)
  58961.      * @throws \InvalidArgumentException
  58962.      * @return \GuzzleHttp\Psr7\Request  */
  58963.     protected function updateOrCreateRepeatingInvoicesRequest($xero_tenant_id$repeating_invoices$summarize_errors false)
  58964.     {
  58965.         // verify the required parameter 'xero_tenant_id' is set
  58966.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  58967.             throw new \InvalidArgumentException(
  58968.                 'Missing the required parameter $xero_tenant_id when calling updateOrCreateRepeatingInvoices'
  58969.             );
  58970.         }
  58971.         // verify the required parameter 'repeating_invoices' is set
  58972.         if ($repeating_invoices === null || (is_array($repeating_invoices) && count($repeating_invoices) === 0)) {
  58973.             throw new \InvalidArgumentException(
  58974.                 'Missing the required parameter $repeating_invoices when calling updateOrCreateRepeatingInvoices'
  58975.             );
  58976.         }
  58977.         $resourcePath '/RepeatingInvoices';
  58978.         $formParams = [];
  58979.         $queryParams = [];
  58980.         $headerParams = [];
  58981.         $httpBody '';
  58982.         $multipart false;
  58983.         // query params
  58984.         if ($summarize_errors !== null) {
  58985.             $queryParams['summarizeErrors'] = $summarize_errors 'true' 'false';
  58986.         }
  58987.         // header params
  58988.         if ($xero_tenant_id !== null) {
  58989.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  58990.         }
  58991.         // body params
  58992.         $_tempBody null;
  58993.         if (isset($repeating_invoices)) {
  58994.             $_tempBody $repeating_invoices;
  58995.         }
  58996.         if ($multipart) {
  58997.             $headers $this->headerSelector->selectHeadersForMultipart(
  58998.                 ['application/json']
  58999.             );
  59000.         } else {
  59001.             $headers $this->headerSelector->selectHeaders(
  59002.                 ['application/json'],
  59003.                 ['application/json']
  59004.             );
  59005.         }
  59006.         // for model (json/xml)
  59007.         if (isset($_tempBody)) {
  59008.             // $_tempBody is the method argument, if present
  59009.             if ($headers['Content-Type'] === 'application/json') {
  59010.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  59011.             } else {
  59012.                 $httpBody $_tempBody;
  59013.             }
  59014.         } elseif (count($formParams) > 0) {
  59015.             if ($multipart) {
  59016.                 $multipartContents = [
  59017.                     [
  59018.                         'Content-type' => 'multipart/form-data',
  59019.                     ]
  59020.                 ];
  59021.                 
  59022.                 // for HTTP post (form)
  59023.                 $httpBody = new MultipartStream($multipartContents);
  59024.             } elseif ($headers['Content-Type'] === 'application/json') {
  59025.                 $httpBody \GuzzleHttp\json_encode($formParams);
  59026.             } else {
  59027.                 // for HTTP post (form)
  59028.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  59029.             }
  59030.         }
  59031.         // this endpoint requires OAuth (access token)
  59032.         if ($this->config->getAccessToken() !== null) {
  59033.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  59034.         }
  59035.         $defaultHeaders = [];
  59036.         if ($this->config->getUserAgent()) {
  59037.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  59038.         }
  59039.         $headers array_merge(
  59040.             $defaultHeaders,
  59041.             $headerParams,
  59042.             $headers
  59043.         );
  59044.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  59045.         return new Request(
  59046.             'POST',
  59047.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  59048.             $headers,
  59049.             $httpBody
  59050.         );
  59051.     }
  59052.     /**
  59053.      * Operation updatePurchaseOrder
  59054.      * Updates a specific purchase order
  59055.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  59056.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  59057.      * @param  \XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders $purchase_orders purchase_orders (required)
  59058.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  59059.      * @throws \InvalidArgumentException
  59060.      * @return \XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders|\XeroAPI\XeroPHP\Models\Accounting\Error
  59061.      */
  59062.     public function updatePurchaseOrder($xero_tenant_id$purchase_order_id$purchase_orders)
  59063.     {
  59064.         list($response) = $this->updatePurchaseOrderWithHttpInfo($xero_tenant_id$purchase_order_id$purchase_orders);
  59065.         return $response;
  59066.     }
  59067.     /**
  59068.      * Operation updatePurchaseOrderWithHttpInfo
  59069.      * Updates a specific purchase order
  59070.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  59071.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  59072.      * @param  \XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders $purchase_orders (required)
  59073.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  59074.      * @throws \InvalidArgumentException
  59075.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  59076.      */
  59077.     public function updatePurchaseOrderWithHttpInfo($xero_tenant_id$purchase_order_id$purchase_orders)
  59078.     {
  59079.         $request $this->updatePurchaseOrderRequest($xero_tenant_id$purchase_order_id$purchase_orders);
  59080.         try {
  59081.             $options $this->createHttpClientOption();
  59082.             try {
  59083.                 $response $this->client->send($request$options);
  59084.             } catch (RequestException $e) {
  59085.                 throw new ApiException(
  59086.                     "[{$e->getCode()}{$e->getMessage()}",
  59087.                     $e->getCode(),
  59088.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  59089.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  59090.                 );
  59091.             }
  59092.             $statusCode $response->getStatusCode();
  59093.             if ($statusCode 200 || $statusCode 299) {
  59094.                 throw new ApiException(
  59095.                     sprintf(
  59096.                         '[%d] Error connecting to the API (%s)',
  59097.                         $statusCode,
  59098.                         $request->getUri()
  59099.                     ),
  59100.                     $statusCode,
  59101.                     $response->getHeaders(),
  59102.                     $response->getBody()
  59103.                 );
  59104.             }
  59105.             $responseBody $response->getBody();
  59106.             switch($statusCode) {
  59107.                 case 200:
  59108.                     if ('\XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders' === '\SplFileObject') {
  59109.                         $content $responseBody//stream goes to serializer
  59110.                     } else {
  59111.                         $content $responseBody->getContents();
  59112.                     }
  59113.                     return [
  59114.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders', []),
  59115.                         $response->getStatusCode(),
  59116.                         $response->getHeaders()
  59117.                     ];
  59118.                 case 400:
  59119.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  59120.                         $content $responseBody//stream goes to serializer
  59121.                     } else {
  59122.                         $content $responseBody->getContents();
  59123.                     }
  59124.                     return [
  59125.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  59126.                         $response->getStatusCode(),
  59127.                         $response->getHeaders()
  59128.                     ];
  59129.             }
  59130.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders';
  59131.             $responseBody $response->getBody();
  59132.             if ($returnType === '\SplFileObject') {
  59133.                 $content $responseBody//stream goes to serializer
  59134.             } else {
  59135.                 $content $responseBody->getContents();
  59136.             }
  59137.             return [
  59138.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  59139.                 $response->getStatusCode(),
  59140.                 $response->getHeaders()
  59141.             ];
  59142.         } catch (ApiException $e) {
  59143.             switch ($e->getCode()) {
  59144.                 case 200:
  59145.                     $data AccountingObjectSerializer::deserialize(
  59146.                         $e->getResponseBody(),
  59147.                         '\XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders',
  59148.                         $e->getResponseHeaders()
  59149.                     );
  59150.                     $e->setResponseObject($data);
  59151.                     break;
  59152.                 case 400:
  59153.                     $data AccountingObjectSerializer::deserialize(
  59154.                         $e->getResponseBody(),
  59155.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  59156.                         $e->getResponseHeaders()
  59157.                     );
  59158.                     $e->setResponseObject($data);
  59159.                     break;
  59160.             }
  59161.             throw $e;
  59162.         }
  59163.     }
  59164.     /**
  59165.      * Operation updatePurchaseOrderAsync
  59166.      * Updates a specific purchase order
  59167.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  59168.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  59169.      * @param  \XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders $purchase_orders (required)
  59170.      * @throws \InvalidArgumentException
  59171.      * @return \GuzzleHttp\Promise\PromiseInterface
  59172.      */
  59173.     public function updatePurchaseOrderAsync($xero_tenant_id$purchase_order_id$purchase_orders)
  59174.     {
  59175.         return $this->updatePurchaseOrderAsyncWithHttpInfo($xero_tenant_id$purchase_order_id$purchase_orders)
  59176.             ->then(
  59177.                 function ($response) {
  59178.                     return $response[0];
  59179.                 }
  59180.             );
  59181.     }
  59182.     /**
  59183.      * Operation updatePurchaseOrderAsyncWithHttpInfo
  59184.      * Updates a specific purchase order
  59185.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  59186.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  59187.      * @param  \XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders $purchase_orders (required)
  59188.      * @throws \InvalidArgumentException
  59189.      * @return \GuzzleHttp\Promise\PromiseInterface */
  59190.     public function updatePurchaseOrderAsyncWithHttpInfo($xero_tenant_id$purchase_order_id$purchase_orders)
  59191.     {
  59192.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders';
  59193.         $request $this->updatePurchaseOrderRequest($xero_tenant_id$purchase_order_id$purchase_orders);
  59194.         return $this->client
  59195.             ->sendAsync($request$this->createHttpClientOption())
  59196.             ->then(
  59197.                 function ($response) use ($returnType) {
  59198.                     $responseBody $response->getBody();
  59199.                     if ($returnType === '\SplFileObject') {
  59200.                         $content $responseBody//stream goes to serializer
  59201.                     } else {
  59202.                         $content $responseBody->getContents();
  59203.                     }
  59204.                     return [
  59205.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  59206.                         $response->getStatusCode(),
  59207.                         $response->getHeaders()
  59208.                     ];
  59209.                 },
  59210.                 function ($exception) {
  59211.                     $response $exception->getResponse();
  59212.                     $statusCode $response->getStatusCode();
  59213.                     throw new ApiException(
  59214.                         sprintf(
  59215.                             '[%d] Error connecting to the API (%s)',
  59216.                             $statusCode,
  59217.                             $exception->getRequest()->getUri()
  59218.                         ),
  59219.                         $statusCode,
  59220.                         $response->getHeaders(),
  59221.                         $response->getBody()
  59222.                     );
  59223.                 }
  59224.             );
  59225.     }
  59226.     /**
  59227.      * Create request for operation 'updatePurchaseOrder'
  59228.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  59229.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  59230.      * @param  \XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders $purchase_orders (required)
  59231.      * @throws \InvalidArgumentException
  59232.      * @return \GuzzleHttp\Psr7\Request  */
  59233.     protected function updatePurchaseOrderRequest($xero_tenant_id$purchase_order_id$purchase_orders)
  59234.     {
  59235.         // verify the required parameter 'xero_tenant_id' is set
  59236.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  59237.             throw new \InvalidArgumentException(
  59238.                 'Missing the required parameter $xero_tenant_id when calling updatePurchaseOrder'
  59239.             );
  59240.         }
  59241.         // verify the required parameter 'purchase_order_id' is set
  59242.         if ($purchase_order_id === null || (is_array($purchase_order_id) && count($purchase_order_id) === 0)) {
  59243.             throw new \InvalidArgumentException(
  59244.                 'Missing the required parameter $purchase_order_id when calling updatePurchaseOrder'
  59245.             );
  59246.         }
  59247.         // verify the required parameter 'purchase_orders' is set
  59248.         if ($purchase_orders === null || (is_array($purchase_orders) && count($purchase_orders) === 0)) {
  59249.             throw new \InvalidArgumentException(
  59250.                 'Missing the required parameter $purchase_orders when calling updatePurchaseOrder'
  59251.             );
  59252.         }
  59253.         $resourcePath '/PurchaseOrders/{PurchaseOrderID}';
  59254.         $formParams = [];
  59255.         $queryParams = [];
  59256.         $headerParams = [];
  59257.         $httpBody '';
  59258.         $multipart false;
  59259.         // header params
  59260.         if ($xero_tenant_id !== null) {
  59261.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  59262.         }
  59263.         // path params
  59264.         if ($purchase_order_id !== null) {
  59265.             $resourcePath str_replace(
  59266.                 '{' 'PurchaseOrderID' '}',
  59267.                 AccountingObjectSerializer::toPathValue($purchase_order_id),
  59268.                 $resourcePath
  59269.             );
  59270.         }
  59271.         // body params
  59272.         $_tempBody null;
  59273.         if (isset($purchase_orders)) {
  59274.             $_tempBody $purchase_orders;
  59275.         }
  59276.         if ($multipart) {
  59277.             $headers $this->headerSelector->selectHeadersForMultipart(
  59278.                 ['application/json']
  59279.             );
  59280.         } else {
  59281.             $headers $this->headerSelector->selectHeaders(
  59282.                 ['application/json'],
  59283.                 ['application/json']
  59284.             );
  59285.         }
  59286.         // for model (json/xml)
  59287.         if (isset($_tempBody)) {
  59288.             // $_tempBody is the method argument, if present
  59289.             if ($headers['Content-Type'] === 'application/json') {
  59290.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  59291.             } else {
  59292.                 $httpBody $_tempBody;
  59293.             }
  59294.         } elseif (count($formParams) > 0) {
  59295.             if ($multipart) {
  59296.                 $multipartContents = [
  59297.                     [
  59298.                         'Content-type' => 'multipart/form-data',
  59299.                     ]
  59300.                 ];
  59301.                 
  59302.                 // for HTTP post (form)
  59303.                 $httpBody = new MultipartStream($multipartContents);
  59304.             } elseif ($headers['Content-Type'] === 'application/json') {
  59305.                 $httpBody \GuzzleHttp\json_encode($formParams);
  59306.             } else {
  59307.                 // for HTTP post (form)
  59308.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  59309.             }
  59310.         }
  59311.         // this endpoint requires OAuth (access token)
  59312.         if ($this->config->getAccessToken() !== null) {
  59313.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  59314.         }
  59315.         $defaultHeaders = [];
  59316.         if ($this->config->getUserAgent()) {
  59317.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  59318.         }
  59319.         $headers array_merge(
  59320.             $defaultHeaders,
  59321.             $headerParams,
  59322.             $headers
  59323.         );
  59324.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  59325.         return new Request(
  59326.             'POST',
  59327.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  59328.             $headers,
  59329.             $httpBody
  59330.         );
  59331.     }
  59332.     /**
  59333.      * Operation updatePurchaseOrderAttachmentByFileName
  59334.      * Updates a specific attachment for a specific purchase order by filename
  59335.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  59336.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  59337.      * @param  string $file_name Name of the attachment (required)
  59338.      * @param  string $body Byte array of file in body of request (required)
  59339.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  59340.      * @throws \InvalidArgumentException
  59341.      * @return \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error
  59342.      */
  59343.     public function updatePurchaseOrderAttachmentByFileName($xero_tenant_id$purchase_order_id$file_name$body)
  59344.     {
  59345.         list($response) = $this->updatePurchaseOrderAttachmentByFileNameWithHttpInfo($xero_tenant_id$purchase_order_id$file_name$body);
  59346.         return $response;
  59347.     }
  59348.     /**
  59349.      * Operation updatePurchaseOrderAttachmentByFileNameWithHttpInfo
  59350.      * Updates a specific attachment for a specific purchase order by filename
  59351.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  59352.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  59353.      * @param  string $file_name Name of the attachment (required)
  59354.      * @param  string $body Byte array of file in body of request (required)
  59355.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  59356.      * @throws \InvalidArgumentException
  59357.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  59358.      */
  59359.     public function updatePurchaseOrderAttachmentByFileNameWithHttpInfo($xero_tenant_id$purchase_order_id$file_name$body)
  59360.     {
  59361.         $request $this->updatePurchaseOrderAttachmentByFileNameRequest($xero_tenant_id$purchase_order_id$file_name$body);
  59362.         try {
  59363.             $options $this->createHttpClientOption();
  59364.             try {
  59365.                 $response $this->client->send($request$options);
  59366.             } catch (RequestException $e) {
  59367.                 throw new ApiException(
  59368.                     "[{$e->getCode()}{$e->getMessage()}",
  59369.                     $e->getCode(),
  59370.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  59371.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  59372.                 );
  59373.             }
  59374.             $statusCode $response->getStatusCode();
  59375.             if ($statusCode 200 || $statusCode 299) {
  59376.                 throw new ApiException(
  59377.                     sprintf(
  59378.                         '[%d] Error connecting to the API (%s)',
  59379.                         $statusCode,
  59380.                         $request->getUri()
  59381.                     ),
  59382.                     $statusCode,
  59383.                     $response->getHeaders(),
  59384.                     $response->getBody()
  59385.                 );
  59386.             }
  59387.             $responseBody $response->getBody();
  59388.             switch($statusCode) {
  59389.                 case 200:
  59390.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Attachments' === '\SplFileObject') {
  59391.                         $content $responseBody//stream goes to serializer
  59392.                     } else {
  59393.                         $content $responseBody->getContents();
  59394.                     }
  59395.                     return [
  59396.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Attachments', []),
  59397.                         $response->getStatusCode(),
  59398.                         $response->getHeaders()
  59399.                     ];
  59400.                 case 400:
  59401.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  59402.                         $content $responseBody//stream goes to serializer
  59403.                     } else {
  59404.                         $content $responseBody->getContents();
  59405.                     }
  59406.                     return [
  59407.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  59408.                         $response->getStatusCode(),
  59409.                         $response->getHeaders()
  59410.                     ];
  59411.             }
  59412.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  59413.             $responseBody $response->getBody();
  59414.             if ($returnType === '\SplFileObject') {
  59415.                 $content $responseBody//stream goes to serializer
  59416.             } else {
  59417.                 $content $responseBody->getContents();
  59418.             }
  59419.             return [
  59420.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  59421.                 $response->getStatusCode(),
  59422.                 $response->getHeaders()
  59423.             ];
  59424.         } catch (ApiException $e) {
  59425.             switch ($e->getCode()) {
  59426.                 case 200:
  59427.                     $data AccountingObjectSerializer::deserialize(
  59428.                         $e->getResponseBody(),
  59429.                         '\XeroAPI\XeroPHP\Models\Accounting\Attachments',
  59430.                         $e->getResponseHeaders()
  59431.                     );
  59432.                     $e->setResponseObject($data);
  59433.                     break;
  59434.                 case 400:
  59435.                     $data AccountingObjectSerializer::deserialize(
  59436.                         $e->getResponseBody(),
  59437.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  59438.                         $e->getResponseHeaders()
  59439.                     );
  59440.                     $e->setResponseObject($data);
  59441.                     break;
  59442.             }
  59443.             throw $e;
  59444.         }
  59445.     }
  59446.     /**
  59447.      * Operation updatePurchaseOrderAttachmentByFileNameAsync
  59448.      * Updates a specific attachment for a specific purchase order by filename
  59449.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  59450.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  59451.      * @param  string $file_name Name of the attachment (required)
  59452.      * @param  string $body Byte array of file in body of request (required)
  59453.      * @throws \InvalidArgumentException
  59454.      * @return \GuzzleHttp\Promise\PromiseInterface
  59455.      */
  59456.     public function updatePurchaseOrderAttachmentByFileNameAsync($xero_tenant_id$purchase_order_id$file_name$body)
  59457.     {
  59458.         return $this->updatePurchaseOrderAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$purchase_order_id$file_name$body)
  59459.             ->then(
  59460.                 function ($response) {
  59461.                     return $response[0];
  59462.                 }
  59463.             );
  59464.     }
  59465.     /**
  59466.      * Operation updatePurchaseOrderAttachmentByFileNameAsyncWithHttpInfo
  59467.      * Updates a specific attachment for a specific purchase order by filename
  59468.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  59469.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  59470.      * @param  string $file_name Name of the attachment (required)
  59471.      * @param  string $body Byte array of file in body of request (required)
  59472.      * @throws \InvalidArgumentException
  59473.      * @return \GuzzleHttp\Promise\PromiseInterface */
  59474.     public function updatePurchaseOrderAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$purchase_order_id$file_name$body)
  59475.     {
  59476.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  59477.         $request $this->updatePurchaseOrderAttachmentByFileNameRequest($xero_tenant_id$purchase_order_id$file_name$body);
  59478.         return $this->client
  59479.             ->sendAsync($request$this->createHttpClientOption())
  59480.             ->then(
  59481.                 function ($response) use ($returnType) {
  59482.                     $responseBody $response->getBody();
  59483.                     if ($returnType === '\SplFileObject') {
  59484.                         $content $responseBody//stream goes to serializer
  59485.                     } else {
  59486.                         $content $responseBody->getContents();
  59487.                     }
  59488.                     return [
  59489.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  59490.                         $response->getStatusCode(),
  59491.                         $response->getHeaders()
  59492.                     ];
  59493.                 },
  59494.                 function ($exception) {
  59495.                     $response $exception->getResponse();
  59496.                     $statusCode $response->getStatusCode();
  59497.                     throw new ApiException(
  59498.                         sprintf(
  59499.                             '[%d] Error connecting to the API (%s)',
  59500.                             $statusCode,
  59501.                             $exception->getRequest()->getUri()
  59502.                         ),
  59503.                         $statusCode,
  59504.                         $response->getHeaders(),
  59505.                         $response->getBody()
  59506.                     );
  59507.                 }
  59508.             );
  59509.     }
  59510.     /**
  59511.      * Create request for operation 'updatePurchaseOrderAttachmentByFileName'
  59512.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  59513.      * @param  string $purchase_order_id Unique identifier for an Purchase Order (required)
  59514.      * @param  string $file_name Name of the attachment (required)
  59515.      * @param  string $body Byte array of file in body of request (required)
  59516.      * @throws \InvalidArgumentException
  59517.      * @return \GuzzleHttp\Psr7\Request  */
  59518.     protected function updatePurchaseOrderAttachmentByFileNameRequest($xero_tenant_id$purchase_order_id$file_name$body)
  59519.     {
  59520.         // verify the required parameter 'xero_tenant_id' is set
  59521.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  59522.             throw new \InvalidArgumentException(
  59523.                 'Missing the required parameter $xero_tenant_id when calling updatePurchaseOrderAttachmentByFileName'
  59524.             );
  59525.         }
  59526.         // verify the required parameter 'purchase_order_id' is set
  59527.         if ($purchase_order_id === null || (is_array($purchase_order_id) && count($purchase_order_id) === 0)) {
  59528.             throw new \InvalidArgumentException(
  59529.                 'Missing the required parameter $purchase_order_id when calling updatePurchaseOrderAttachmentByFileName'
  59530.             );
  59531.         }
  59532.         // verify the required parameter 'file_name' is set
  59533.         if ($file_name === null || (is_array($file_name) && count($file_name) === 0)) {
  59534.             throw new \InvalidArgumentException(
  59535.                 'Missing the required parameter $file_name when calling updatePurchaseOrderAttachmentByFileName'
  59536.             );
  59537.         }
  59538.         // verify the required parameter 'body' is set
  59539.         if ($body === null || (is_array($body) && count($body) === 0)) {
  59540.             throw new \InvalidArgumentException(
  59541.                 'Missing the required parameter $body when calling updatePurchaseOrderAttachmentByFileName'
  59542.             );
  59543.         }
  59544.         $resourcePath '/PurchaseOrders/{PurchaseOrderID}/Attachments/{FileName}';
  59545.         $formParams = [];
  59546.         $queryParams = [];
  59547.         $headerParams = [];
  59548.         $httpBody '';
  59549.         $multipart false;
  59550.         // header params
  59551.         if ($xero_tenant_id !== null) {
  59552.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  59553.         }
  59554.         // path params
  59555.         if ($purchase_order_id !== null) {
  59556.             $resourcePath str_replace(
  59557.                 '{' 'PurchaseOrderID' '}',
  59558.                 AccountingObjectSerializer::toPathValue($purchase_order_id),
  59559.                 $resourcePath
  59560.             );
  59561.         }
  59562.         // path params
  59563.         if ($file_name !== null) {
  59564.             $resourcePath str_replace(
  59565.                 '{' 'FileName' '}',
  59566.                 AccountingObjectSerializer::toPathValue($file_name),
  59567.                 $resourcePath
  59568.             );
  59569.         }
  59570.         // body params
  59571.         $_tempBody null;
  59572.         if (isset($body)) {
  59573.             $_tempBody $body;
  59574.         }
  59575.         if ($multipart) {
  59576.             $headers $this->headerSelector->selectHeadersForMultipart(
  59577.                 ['application/json']
  59578.             );
  59579.         } else {
  59580.             $headers $this->headerSelector->selectHeaders(
  59581.                 ['application/json'],
  59582.                 ['application/octet-stream']
  59583.             );
  59584.         }
  59585.         // for model (json/xml)
  59586.         if (isset($_tempBody)) {
  59587.             // $_tempBody is the method argument, if present
  59588.             if ($headers['Content-Type'] === 'application/json') {
  59589.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  59590.             } else {
  59591.                 $httpBody $_tempBody;
  59592.             }
  59593.         } elseif (count($formParams) > 0) {
  59594.             if ($multipart) {
  59595.                 $multipartContents = [
  59596.                     [
  59597.                         'Content-type' => 'multipart/form-data',
  59598.                     ]
  59599.                 ];
  59600.                 
  59601.                 // for HTTP post (form)
  59602.                 $httpBody = new MultipartStream($multipartContents);
  59603.             } elseif ($headers['Content-Type'] === 'application/json') {
  59604.                 $httpBody \GuzzleHttp\json_encode($formParams);
  59605.             } else {
  59606.                 // for HTTP post (form)
  59607.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  59608.             }
  59609.         }
  59610.         // this endpoint requires OAuth (access token)
  59611.         if ($this->config->getAccessToken() !== null) {
  59612.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  59613.         }
  59614.         $defaultHeaders = [];
  59615.         if ($this->config->getUserAgent()) {
  59616.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  59617.         }
  59618.         $headers array_merge(
  59619.             $defaultHeaders,
  59620.             $headerParams,
  59621.             $headers
  59622.         );
  59623.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  59624.         return new Request(
  59625.             'POST',
  59626.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  59627.             $headers,
  59628.             $httpBody
  59629.         );
  59630.     }
  59631.     /**
  59632.      * Operation updateQuote
  59633.      * Updates a specific quote
  59634.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  59635.      * @param  string $quote_id Unique identifier for an Quote (required)
  59636.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Quotes $quotes quotes (required)
  59637.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  59638.      * @throws \InvalidArgumentException
  59639.      * @return \XeroAPI\XeroPHP\Models\Accounting\Quotes|\XeroAPI\XeroPHP\Models\Accounting\Error
  59640.      */
  59641.     public function updateQuote($xero_tenant_id$quote_id$quotes)
  59642.     {
  59643.         list($response) = $this->updateQuoteWithHttpInfo($xero_tenant_id$quote_id$quotes);
  59644.         return $response;
  59645.     }
  59646.     /**
  59647.      * Operation updateQuoteWithHttpInfo
  59648.      * Updates a specific quote
  59649.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  59650.      * @param  string $quote_id Unique identifier for an Quote (required)
  59651.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Quotes $quotes (required)
  59652.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  59653.      * @throws \InvalidArgumentException
  59654.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Quotes|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  59655.      */
  59656.     public function updateQuoteWithHttpInfo($xero_tenant_id$quote_id$quotes)
  59657.     {
  59658.         $request $this->updateQuoteRequest($xero_tenant_id$quote_id$quotes);
  59659.         try {
  59660.             $options $this->createHttpClientOption();
  59661.             try {
  59662.                 $response $this->client->send($request$options);
  59663.             } catch (RequestException $e) {
  59664.                 throw new ApiException(
  59665.                     "[{$e->getCode()}{$e->getMessage()}",
  59666.                     $e->getCode(),
  59667.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  59668.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  59669.                 );
  59670.             }
  59671.             $statusCode $response->getStatusCode();
  59672.             if ($statusCode 200 || $statusCode 299) {
  59673.                 throw new ApiException(
  59674.                     sprintf(
  59675.                         '[%d] Error connecting to the API (%s)',
  59676.                         $statusCode,
  59677.                         $request->getUri()
  59678.                     ),
  59679.                     $statusCode,
  59680.                     $response->getHeaders(),
  59681.                     $response->getBody()
  59682.                 );
  59683.             }
  59684.             $responseBody $response->getBody();
  59685.             switch($statusCode) {
  59686.                 case 200:
  59687.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Quotes' === '\SplFileObject') {
  59688.                         $content $responseBody//stream goes to serializer
  59689.                     } else {
  59690.                         $content $responseBody->getContents();
  59691.                     }
  59692.                     return [
  59693.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Quotes', []),
  59694.                         $response->getStatusCode(),
  59695.                         $response->getHeaders()
  59696.                     ];
  59697.                 case 400:
  59698.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  59699.                         $content $responseBody//stream goes to serializer
  59700.                     } else {
  59701.                         $content $responseBody->getContents();
  59702.                     }
  59703.                     return [
  59704.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  59705.                         $response->getStatusCode(),
  59706.                         $response->getHeaders()
  59707.                     ];
  59708.             }
  59709.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Quotes';
  59710.             $responseBody $response->getBody();
  59711.             if ($returnType === '\SplFileObject') {
  59712.                 $content $responseBody//stream goes to serializer
  59713.             } else {
  59714.                 $content $responseBody->getContents();
  59715.             }
  59716.             return [
  59717.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  59718.                 $response->getStatusCode(),
  59719.                 $response->getHeaders()
  59720.             ];
  59721.         } catch (ApiException $e) {
  59722.             switch ($e->getCode()) {
  59723.                 case 200:
  59724.                     $data AccountingObjectSerializer::deserialize(
  59725.                         $e->getResponseBody(),
  59726.                         '\XeroAPI\XeroPHP\Models\Accounting\Quotes',
  59727.                         $e->getResponseHeaders()
  59728.                     );
  59729.                     $e->setResponseObject($data);
  59730.                     break;
  59731.                 case 400:
  59732.                     $data AccountingObjectSerializer::deserialize(
  59733.                         $e->getResponseBody(),
  59734.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  59735.                         $e->getResponseHeaders()
  59736.                     );
  59737.                     $e->setResponseObject($data);
  59738.                     break;
  59739.             }
  59740.             throw $e;
  59741.         }
  59742.     }
  59743.     /**
  59744.      * Operation updateQuoteAsync
  59745.      * Updates a specific quote
  59746.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  59747.      * @param  string $quote_id Unique identifier for an Quote (required)
  59748.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Quotes $quotes (required)
  59749.      * @throws \InvalidArgumentException
  59750.      * @return \GuzzleHttp\Promise\PromiseInterface
  59751.      */
  59752.     public function updateQuoteAsync($xero_tenant_id$quote_id$quotes)
  59753.     {
  59754.         return $this->updateQuoteAsyncWithHttpInfo($xero_tenant_id$quote_id$quotes)
  59755.             ->then(
  59756.                 function ($response) {
  59757.                     return $response[0];
  59758.                 }
  59759.             );
  59760.     }
  59761.     /**
  59762.      * Operation updateQuoteAsyncWithHttpInfo
  59763.      * Updates a specific quote
  59764.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  59765.      * @param  string $quote_id Unique identifier for an Quote (required)
  59766.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Quotes $quotes (required)
  59767.      * @throws \InvalidArgumentException
  59768.      * @return \GuzzleHttp\Promise\PromiseInterface */
  59769.     public function updateQuoteAsyncWithHttpInfo($xero_tenant_id$quote_id$quotes)
  59770.     {
  59771.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Quotes';
  59772.         $request $this->updateQuoteRequest($xero_tenant_id$quote_id$quotes);
  59773.         return $this->client
  59774.             ->sendAsync($request$this->createHttpClientOption())
  59775.             ->then(
  59776.                 function ($response) use ($returnType) {
  59777.                     $responseBody $response->getBody();
  59778.                     if ($returnType === '\SplFileObject') {
  59779.                         $content $responseBody//stream goes to serializer
  59780.                     } else {
  59781.                         $content $responseBody->getContents();
  59782.                     }
  59783.                     return [
  59784.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  59785.                         $response->getStatusCode(),
  59786.                         $response->getHeaders()
  59787.                     ];
  59788.                 },
  59789.                 function ($exception) {
  59790.                     $response $exception->getResponse();
  59791.                     $statusCode $response->getStatusCode();
  59792.                     throw new ApiException(
  59793.                         sprintf(
  59794.                             '[%d] Error connecting to the API (%s)',
  59795.                             $statusCode,
  59796.                             $exception->getRequest()->getUri()
  59797.                         ),
  59798.                         $statusCode,
  59799.                         $response->getHeaders(),
  59800.                         $response->getBody()
  59801.                     );
  59802.                 }
  59803.             );
  59804.     }
  59805.     /**
  59806.      * Create request for operation 'updateQuote'
  59807.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  59808.      * @param  string $quote_id Unique identifier for an Quote (required)
  59809.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Quotes $quotes (required)
  59810.      * @throws \InvalidArgumentException
  59811.      * @return \GuzzleHttp\Psr7\Request  */
  59812.     protected function updateQuoteRequest($xero_tenant_id$quote_id$quotes)
  59813.     {
  59814.         // verify the required parameter 'xero_tenant_id' is set
  59815.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  59816.             throw new \InvalidArgumentException(
  59817.                 'Missing the required parameter $xero_tenant_id when calling updateQuote'
  59818.             );
  59819.         }
  59820.         // verify the required parameter 'quote_id' is set
  59821.         if ($quote_id === null || (is_array($quote_id) && count($quote_id) === 0)) {
  59822.             throw new \InvalidArgumentException(
  59823.                 'Missing the required parameter $quote_id when calling updateQuote'
  59824.             );
  59825.         }
  59826.         // verify the required parameter 'quotes' is set
  59827.         if ($quotes === null || (is_array($quotes) && count($quotes) === 0)) {
  59828.             throw new \InvalidArgumentException(
  59829.                 'Missing the required parameter $quotes when calling updateQuote'
  59830.             );
  59831.         }
  59832.         $resourcePath '/Quotes/{QuoteID}';
  59833.         $formParams = [];
  59834.         $queryParams = [];
  59835.         $headerParams = [];
  59836.         $httpBody '';
  59837.         $multipart false;
  59838.         // header params
  59839.         if ($xero_tenant_id !== null) {
  59840.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  59841.         }
  59842.         // path params
  59843.         if ($quote_id !== null) {
  59844.             $resourcePath str_replace(
  59845.                 '{' 'QuoteID' '}',
  59846.                 AccountingObjectSerializer::toPathValue($quote_id),
  59847.                 $resourcePath
  59848.             );
  59849.         }
  59850.         // body params
  59851.         $_tempBody null;
  59852.         if (isset($quotes)) {
  59853.             $_tempBody $quotes;
  59854.         }
  59855.         if ($multipart) {
  59856.             $headers $this->headerSelector->selectHeadersForMultipart(
  59857.                 ['application/json']
  59858.             );
  59859.         } else {
  59860.             $headers $this->headerSelector->selectHeaders(
  59861.                 ['application/json'],
  59862.                 ['application/json']
  59863.             );
  59864.         }
  59865.         // for model (json/xml)
  59866.         if (isset($_tempBody)) {
  59867.             // $_tempBody is the method argument, if present
  59868.             if ($headers['Content-Type'] === 'application/json') {
  59869.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  59870.             } else {
  59871.                 $httpBody $_tempBody;
  59872.             }
  59873.         } elseif (count($formParams) > 0) {
  59874.             if ($multipart) {
  59875.                 $multipartContents = [
  59876.                     [
  59877.                         'Content-type' => 'multipart/form-data',
  59878.                     ]
  59879.                 ];
  59880.                 
  59881.                 // for HTTP post (form)
  59882.                 $httpBody = new MultipartStream($multipartContents);
  59883.             } elseif ($headers['Content-Type'] === 'application/json') {
  59884.                 $httpBody \GuzzleHttp\json_encode($formParams);
  59885.             } else {
  59886.                 // for HTTP post (form)
  59887.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  59888.             }
  59889.         }
  59890.         // this endpoint requires OAuth (access token)
  59891.         if ($this->config->getAccessToken() !== null) {
  59892.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  59893.         }
  59894.         $defaultHeaders = [];
  59895.         if ($this->config->getUserAgent()) {
  59896.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  59897.         }
  59898.         $headers array_merge(
  59899.             $defaultHeaders,
  59900.             $headerParams,
  59901.             $headers
  59902.         );
  59903.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  59904.         return new Request(
  59905.             'POST',
  59906.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  59907.             $headers,
  59908.             $httpBody
  59909.         );
  59910.     }
  59911.     /**
  59912.      * Operation updateQuoteAttachmentByFileName
  59913.      * Updates a specific attachment from a specific quote by filename
  59914.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  59915.      * @param  string $quote_id Unique identifier for an Quote (required)
  59916.      * @param  string $file_name Name of the attachment (required)
  59917.      * @param  string $body Byte array of file in body of request (required)
  59918.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  59919.      * @throws \InvalidArgumentException
  59920.      * @return \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error
  59921.      */
  59922.     public function updateQuoteAttachmentByFileName($xero_tenant_id$quote_id$file_name$body)
  59923.     {
  59924.         list($response) = $this->updateQuoteAttachmentByFileNameWithHttpInfo($xero_tenant_id$quote_id$file_name$body);
  59925.         return $response;
  59926.     }
  59927.     /**
  59928.      * Operation updateQuoteAttachmentByFileNameWithHttpInfo
  59929.      * Updates a specific attachment from a specific quote by filename
  59930.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  59931.      * @param  string $quote_id Unique identifier for an Quote (required)
  59932.      * @param  string $file_name Name of the attachment (required)
  59933.      * @param  string $body Byte array of file in body of request (required)
  59934.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  59935.      * @throws \InvalidArgumentException
  59936.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  59937.      */
  59938.     public function updateQuoteAttachmentByFileNameWithHttpInfo($xero_tenant_id$quote_id$file_name$body)
  59939.     {
  59940.         $request $this->updateQuoteAttachmentByFileNameRequest($xero_tenant_id$quote_id$file_name$body);
  59941.         try {
  59942.             $options $this->createHttpClientOption();
  59943.             try {
  59944.                 $response $this->client->send($request$options);
  59945.             } catch (RequestException $e) {
  59946.                 throw new ApiException(
  59947.                     "[{$e->getCode()}{$e->getMessage()}",
  59948.                     $e->getCode(),
  59949.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  59950.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  59951.                 );
  59952.             }
  59953.             $statusCode $response->getStatusCode();
  59954.             if ($statusCode 200 || $statusCode 299) {
  59955.                 throw new ApiException(
  59956.                     sprintf(
  59957.                         '[%d] Error connecting to the API (%s)',
  59958.                         $statusCode,
  59959.                         $request->getUri()
  59960.                     ),
  59961.                     $statusCode,
  59962.                     $response->getHeaders(),
  59963.                     $response->getBody()
  59964.                 );
  59965.             }
  59966.             $responseBody $response->getBody();
  59967.             switch($statusCode) {
  59968.                 case 200:
  59969.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Attachments' === '\SplFileObject') {
  59970.                         $content $responseBody//stream goes to serializer
  59971.                     } else {
  59972.                         $content $responseBody->getContents();
  59973.                     }
  59974.                     return [
  59975.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Attachments', []),
  59976.                         $response->getStatusCode(),
  59977.                         $response->getHeaders()
  59978.                     ];
  59979.                 case 400:
  59980.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  59981.                         $content $responseBody//stream goes to serializer
  59982.                     } else {
  59983.                         $content $responseBody->getContents();
  59984.                     }
  59985.                     return [
  59986.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  59987.                         $response->getStatusCode(),
  59988.                         $response->getHeaders()
  59989.                     ];
  59990.             }
  59991.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  59992.             $responseBody $response->getBody();
  59993.             if ($returnType === '\SplFileObject') {
  59994.                 $content $responseBody//stream goes to serializer
  59995.             } else {
  59996.                 $content $responseBody->getContents();
  59997.             }
  59998.             return [
  59999.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  60000.                 $response->getStatusCode(),
  60001.                 $response->getHeaders()
  60002.             ];
  60003.         } catch (ApiException $e) {
  60004.             switch ($e->getCode()) {
  60005.                 case 200:
  60006.                     $data AccountingObjectSerializer::deserialize(
  60007.                         $e->getResponseBody(),
  60008.                         '\XeroAPI\XeroPHP\Models\Accounting\Attachments',
  60009.                         $e->getResponseHeaders()
  60010.                     );
  60011.                     $e->setResponseObject($data);
  60012.                     break;
  60013.                 case 400:
  60014.                     $data AccountingObjectSerializer::deserialize(
  60015.                         $e->getResponseBody(),
  60016.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  60017.                         $e->getResponseHeaders()
  60018.                     );
  60019.                     $e->setResponseObject($data);
  60020.                     break;
  60021.             }
  60022.             throw $e;
  60023.         }
  60024.     }
  60025.     /**
  60026.      * Operation updateQuoteAttachmentByFileNameAsync
  60027.      * Updates a specific attachment from a specific quote by filename
  60028.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  60029.      * @param  string $quote_id Unique identifier for an Quote (required)
  60030.      * @param  string $file_name Name of the attachment (required)
  60031.      * @param  string $body Byte array of file in body of request (required)
  60032.      * @throws \InvalidArgumentException
  60033.      * @return \GuzzleHttp\Promise\PromiseInterface
  60034.      */
  60035.     public function updateQuoteAttachmentByFileNameAsync($xero_tenant_id$quote_id$file_name$body)
  60036.     {
  60037.         return $this->updateQuoteAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$quote_id$file_name$body)
  60038.             ->then(
  60039.                 function ($response) {
  60040.                     return $response[0];
  60041.                 }
  60042.             );
  60043.     }
  60044.     /**
  60045.      * Operation updateQuoteAttachmentByFileNameAsyncWithHttpInfo
  60046.      * Updates a specific attachment from a specific quote by filename
  60047.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  60048.      * @param  string $quote_id Unique identifier for an Quote (required)
  60049.      * @param  string $file_name Name of the attachment (required)
  60050.      * @param  string $body Byte array of file in body of request (required)
  60051.      * @throws \InvalidArgumentException
  60052.      * @return \GuzzleHttp\Promise\PromiseInterface */
  60053.     public function updateQuoteAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$quote_id$file_name$body)
  60054.     {
  60055.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  60056.         $request $this->updateQuoteAttachmentByFileNameRequest($xero_tenant_id$quote_id$file_name$body);
  60057.         return $this->client
  60058.             ->sendAsync($request$this->createHttpClientOption())
  60059.             ->then(
  60060.                 function ($response) use ($returnType) {
  60061.                     $responseBody $response->getBody();
  60062.                     if ($returnType === '\SplFileObject') {
  60063.                         $content $responseBody//stream goes to serializer
  60064.                     } else {
  60065.                         $content $responseBody->getContents();
  60066.                     }
  60067.                     return [
  60068.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  60069.                         $response->getStatusCode(),
  60070.                         $response->getHeaders()
  60071.                     ];
  60072.                 },
  60073.                 function ($exception) {
  60074.                     $response $exception->getResponse();
  60075.                     $statusCode $response->getStatusCode();
  60076.                     throw new ApiException(
  60077.                         sprintf(
  60078.                             '[%d] Error connecting to the API (%s)',
  60079.                             $statusCode,
  60080.                             $exception->getRequest()->getUri()
  60081.                         ),
  60082.                         $statusCode,
  60083.                         $response->getHeaders(),
  60084.                         $response->getBody()
  60085.                     );
  60086.                 }
  60087.             );
  60088.     }
  60089.     /**
  60090.      * Create request for operation 'updateQuoteAttachmentByFileName'
  60091.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  60092.      * @param  string $quote_id Unique identifier for an Quote (required)
  60093.      * @param  string $file_name Name of the attachment (required)
  60094.      * @param  string $body Byte array of file in body of request (required)
  60095.      * @throws \InvalidArgumentException
  60096.      * @return \GuzzleHttp\Psr7\Request  */
  60097.     protected function updateQuoteAttachmentByFileNameRequest($xero_tenant_id$quote_id$file_name$body)
  60098.     {
  60099.         // verify the required parameter 'xero_tenant_id' is set
  60100.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  60101.             throw new \InvalidArgumentException(
  60102.                 'Missing the required parameter $xero_tenant_id when calling updateQuoteAttachmentByFileName'
  60103.             );
  60104.         }
  60105.         // verify the required parameter 'quote_id' is set
  60106.         if ($quote_id === null || (is_array($quote_id) && count($quote_id) === 0)) {
  60107.             throw new \InvalidArgumentException(
  60108.                 'Missing the required parameter $quote_id when calling updateQuoteAttachmentByFileName'
  60109.             );
  60110.         }
  60111.         // verify the required parameter 'file_name' is set
  60112.         if ($file_name === null || (is_array($file_name) && count($file_name) === 0)) {
  60113.             throw new \InvalidArgumentException(
  60114.                 'Missing the required parameter $file_name when calling updateQuoteAttachmentByFileName'
  60115.             );
  60116.         }
  60117.         // verify the required parameter 'body' is set
  60118.         if ($body === null || (is_array($body) && count($body) === 0)) {
  60119.             throw new \InvalidArgumentException(
  60120.                 'Missing the required parameter $body when calling updateQuoteAttachmentByFileName'
  60121.             );
  60122.         }
  60123.         $resourcePath '/Quotes/{QuoteID}/Attachments/{FileName}';
  60124.         $formParams = [];
  60125.         $queryParams = [];
  60126.         $headerParams = [];
  60127.         $httpBody '';
  60128.         $multipart false;
  60129.         // header params
  60130.         if ($xero_tenant_id !== null) {
  60131.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  60132.         }
  60133.         // path params
  60134.         if ($quote_id !== null) {
  60135.             $resourcePath str_replace(
  60136.                 '{' 'QuoteID' '}',
  60137.                 AccountingObjectSerializer::toPathValue($quote_id),
  60138.                 $resourcePath
  60139.             );
  60140.         }
  60141.         // path params
  60142.         if ($file_name !== null) {
  60143.             $resourcePath str_replace(
  60144.                 '{' 'FileName' '}',
  60145.                 AccountingObjectSerializer::toPathValue($file_name),
  60146.                 $resourcePath
  60147.             );
  60148.         }
  60149.         // body params
  60150.         $_tempBody null;
  60151.         if (isset($body)) {
  60152.             $_tempBody $body;
  60153.         }
  60154.         if ($multipart) {
  60155.             $headers $this->headerSelector->selectHeadersForMultipart(
  60156.                 ['application/json']
  60157.             );
  60158.         } else {
  60159.             $headers $this->headerSelector->selectHeaders(
  60160.                 ['application/json'],
  60161.                 ['application/octet-stream']
  60162.             );
  60163.         }
  60164.         // for model (json/xml)
  60165.         if (isset($_tempBody)) {
  60166.             // $_tempBody is the method argument, if present
  60167.             if ($headers['Content-Type'] === 'application/json') {
  60168.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  60169.             } else {
  60170.                 $httpBody $_tempBody;
  60171.             }
  60172.         } elseif (count($formParams) > 0) {
  60173.             if ($multipart) {
  60174.                 $multipartContents = [
  60175.                     [
  60176.                         'Content-type' => 'multipart/form-data',
  60177.                     ]
  60178.                 ];
  60179.                 
  60180.                 // for HTTP post (form)
  60181.                 $httpBody = new MultipartStream($multipartContents);
  60182.             } elseif ($headers['Content-Type'] === 'application/json') {
  60183.                 $httpBody \GuzzleHttp\json_encode($formParams);
  60184.             } else {
  60185.                 // for HTTP post (form)
  60186.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  60187.             }
  60188.         }
  60189.         // this endpoint requires OAuth (access token)
  60190.         if ($this->config->getAccessToken() !== null) {
  60191.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  60192.         }
  60193.         $defaultHeaders = [];
  60194.         if ($this->config->getUserAgent()) {
  60195.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  60196.         }
  60197.         $headers array_merge(
  60198.             $defaultHeaders,
  60199.             $headerParams,
  60200.             $headers
  60201.         );
  60202.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  60203.         return new Request(
  60204.             'POST',
  60205.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  60206.             $headers,
  60207.             $httpBody
  60208.         );
  60209.     }
  60210.     /**
  60211.      * Operation updateReceipt
  60212.      * Updates a specific draft expense claim receipts
  60213.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  60214.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  60215.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Receipts $receipts receipts (required)
  60216.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  60217.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  60218.      * @throws \InvalidArgumentException
  60219.      * @return \XeroAPI\XeroPHP\Models\Accounting\Receipts|\XeroAPI\XeroPHP\Models\Accounting\Error
  60220.      */
  60221.     public function updateReceipt($xero_tenant_id$receipt_id$receipts$unitdp null)
  60222.     {
  60223.         list($response) = $this->updateReceiptWithHttpInfo($xero_tenant_id$receipt_id$receipts$unitdp);
  60224.         return $response;
  60225.     }
  60226.     /**
  60227.      * Operation updateReceiptWithHttpInfo
  60228.      * Updates a specific draft expense claim receipts
  60229.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  60230.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  60231.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Receipts $receipts (required)
  60232.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  60233.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  60234.      * @throws \InvalidArgumentException
  60235.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Receipts|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  60236.      */
  60237.     public function updateReceiptWithHttpInfo($xero_tenant_id$receipt_id$receipts$unitdp null)
  60238.     {
  60239.         $request $this->updateReceiptRequest($xero_tenant_id$receipt_id$receipts$unitdp);
  60240.         try {
  60241.             $options $this->createHttpClientOption();
  60242.             try {
  60243.                 $response $this->client->send($request$options);
  60244.             } catch (RequestException $e) {
  60245.                 throw new ApiException(
  60246.                     "[{$e->getCode()}{$e->getMessage()}",
  60247.                     $e->getCode(),
  60248.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  60249.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  60250.                 );
  60251.             }
  60252.             $statusCode $response->getStatusCode();
  60253.             if ($statusCode 200 || $statusCode 299) {
  60254.                 throw new ApiException(
  60255.                     sprintf(
  60256.                         '[%d] Error connecting to the API (%s)',
  60257.                         $statusCode,
  60258.                         $request->getUri()
  60259.                     ),
  60260.                     $statusCode,
  60261.                     $response->getHeaders(),
  60262.                     $response->getBody()
  60263.                 );
  60264.             }
  60265.             $responseBody $response->getBody();
  60266.             switch($statusCode) {
  60267.                 case 200:
  60268.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Receipts' === '\SplFileObject') {
  60269.                         $content $responseBody//stream goes to serializer
  60270.                     } else {
  60271.                         $content $responseBody->getContents();
  60272.                     }
  60273.                     return [
  60274.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Receipts', []),
  60275.                         $response->getStatusCode(),
  60276.                         $response->getHeaders()
  60277.                     ];
  60278.                 case 400:
  60279.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  60280.                         $content $responseBody//stream goes to serializer
  60281.                     } else {
  60282.                         $content $responseBody->getContents();
  60283.                     }
  60284.                     return [
  60285.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  60286.                         $response->getStatusCode(),
  60287.                         $response->getHeaders()
  60288.                     ];
  60289.             }
  60290.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Receipts';
  60291.             $responseBody $response->getBody();
  60292.             if ($returnType === '\SplFileObject') {
  60293.                 $content $responseBody//stream goes to serializer
  60294.             } else {
  60295.                 $content $responseBody->getContents();
  60296.             }
  60297.             return [
  60298.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  60299.                 $response->getStatusCode(),
  60300.                 $response->getHeaders()
  60301.             ];
  60302.         } catch (ApiException $e) {
  60303.             switch ($e->getCode()) {
  60304.                 case 200:
  60305.                     $data AccountingObjectSerializer::deserialize(
  60306.                         $e->getResponseBody(),
  60307.                         '\XeroAPI\XeroPHP\Models\Accounting\Receipts',
  60308.                         $e->getResponseHeaders()
  60309.                     );
  60310.                     $e->setResponseObject($data);
  60311.                     break;
  60312.                 case 400:
  60313.                     $data AccountingObjectSerializer::deserialize(
  60314.                         $e->getResponseBody(),
  60315.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  60316.                         $e->getResponseHeaders()
  60317.                     );
  60318.                     $e->setResponseObject($data);
  60319.                     break;
  60320.             }
  60321.             throw $e;
  60322.         }
  60323.     }
  60324.     /**
  60325.      * Operation updateReceiptAsync
  60326.      * Updates a specific draft expense claim receipts
  60327.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  60328.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  60329.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Receipts $receipts (required)
  60330.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  60331.      * @throws \InvalidArgumentException
  60332.      * @return \GuzzleHttp\Promise\PromiseInterface
  60333.      */
  60334.     public function updateReceiptAsync($xero_tenant_id$receipt_id$receipts$unitdp null)
  60335.     {
  60336.         return $this->updateReceiptAsyncWithHttpInfo($xero_tenant_id$receipt_id$receipts$unitdp)
  60337.             ->then(
  60338.                 function ($response) {
  60339.                     return $response[0];
  60340.                 }
  60341.             );
  60342.     }
  60343.     /**
  60344.      * Operation updateReceiptAsyncWithHttpInfo
  60345.      * Updates a specific draft expense claim receipts
  60346.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  60347.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  60348.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Receipts $receipts (required)
  60349.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  60350.      * @throws \InvalidArgumentException
  60351.      * @return \GuzzleHttp\Promise\PromiseInterface */
  60352.     public function updateReceiptAsyncWithHttpInfo($xero_tenant_id$receipt_id$receipts$unitdp null)
  60353.     {
  60354.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Receipts';
  60355.         $request $this->updateReceiptRequest($xero_tenant_id$receipt_id$receipts$unitdp);
  60356.         return $this->client
  60357.             ->sendAsync($request$this->createHttpClientOption())
  60358.             ->then(
  60359.                 function ($response) use ($returnType) {
  60360.                     $responseBody $response->getBody();
  60361.                     if ($returnType === '\SplFileObject') {
  60362.                         $content $responseBody//stream goes to serializer
  60363.                     } else {
  60364.                         $content $responseBody->getContents();
  60365.                     }
  60366.                     return [
  60367.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  60368.                         $response->getStatusCode(),
  60369.                         $response->getHeaders()
  60370.                     ];
  60371.                 },
  60372.                 function ($exception) {
  60373.                     $response $exception->getResponse();
  60374.                     $statusCode $response->getStatusCode();
  60375.                     throw new ApiException(
  60376.                         sprintf(
  60377.                             '[%d] Error connecting to the API (%s)',
  60378.                             $statusCode,
  60379.                             $exception->getRequest()->getUri()
  60380.                         ),
  60381.                         $statusCode,
  60382.                         $response->getHeaders(),
  60383.                         $response->getBody()
  60384.                     );
  60385.                 }
  60386.             );
  60387.     }
  60388.     /**
  60389.      * Create request for operation 'updateReceipt'
  60390.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  60391.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  60392.      * @param  \XeroAPI\XeroPHP\Models\Accounting\Receipts $receipts (required)
  60393.      * @param  int $unitdp e.g. unitdp&#x3D;4 â€“ (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)
  60394.      * @throws \InvalidArgumentException
  60395.      * @return \GuzzleHttp\Psr7\Request  */
  60396.     protected function updateReceiptRequest($xero_tenant_id$receipt_id$receipts$unitdp null)
  60397.     {
  60398.         // verify the required parameter 'xero_tenant_id' is set
  60399.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  60400.             throw new \InvalidArgumentException(
  60401.                 'Missing the required parameter $xero_tenant_id when calling updateReceipt'
  60402.             );
  60403.         }
  60404.         // verify the required parameter 'receipt_id' is set
  60405.         if ($receipt_id === null || (is_array($receipt_id) && count($receipt_id) === 0)) {
  60406.             throw new \InvalidArgumentException(
  60407.                 'Missing the required parameter $receipt_id when calling updateReceipt'
  60408.             );
  60409.         }
  60410.         // verify the required parameter 'receipts' is set
  60411.         if ($receipts === null || (is_array($receipts) && count($receipts) === 0)) {
  60412.             throw new \InvalidArgumentException(
  60413.                 'Missing the required parameter $receipts when calling updateReceipt'
  60414.             );
  60415.         }
  60416.         $resourcePath '/Receipts/{ReceiptID}';
  60417.         $formParams = [];
  60418.         $queryParams = [];
  60419.         $headerParams = [];
  60420.         $httpBody '';
  60421.         $multipart false;
  60422.         // query params
  60423.         if ($unitdp !== null) {
  60424.             $queryParams['unitdp'] = AccountingObjectSerializer::toQueryValue($unitdp);
  60425.         }
  60426.         // header params
  60427.         if ($xero_tenant_id !== null) {
  60428.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  60429.         }
  60430.         // path params
  60431.         if ($receipt_id !== null) {
  60432.             $resourcePath str_replace(
  60433.                 '{' 'ReceiptID' '}',
  60434.                 AccountingObjectSerializer::toPathValue($receipt_id),
  60435.                 $resourcePath
  60436.             );
  60437.         }
  60438.         // body params
  60439.         $_tempBody null;
  60440.         if (isset($receipts)) {
  60441.             $_tempBody $receipts;
  60442.         }
  60443.         if ($multipart) {
  60444.             $headers $this->headerSelector->selectHeadersForMultipart(
  60445.                 ['application/json']
  60446.             );
  60447.         } else {
  60448.             $headers $this->headerSelector->selectHeaders(
  60449.                 ['application/json'],
  60450.                 ['application/json']
  60451.             );
  60452.         }
  60453.         // for model (json/xml)
  60454.         if (isset($_tempBody)) {
  60455.             // $_tempBody is the method argument, if present
  60456.             if ($headers['Content-Type'] === 'application/json') {
  60457.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  60458.             } else {
  60459.                 $httpBody $_tempBody;
  60460.             }
  60461.         } elseif (count($formParams) > 0) {
  60462.             if ($multipart) {
  60463.                 $multipartContents = [
  60464.                     [
  60465.                         'Content-type' => 'multipart/form-data',
  60466.                     ]
  60467.                 ];
  60468.                 
  60469.                 // for HTTP post (form)
  60470.                 $httpBody = new MultipartStream($multipartContents);
  60471.             } elseif ($headers['Content-Type'] === 'application/json') {
  60472.                 $httpBody \GuzzleHttp\json_encode($formParams);
  60473.             } else {
  60474.                 // for HTTP post (form)
  60475.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  60476.             }
  60477.         }
  60478.         // this endpoint requires OAuth (access token)
  60479.         if ($this->config->getAccessToken() !== null) {
  60480.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  60481.         }
  60482.         $defaultHeaders = [];
  60483.         if ($this->config->getUserAgent()) {
  60484.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  60485.         }
  60486.         $headers array_merge(
  60487.             $defaultHeaders,
  60488.             $headerParams,
  60489.             $headers
  60490.         );
  60491.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  60492.         return new Request(
  60493.             'POST',
  60494.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  60495.             $headers,
  60496.             $httpBody
  60497.         );
  60498.     }
  60499.     /**
  60500.      * Operation updateReceiptAttachmentByFileName
  60501.      * Updates a specific attachment on a specific expense claim receipts by file name
  60502.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  60503.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  60504.      * @param  string $file_name Name of the attachment (required)
  60505.      * @param  string $body Byte array of file in body of request (required)
  60506.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  60507.      * @throws \InvalidArgumentException
  60508.      * @return \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error
  60509.      */
  60510.     public function updateReceiptAttachmentByFileName($xero_tenant_id$receipt_id$file_name$body)
  60511.     {
  60512.         list($response) = $this->updateReceiptAttachmentByFileNameWithHttpInfo($xero_tenant_id$receipt_id$file_name$body);
  60513.         return $response;
  60514.     }
  60515.     /**
  60516.      * Operation updateReceiptAttachmentByFileNameWithHttpInfo
  60517.      * Updates a specific attachment on a specific expense claim receipts by file name
  60518.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  60519.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  60520.      * @param  string $file_name Name of the attachment (required)
  60521.      * @param  string $body Byte array of file in body of request (required)
  60522.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  60523.      * @throws \InvalidArgumentException
  60524.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  60525.      */
  60526.     public function updateReceiptAttachmentByFileNameWithHttpInfo($xero_tenant_id$receipt_id$file_name$body)
  60527.     {
  60528.         $request $this->updateReceiptAttachmentByFileNameRequest($xero_tenant_id$receipt_id$file_name$body);
  60529.         try {
  60530.             $options $this->createHttpClientOption();
  60531.             try {
  60532.                 $response $this->client->send($request$options);
  60533.             } catch (RequestException $e) {
  60534.                 throw new ApiException(
  60535.                     "[{$e->getCode()}{$e->getMessage()}",
  60536.                     $e->getCode(),
  60537.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  60538.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  60539.                 );
  60540.             }
  60541.             $statusCode $response->getStatusCode();
  60542.             if ($statusCode 200 || $statusCode 299) {
  60543.                 throw new ApiException(
  60544.                     sprintf(
  60545.                         '[%d] Error connecting to the API (%s)',
  60546.                         $statusCode,
  60547.                         $request->getUri()
  60548.                     ),
  60549.                     $statusCode,
  60550.                     $response->getHeaders(),
  60551.                     $response->getBody()
  60552.                 );
  60553.             }
  60554.             $responseBody $response->getBody();
  60555.             switch($statusCode) {
  60556.                 case 200:
  60557.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Attachments' === '\SplFileObject') {
  60558.                         $content $responseBody//stream goes to serializer
  60559.                     } else {
  60560.                         $content $responseBody->getContents();
  60561.                     }
  60562.                     return [
  60563.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Attachments', []),
  60564.                         $response->getStatusCode(),
  60565.                         $response->getHeaders()
  60566.                     ];
  60567.                 case 400:
  60568.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  60569.                         $content $responseBody//stream goes to serializer
  60570.                     } else {
  60571.                         $content $responseBody->getContents();
  60572.                     }
  60573.                     return [
  60574.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  60575.                         $response->getStatusCode(),
  60576.                         $response->getHeaders()
  60577.                     ];
  60578.             }
  60579.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  60580.             $responseBody $response->getBody();
  60581.             if ($returnType === '\SplFileObject') {
  60582.                 $content $responseBody//stream goes to serializer
  60583.             } else {
  60584.                 $content $responseBody->getContents();
  60585.             }
  60586.             return [
  60587.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  60588.                 $response->getStatusCode(),
  60589.                 $response->getHeaders()
  60590.             ];
  60591.         } catch (ApiException $e) {
  60592.             switch ($e->getCode()) {
  60593.                 case 200:
  60594.                     $data AccountingObjectSerializer::deserialize(
  60595.                         $e->getResponseBody(),
  60596.                         '\XeroAPI\XeroPHP\Models\Accounting\Attachments',
  60597.                         $e->getResponseHeaders()
  60598.                     );
  60599.                     $e->setResponseObject($data);
  60600.                     break;
  60601.                 case 400:
  60602.                     $data AccountingObjectSerializer::deserialize(
  60603.                         $e->getResponseBody(),
  60604.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  60605.                         $e->getResponseHeaders()
  60606.                     );
  60607.                     $e->setResponseObject($data);
  60608.                     break;
  60609.             }
  60610.             throw $e;
  60611.         }
  60612.     }
  60613.     /**
  60614.      * Operation updateReceiptAttachmentByFileNameAsync
  60615.      * Updates a specific attachment on a specific expense claim receipts by file name
  60616.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  60617.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  60618.      * @param  string $file_name Name of the attachment (required)
  60619.      * @param  string $body Byte array of file in body of request (required)
  60620.      * @throws \InvalidArgumentException
  60621.      * @return \GuzzleHttp\Promise\PromiseInterface
  60622.      */
  60623.     public function updateReceiptAttachmentByFileNameAsync($xero_tenant_id$receipt_id$file_name$body)
  60624.     {
  60625.         return $this->updateReceiptAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$receipt_id$file_name$body)
  60626.             ->then(
  60627.                 function ($response) {
  60628.                     return $response[0];
  60629.                 }
  60630.             );
  60631.     }
  60632.     /**
  60633.      * Operation updateReceiptAttachmentByFileNameAsyncWithHttpInfo
  60634.      * Updates a specific attachment on a specific expense claim receipts by file name
  60635.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  60636.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  60637.      * @param  string $file_name Name of the attachment (required)
  60638.      * @param  string $body Byte array of file in body of request (required)
  60639.      * @throws \InvalidArgumentException
  60640.      * @return \GuzzleHttp\Promise\PromiseInterface */
  60641.     public function updateReceiptAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$receipt_id$file_name$body)
  60642.     {
  60643.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  60644.         $request $this->updateReceiptAttachmentByFileNameRequest($xero_tenant_id$receipt_id$file_name$body);
  60645.         return $this->client
  60646.             ->sendAsync($request$this->createHttpClientOption())
  60647.             ->then(
  60648.                 function ($response) use ($returnType) {
  60649.                     $responseBody $response->getBody();
  60650.                     if ($returnType === '\SplFileObject') {
  60651.                         $content $responseBody//stream goes to serializer
  60652.                     } else {
  60653.                         $content $responseBody->getContents();
  60654.                     }
  60655.                     return [
  60656.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  60657.                         $response->getStatusCode(),
  60658.                         $response->getHeaders()
  60659.                     ];
  60660.                 },
  60661.                 function ($exception) {
  60662.                     $response $exception->getResponse();
  60663.                     $statusCode $response->getStatusCode();
  60664.                     throw new ApiException(
  60665.                         sprintf(
  60666.                             '[%d] Error connecting to the API (%s)',
  60667.                             $statusCode,
  60668.                             $exception->getRequest()->getUri()
  60669.                         ),
  60670.                         $statusCode,
  60671.                         $response->getHeaders(),
  60672.                         $response->getBody()
  60673.                     );
  60674.                 }
  60675.             );
  60676.     }
  60677.     /**
  60678.      * Create request for operation 'updateReceiptAttachmentByFileName'
  60679.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  60680.      * @param  string $receipt_id Unique identifier for a Receipt (required)
  60681.      * @param  string $file_name Name of the attachment (required)
  60682.      * @param  string $body Byte array of file in body of request (required)
  60683.      * @throws \InvalidArgumentException
  60684.      * @return \GuzzleHttp\Psr7\Request  */
  60685.     protected function updateReceiptAttachmentByFileNameRequest($xero_tenant_id$receipt_id$file_name$body)
  60686.     {
  60687.         // verify the required parameter 'xero_tenant_id' is set
  60688.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  60689.             throw new \InvalidArgumentException(
  60690.                 'Missing the required parameter $xero_tenant_id when calling updateReceiptAttachmentByFileName'
  60691.             );
  60692.         }
  60693.         // verify the required parameter 'receipt_id' is set
  60694.         if ($receipt_id === null || (is_array($receipt_id) && count($receipt_id) === 0)) {
  60695.             throw new \InvalidArgumentException(
  60696.                 'Missing the required parameter $receipt_id when calling updateReceiptAttachmentByFileName'
  60697.             );
  60698.         }
  60699.         // verify the required parameter 'file_name' is set
  60700.         if ($file_name === null || (is_array($file_name) && count($file_name) === 0)) {
  60701.             throw new \InvalidArgumentException(
  60702.                 'Missing the required parameter $file_name when calling updateReceiptAttachmentByFileName'
  60703.             );
  60704.         }
  60705.         // verify the required parameter 'body' is set
  60706.         if ($body === null || (is_array($body) && count($body) === 0)) {
  60707.             throw new \InvalidArgumentException(
  60708.                 'Missing the required parameter $body when calling updateReceiptAttachmentByFileName'
  60709.             );
  60710.         }
  60711.         $resourcePath '/Receipts/{ReceiptID}/Attachments/{FileName}';
  60712.         $formParams = [];
  60713.         $queryParams = [];
  60714.         $headerParams = [];
  60715.         $httpBody '';
  60716.         $multipart false;
  60717.         // header params
  60718.         if ($xero_tenant_id !== null) {
  60719.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  60720.         }
  60721.         // path params
  60722.         if ($receipt_id !== null) {
  60723.             $resourcePath str_replace(
  60724.                 '{' 'ReceiptID' '}',
  60725.                 AccountingObjectSerializer::toPathValue($receipt_id),
  60726.                 $resourcePath
  60727.             );
  60728.         }
  60729.         // path params
  60730.         if ($file_name !== null) {
  60731.             $resourcePath str_replace(
  60732.                 '{' 'FileName' '}',
  60733.                 AccountingObjectSerializer::toPathValue($file_name),
  60734.                 $resourcePath
  60735.             );
  60736.         }
  60737.         // body params
  60738.         $_tempBody null;
  60739.         if (isset($body)) {
  60740.             $_tempBody $body;
  60741.         }
  60742.         if ($multipart) {
  60743.             $headers $this->headerSelector->selectHeadersForMultipart(
  60744.                 ['application/json']
  60745.             );
  60746.         } else {
  60747.             $headers $this->headerSelector->selectHeaders(
  60748.                 ['application/json'],
  60749.                 ['application/octet-stream']
  60750.             );
  60751.         }
  60752.         // for model (json/xml)
  60753.         if (isset($_tempBody)) {
  60754.             // $_tempBody is the method argument, if present
  60755.             if ($headers['Content-Type'] === 'application/json') {
  60756.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  60757.             } else {
  60758.                 $httpBody $_tempBody;
  60759.             }
  60760.         } elseif (count($formParams) > 0) {
  60761.             if ($multipart) {
  60762.                 $multipartContents = [
  60763.                     [
  60764.                         'Content-type' => 'multipart/form-data',
  60765.                     ]
  60766.                 ];
  60767.                 
  60768.                 // for HTTP post (form)
  60769.                 $httpBody = new MultipartStream($multipartContents);
  60770.             } elseif ($headers['Content-Type'] === 'application/json') {
  60771.                 $httpBody \GuzzleHttp\json_encode($formParams);
  60772.             } else {
  60773.                 // for HTTP post (form)
  60774.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  60775.             }
  60776.         }
  60777.         // this endpoint requires OAuth (access token)
  60778.         if ($this->config->getAccessToken() !== null) {
  60779.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  60780.         }
  60781.         $defaultHeaders = [];
  60782.         if ($this->config->getUserAgent()) {
  60783.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  60784.         }
  60785.         $headers array_merge(
  60786.             $defaultHeaders,
  60787.             $headerParams,
  60788.             $headers
  60789.         );
  60790.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  60791.         return new Request(
  60792.             'POST',
  60793.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  60794.             $headers,
  60795.             $httpBody
  60796.         );
  60797.     }
  60798.     /**
  60799.      * Operation updateRepeatingInvoice
  60800.      * Deletes a specific repeating invoice template
  60801.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  60802.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  60803.      * @param  \XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices $repeating_invoices repeating_invoices (required)
  60804.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  60805.      * @throws \InvalidArgumentException
  60806.      * @return \XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices|\XeroAPI\XeroPHP\Models\Accounting\Error
  60807.      */
  60808.     public function updateRepeatingInvoice($xero_tenant_id$repeating_invoice_id$repeating_invoices)
  60809.     {
  60810.         list($response) = $this->updateRepeatingInvoiceWithHttpInfo($xero_tenant_id$repeating_invoice_id$repeating_invoices);
  60811.         return $response;
  60812.     }
  60813.     /**
  60814.      * Operation updateRepeatingInvoiceWithHttpInfo
  60815.      * Deletes a specific repeating invoice template
  60816.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  60817.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  60818.      * @param  \XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices $repeating_invoices (required)
  60819.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  60820.      * @throws \InvalidArgumentException
  60821.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  60822.      */
  60823.     public function updateRepeatingInvoiceWithHttpInfo($xero_tenant_id$repeating_invoice_id$repeating_invoices)
  60824.     {
  60825.         $request $this->updateRepeatingInvoiceRequest($xero_tenant_id$repeating_invoice_id$repeating_invoices);
  60826.         try {
  60827.             $options $this->createHttpClientOption();
  60828.             try {
  60829.                 $response $this->client->send($request$options);
  60830.             } catch (RequestException $e) {
  60831.                 throw new ApiException(
  60832.                     "[{$e->getCode()}{$e->getMessage()}",
  60833.                     $e->getCode(),
  60834.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  60835.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  60836.                 );
  60837.             }
  60838.             $statusCode $response->getStatusCode();
  60839.             if ($statusCode 200 || $statusCode 299) {
  60840.                 throw new ApiException(
  60841.                     sprintf(
  60842.                         '[%d] Error connecting to the API (%s)',
  60843.                         $statusCode,
  60844.                         $request->getUri()
  60845.                     ),
  60846.                     $statusCode,
  60847.                     $response->getHeaders(),
  60848.                     $response->getBody()
  60849.                 );
  60850.             }
  60851.             $responseBody $response->getBody();
  60852.             switch($statusCode) {
  60853.                 case 200:
  60854.                     if ('\XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices' === '\SplFileObject') {
  60855.                         $content $responseBody//stream goes to serializer
  60856.                     } else {
  60857.                         $content $responseBody->getContents();
  60858.                     }
  60859.                     return [
  60860.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices', []),
  60861.                         $response->getStatusCode(),
  60862.                         $response->getHeaders()
  60863.                     ];
  60864.                 case 400:
  60865.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  60866.                         $content $responseBody//stream goes to serializer
  60867.                     } else {
  60868.                         $content $responseBody->getContents();
  60869.                     }
  60870.                     return [
  60871.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  60872.                         $response->getStatusCode(),
  60873.                         $response->getHeaders()
  60874.                     ];
  60875.             }
  60876.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices';
  60877.             $responseBody $response->getBody();
  60878.             if ($returnType === '\SplFileObject') {
  60879.                 $content $responseBody//stream goes to serializer
  60880.             } else {
  60881.                 $content $responseBody->getContents();
  60882.             }
  60883.             return [
  60884.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  60885.                 $response->getStatusCode(),
  60886.                 $response->getHeaders()
  60887.             ];
  60888.         } catch (ApiException $e) {
  60889.             switch ($e->getCode()) {
  60890.                 case 200:
  60891.                     $data AccountingObjectSerializer::deserialize(
  60892.                         $e->getResponseBody(),
  60893.                         '\XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices',
  60894.                         $e->getResponseHeaders()
  60895.                     );
  60896.                     $e->setResponseObject($data);
  60897.                     break;
  60898.                 case 400:
  60899.                     $data AccountingObjectSerializer::deserialize(
  60900.                         $e->getResponseBody(),
  60901.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  60902.                         $e->getResponseHeaders()
  60903.                     );
  60904.                     $e->setResponseObject($data);
  60905.                     break;
  60906.             }
  60907.             throw $e;
  60908.         }
  60909.     }
  60910.     /**
  60911.      * Operation updateRepeatingInvoiceAsync
  60912.      * Deletes a specific repeating invoice template
  60913.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  60914.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  60915.      * @param  \XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices $repeating_invoices (required)
  60916.      * @throws \InvalidArgumentException
  60917.      * @return \GuzzleHttp\Promise\PromiseInterface
  60918.      */
  60919.     public function updateRepeatingInvoiceAsync($xero_tenant_id$repeating_invoice_id$repeating_invoices)
  60920.     {
  60921.         return $this->updateRepeatingInvoiceAsyncWithHttpInfo($xero_tenant_id$repeating_invoice_id$repeating_invoices)
  60922.             ->then(
  60923.                 function ($response) {
  60924.                     return $response[0];
  60925.                 }
  60926.             );
  60927.     }
  60928.     /**
  60929.      * Operation updateRepeatingInvoiceAsyncWithHttpInfo
  60930.      * Deletes a specific repeating invoice template
  60931.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  60932.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  60933.      * @param  \XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices $repeating_invoices (required)
  60934.      * @throws \InvalidArgumentException
  60935.      * @return \GuzzleHttp\Promise\PromiseInterface */
  60936.     public function updateRepeatingInvoiceAsyncWithHttpInfo($xero_tenant_id$repeating_invoice_id$repeating_invoices)
  60937.     {
  60938.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices';
  60939.         $request $this->updateRepeatingInvoiceRequest($xero_tenant_id$repeating_invoice_id$repeating_invoices);
  60940.         return $this->client
  60941.             ->sendAsync($request$this->createHttpClientOption())
  60942.             ->then(
  60943.                 function ($response) use ($returnType) {
  60944.                     $responseBody $response->getBody();
  60945.                     if ($returnType === '\SplFileObject') {
  60946.                         $content $responseBody//stream goes to serializer
  60947.                     } else {
  60948.                         $content $responseBody->getContents();
  60949.                     }
  60950.                     return [
  60951.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  60952.                         $response->getStatusCode(),
  60953.                         $response->getHeaders()
  60954.                     ];
  60955.                 },
  60956.                 function ($exception) {
  60957.                     $response $exception->getResponse();
  60958.                     $statusCode $response->getStatusCode();
  60959.                     throw new ApiException(
  60960.                         sprintf(
  60961.                             '[%d] Error connecting to the API (%s)',
  60962.                             $statusCode,
  60963.                             $exception->getRequest()->getUri()
  60964.                         ),
  60965.                         $statusCode,
  60966.                         $response->getHeaders(),
  60967.                         $response->getBody()
  60968.                     );
  60969.                 }
  60970.             );
  60971.     }
  60972.     /**
  60973.      * Create request for operation 'updateRepeatingInvoice'
  60974.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  60975.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  60976.      * @param  \XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoices $repeating_invoices (required)
  60977.      * @throws \InvalidArgumentException
  60978.      * @return \GuzzleHttp\Psr7\Request  */
  60979.     protected function updateRepeatingInvoiceRequest($xero_tenant_id$repeating_invoice_id$repeating_invoices)
  60980.     {
  60981.         // verify the required parameter 'xero_tenant_id' is set
  60982.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  60983.             throw new \InvalidArgumentException(
  60984.                 'Missing the required parameter $xero_tenant_id when calling updateRepeatingInvoice'
  60985.             );
  60986.         }
  60987.         // verify the required parameter 'repeating_invoice_id' is set
  60988.         if ($repeating_invoice_id === null || (is_array($repeating_invoice_id) && count($repeating_invoice_id) === 0)) {
  60989.             throw new \InvalidArgumentException(
  60990.                 'Missing the required parameter $repeating_invoice_id when calling updateRepeatingInvoice'
  60991.             );
  60992.         }
  60993.         // verify the required parameter 'repeating_invoices' is set
  60994.         if ($repeating_invoices === null || (is_array($repeating_invoices) && count($repeating_invoices) === 0)) {
  60995.             throw new \InvalidArgumentException(
  60996.                 'Missing the required parameter $repeating_invoices when calling updateRepeatingInvoice'
  60997.             );
  60998.         }
  60999.         $resourcePath '/RepeatingInvoices/{RepeatingInvoiceID}';
  61000.         $formParams = [];
  61001.         $queryParams = [];
  61002.         $headerParams = [];
  61003.         $httpBody '';
  61004.         $multipart false;
  61005.         // header params
  61006.         if ($xero_tenant_id !== null) {
  61007.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  61008.         }
  61009.         // path params
  61010.         if ($repeating_invoice_id !== null) {
  61011.             $resourcePath str_replace(
  61012.                 '{' 'RepeatingInvoiceID' '}',
  61013.                 AccountingObjectSerializer::toPathValue($repeating_invoice_id),
  61014.                 $resourcePath
  61015.             );
  61016.         }
  61017.         // body params
  61018.         $_tempBody null;
  61019.         if (isset($repeating_invoices)) {
  61020.             $_tempBody $repeating_invoices;
  61021.         }
  61022.         if ($multipart) {
  61023.             $headers $this->headerSelector->selectHeadersForMultipart(
  61024.                 ['application/json']
  61025.             );
  61026.         } else {
  61027.             $headers $this->headerSelector->selectHeaders(
  61028.                 ['application/json'],
  61029.                 ['application/json']
  61030.             );
  61031.         }
  61032.         // for model (json/xml)
  61033.         if (isset($_tempBody)) {
  61034.             // $_tempBody is the method argument, if present
  61035.             if ($headers['Content-Type'] === 'application/json') {
  61036.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  61037.             } else {
  61038.                 $httpBody $_tempBody;
  61039.             }
  61040.         } elseif (count($formParams) > 0) {
  61041.             if ($multipart) {
  61042.                 $multipartContents = [
  61043.                     [
  61044.                         'Content-type' => 'multipart/form-data',
  61045.                     ]
  61046.                 ];
  61047.                 
  61048.                 // for HTTP post (form)
  61049.                 $httpBody = new MultipartStream($multipartContents);
  61050.             } elseif ($headers['Content-Type'] === 'application/json') {
  61051.                 $httpBody \GuzzleHttp\json_encode($formParams);
  61052.             } else {
  61053.                 // for HTTP post (form)
  61054.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  61055.             }
  61056.         }
  61057.         // this endpoint requires OAuth (access token)
  61058.         if ($this->config->getAccessToken() !== null) {
  61059.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  61060.         }
  61061.         $defaultHeaders = [];
  61062.         if ($this->config->getUserAgent()) {
  61063.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  61064.         }
  61065.         $headers array_merge(
  61066.             $defaultHeaders,
  61067.             $headerParams,
  61068.             $headers
  61069.         );
  61070.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  61071.         return new Request(
  61072.             'POST',
  61073.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  61074.             $headers,
  61075.             $httpBody
  61076.         );
  61077.     }
  61078.     /**
  61079.      * Operation updateRepeatingInvoiceAttachmentByFileName
  61080.      * Updates a specific attachment from a specific repeating invoices by file name
  61081.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  61082.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  61083.      * @param  string $file_name Name of the attachment (required)
  61084.      * @param  string $body Byte array of file in body of request (required)
  61085.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  61086.      * @throws \InvalidArgumentException
  61087.      * @return \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error
  61088.      */
  61089.     public function updateRepeatingInvoiceAttachmentByFileName($xero_tenant_id$repeating_invoice_id$file_name$body)
  61090.     {
  61091.         list($response) = $this->updateRepeatingInvoiceAttachmentByFileNameWithHttpInfo($xero_tenant_id$repeating_invoice_id$file_name$body);
  61092.         return $response;
  61093.     }
  61094.     /**
  61095.      * Operation updateRepeatingInvoiceAttachmentByFileNameWithHttpInfo
  61096.      * Updates a specific attachment from a specific repeating invoices by file name
  61097.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  61098.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  61099.      * @param  string $file_name Name of the attachment (required)
  61100.      * @param  string $body Byte array of file in body of request (required)
  61101.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  61102.      * @throws \InvalidArgumentException
  61103.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\Attachments|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  61104.      */
  61105.     public function updateRepeatingInvoiceAttachmentByFileNameWithHttpInfo($xero_tenant_id$repeating_invoice_id$file_name$body)
  61106.     {
  61107.         $request $this->updateRepeatingInvoiceAttachmentByFileNameRequest($xero_tenant_id$repeating_invoice_id$file_name$body);
  61108.         try {
  61109.             $options $this->createHttpClientOption();
  61110.             try {
  61111.                 $response $this->client->send($request$options);
  61112.             } catch (RequestException $e) {
  61113.                 throw new ApiException(
  61114.                     "[{$e->getCode()}{$e->getMessage()}",
  61115.                     $e->getCode(),
  61116.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  61117.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  61118.                 );
  61119.             }
  61120.             $statusCode $response->getStatusCode();
  61121.             if ($statusCode 200 || $statusCode 299) {
  61122.                 throw new ApiException(
  61123.                     sprintf(
  61124.                         '[%d] Error connecting to the API (%s)',
  61125.                         $statusCode,
  61126.                         $request->getUri()
  61127.                     ),
  61128.                     $statusCode,
  61129.                     $response->getHeaders(),
  61130.                     $response->getBody()
  61131.                 );
  61132.             }
  61133.             $responseBody $response->getBody();
  61134.             switch($statusCode) {
  61135.                 case 200:
  61136.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Attachments' === '\SplFileObject') {
  61137.                         $content $responseBody//stream goes to serializer
  61138.                     } else {
  61139.                         $content $responseBody->getContents();
  61140.                     }
  61141.                     return [
  61142.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Attachments', []),
  61143.                         $response->getStatusCode(),
  61144.                         $response->getHeaders()
  61145.                     ];
  61146.                 case 400:
  61147.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  61148.                         $content $responseBody//stream goes to serializer
  61149.                     } else {
  61150.                         $content $responseBody->getContents();
  61151.                     }
  61152.                     return [
  61153.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  61154.                         $response->getStatusCode(),
  61155.                         $response->getHeaders()
  61156.                     ];
  61157.             }
  61158.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  61159.             $responseBody $response->getBody();
  61160.             if ($returnType === '\SplFileObject') {
  61161.                 $content $responseBody//stream goes to serializer
  61162.             } else {
  61163.                 $content $responseBody->getContents();
  61164.             }
  61165.             return [
  61166.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  61167.                 $response->getStatusCode(),
  61168.                 $response->getHeaders()
  61169.             ];
  61170.         } catch (ApiException $e) {
  61171.             switch ($e->getCode()) {
  61172.                 case 200:
  61173.                     $data AccountingObjectSerializer::deserialize(
  61174.                         $e->getResponseBody(),
  61175.                         '\XeroAPI\XeroPHP\Models\Accounting\Attachments',
  61176.                         $e->getResponseHeaders()
  61177.                     );
  61178.                     $e->setResponseObject($data);
  61179.                     break;
  61180.                 case 400:
  61181.                     $data AccountingObjectSerializer::deserialize(
  61182.                         $e->getResponseBody(),
  61183.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  61184.                         $e->getResponseHeaders()
  61185.                     );
  61186.                     $e->setResponseObject($data);
  61187.                     break;
  61188.             }
  61189.             throw $e;
  61190.         }
  61191.     }
  61192.     /**
  61193.      * Operation updateRepeatingInvoiceAttachmentByFileNameAsync
  61194.      * Updates a specific attachment from a specific repeating invoices by file name
  61195.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  61196.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  61197.      * @param  string $file_name Name of the attachment (required)
  61198.      * @param  string $body Byte array of file in body of request (required)
  61199.      * @throws \InvalidArgumentException
  61200.      * @return \GuzzleHttp\Promise\PromiseInterface
  61201.      */
  61202.     public function updateRepeatingInvoiceAttachmentByFileNameAsync($xero_tenant_id$repeating_invoice_id$file_name$body)
  61203.     {
  61204.         return $this->updateRepeatingInvoiceAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$repeating_invoice_id$file_name$body)
  61205.             ->then(
  61206.                 function ($response) {
  61207.                     return $response[0];
  61208.                 }
  61209.             );
  61210.     }
  61211.     /**
  61212.      * Operation updateRepeatingInvoiceAttachmentByFileNameAsyncWithHttpInfo
  61213.      * Updates a specific attachment from a specific repeating invoices by file name
  61214.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  61215.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  61216.      * @param  string $file_name Name of the attachment (required)
  61217.      * @param  string $body Byte array of file in body of request (required)
  61218.      * @throws \InvalidArgumentException
  61219.      * @return \GuzzleHttp\Promise\PromiseInterface */
  61220.     public function updateRepeatingInvoiceAttachmentByFileNameAsyncWithHttpInfo($xero_tenant_id$repeating_invoice_id$file_name$body)
  61221.     {
  61222.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\Attachments';
  61223.         $request $this->updateRepeatingInvoiceAttachmentByFileNameRequest($xero_tenant_id$repeating_invoice_id$file_name$body);
  61224.         return $this->client
  61225.             ->sendAsync($request$this->createHttpClientOption())
  61226.             ->then(
  61227.                 function ($response) use ($returnType) {
  61228.                     $responseBody $response->getBody();
  61229.                     if ($returnType === '\SplFileObject') {
  61230.                         $content $responseBody//stream goes to serializer
  61231.                     } else {
  61232.                         $content $responseBody->getContents();
  61233.                     }
  61234.                     return [
  61235.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  61236.                         $response->getStatusCode(),
  61237.                         $response->getHeaders()
  61238.                     ];
  61239.                 },
  61240.                 function ($exception) {
  61241.                     $response $exception->getResponse();
  61242.                     $statusCode $response->getStatusCode();
  61243.                     throw new ApiException(
  61244.                         sprintf(
  61245.                             '[%d] Error connecting to the API (%s)',
  61246.                             $statusCode,
  61247.                             $exception->getRequest()->getUri()
  61248.                         ),
  61249.                         $statusCode,
  61250.                         $response->getHeaders(),
  61251.                         $response->getBody()
  61252.                     );
  61253.                 }
  61254.             );
  61255.     }
  61256.     /**
  61257.      * Create request for operation 'updateRepeatingInvoiceAttachmentByFileName'
  61258.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  61259.      * @param  string $repeating_invoice_id Unique identifier for a Repeating Invoice (required)
  61260.      * @param  string $file_name Name of the attachment (required)
  61261.      * @param  string $body Byte array of file in body of request (required)
  61262.      * @throws \InvalidArgumentException
  61263.      * @return \GuzzleHttp\Psr7\Request  */
  61264.     protected function updateRepeatingInvoiceAttachmentByFileNameRequest($xero_tenant_id$repeating_invoice_id$file_name$body)
  61265.     {
  61266.         // verify the required parameter 'xero_tenant_id' is set
  61267.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  61268.             throw new \InvalidArgumentException(
  61269.                 'Missing the required parameter $xero_tenant_id when calling updateRepeatingInvoiceAttachmentByFileName'
  61270.             );
  61271.         }
  61272.         // verify the required parameter 'repeating_invoice_id' is set
  61273.         if ($repeating_invoice_id === null || (is_array($repeating_invoice_id) && count($repeating_invoice_id) === 0)) {
  61274.             throw new \InvalidArgumentException(
  61275.                 'Missing the required parameter $repeating_invoice_id when calling updateRepeatingInvoiceAttachmentByFileName'
  61276.             );
  61277.         }
  61278.         // verify the required parameter 'file_name' is set
  61279.         if ($file_name === null || (is_array($file_name) && count($file_name) === 0)) {
  61280.             throw new \InvalidArgumentException(
  61281.                 'Missing the required parameter $file_name when calling updateRepeatingInvoiceAttachmentByFileName'
  61282.             );
  61283.         }
  61284.         // verify the required parameter 'body' is set
  61285.         if ($body === null || (is_array($body) && count($body) === 0)) {
  61286.             throw new \InvalidArgumentException(
  61287.                 'Missing the required parameter $body when calling updateRepeatingInvoiceAttachmentByFileName'
  61288.             );
  61289.         }
  61290.         $resourcePath '/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}';
  61291.         $formParams = [];
  61292.         $queryParams = [];
  61293.         $headerParams = [];
  61294.         $httpBody '';
  61295.         $multipart false;
  61296.         // header params
  61297.         if ($xero_tenant_id !== null) {
  61298.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  61299.         }
  61300.         // path params
  61301.         if ($repeating_invoice_id !== null) {
  61302.             $resourcePath str_replace(
  61303.                 '{' 'RepeatingInvoiceID' '}',
  61304.                 AccountingObjectSerializer::toPathValue($repeating_invoice_id),
  61305.                 $resourcePath
  61306.             );
  61307.         }
  61308.         // path params
  61309.         if ($file_name !== null) {
  61310.             $resourcePath str_replace(
  61311.                 '{' 'FileName' '}',
  61312.                 AccountingObjectSerializer::toPathValue($file_name),
  61313.                 $resourcePath
  61314.             );
  61315.         }
  61316.         // body params
  61317.         $_tempBody null;
  61318.         if (isset($body)) {
  61319.             $_tempBody $body;
  61320.         }
  61321.         if ($multipart) {
  61322.             $headers $this->headerSelector->selectHeadersForMultipart(
  61323.                 ['application/json']
  61324.             );
  61325.         } else {
  61326.             $headers $this->headerSelector->selectHeaders(
  61327.                 ['application/json'],
  61328.                 ['application/octet-stream']
  61329.             );
  61330.         }
  61331.         // for model (json/xml)
  61332.         if (isset($_tempBody)) {
  61333.             // $_tempBody is the method argument, if present
  61334.             if ($headers['Content-Type'] === 'application/json') {
  61335.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  61336.             } else {
  61337.                 $httpBody $_tempBody;
  61338.             }
  61339.         } elseif (count($formParams) > 0) {
  61340.             if ($multipart) {
  61341.                 $multipartContents = [
  61342.                     [
  61343.                         'Content-type' => 'multipart/form-data',
  61344.                     ]
  61345.                 ];
  61346.                 
  61347.                 // for HTTP post (form)
  61348.                 $httpBody = new MultipartStream($multipartContents);
  61349.             } elseif ($headers['Content-Type'] === 'application/json') {
  61350.                 $httpBody \GuzzleHttp\json_encode($formParams);
  61351.             } else {
  61352.                 // for HTTP post (form)
  61353.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  61354.             }
  61355.         }
  61356.         // this endpoint requires OAuth (access token)
  61357.         if ($this->config->getAccessToken() !== null) {
  61358.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  61359.         }
  61360.         $defaultHeaders = [];
  61361.         if ($this->config->getUserAgent()) {
  61362.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  61363.         }
  61364.         $headers array_merge(
  61365.             $defaultHeaders,
  61366.             $headerParams,
  61367.             $headers
  61368.         );
  61369.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  61370.         return new Request(
  61371.             'POST',
  61372.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  61373.             $headers,
  61374.             $httpBody
  61375.         );
  61376.     }
  61377.     /**
  61378.      * Operation updateTaxRate
  61379.      * Updates tax rates
  61380.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  61381.      * @param  \XeroAPI\XeroPHP\Models\Accounting\TaxRates $tax_rates tax_rates (required)
  61382.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  61383.      * @throws \InvalidArgumentException
  61384.      * @return \XeroAPI\XeroPHP\Models\Accounting\TaxRates|\XeroAPI\XeroPHP\Models\Accounting\Error
  61385.      */
  61386.     public function updateTaxRate($xero_tenant_id$tax_rates)
  61387.     {
  61388.         list($response) = $this->updateTaxRateWithHttpInfo($xero_tenant_id$tax_rates);
  61389.         return $response;
  61390.     }
  61391.     /**
  61392.      * Operation updateTaxRateWithHttpInfo
  61393.      * Updates tax rates
  61394.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  61395.      * @param  \XeroAPI\XeroPHP\Models\Accounting\TaxRates $tax_rates (required)
  61396.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  61397.      * @throws \InvalidArgumentException
  61398.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\TaxRates|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  61399.      */
  61400.     public function updateTaxRateWithHttpInfo($xero_tenant_id$tax_rates)
  61401.     {
  61402.         $request $this->updateTaxRateRequest($xero_tenant_id$tax_rates);
  61403.         try {
  61404.             $options $this->createHttpClientOption();
  61405.             try {
  61406.                 $response $this->client->send($request$options);
  61407.             } catch (RequestException $e) {
  61408.                 throw new ApiException(
  61409.                     "[{$e->getCode()}{$e->getMessage()}",
  61410.                     $e->getCode(),
  61411.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  61412.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  61413.                 );
  61414.             }
  61415.             $statusCode $response->getStatusCode();
  61416.             if ($statusCode 200 || $statusCode 299) {
  61417.                 throw new ApiException(
  61418.                     sprintf(
  61419.                         '[%d] Error connecting to the API (%s)',
  61420.                         $statusCode,
  61421.                         $request->getUri()
  61422.                     ),
  61423.                     $statusCode,
  61424.                     $response->getHeaders(),
  61425.                     $response->getBody()
  61426.                 );
  61427.             }
  61428.             $responseBody $response->getBody();
  61429.             switch($statusCode) {
  61430.                 case 200:
  61431.                     if ('\XeroAPI\XeroPHP\Models\Accounting\TaxRates' === '\SplFileObject') {
  61432.                         $content $responseBody//stream goes to serializer
  61433.                     } else {
  61434.                         $content $responseBody->getContents();
  61435.                     }
  61436.                     return [
  61437.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\TaxRates', []),
  61438.                         $response->getStatusCode(),
  61439.                         $response->getHeaders()
  61440.                     ];
  61441.                 case 400:
  61442.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  61443.                         $content $responseBody//stream goes to serializer
  61444.                     } else {
  61445.                         $content $responseBody->getContents();
  61446.                     }
  61447.                     return [
  61448.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  61449.                         $response->getStatusCode(),
  61450.                         $response->getHeaders()
  61451.                     ];
  61452.             }
  61453.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\TaxRates';
  61454.             $responseBody $response->getBody();
  61455.             if ($returnType === '\SplFileObject') {
  61456.                 $content $responseBody//stream goes to serializer
  61457.             } else {
  61458.                 $content $responseBody->getContents();
  61459.             }
  61460.             return [
  61461.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  61462.                 $response->getStatusCode(),
  61463.                 $response->getHeaders()
  61464.             ];
  61465.         } catch (ApiException $e) {
  61466.             switch ($e->getCode()) {
  61467.                 case 200:
  61468.                     $data AccountingObjectSerializer::deserialize(
  61469.                         $e->getResponseBody(),
  61470.                         '\XeroAPI\XeroPHP\Models\Accounting\TaxRates',
  61471.                         $e->getResponseHeaders()
  61472.                     );
  61473.                     $e->setResponseObject($data);
  61474.                     break;
  61475.                 case 400:
  61476.                     $data AccountingObjectSerializer::deserialize(
  61477.                         $e->getResponseBody(),
  61478.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  61479.                         $e->getResponseHeaders()
  61480.                     );
  61481.                     $e->setResponseObject($data);
  61482.                     break;
  61483.             }
  61484.             throw $e;
  61485.         }
  61486.     }
  61487.     /**
  61488.      * Operation updateTaxRateAsync
  61489.      * Updates tax rates
  61490.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  61491.      * @param  \XeroAPI\XeroPHP\Models\Accounting\TaxRates $tax_rates (required)
  61492.      * @throws \InvalidArgumentException
  61493.      * @return \GuzzleHttp\Promise\PromiseInterface
  61494.      */
  61495.     public function updateTaxRateAsync($xero_tenant_id$tax_rates)
  61496.     {
  61497.         return $this->updateTaxRateAsyncWithHttpInfo($xero_tenant_id$tax_rates)
  61498.             ->then(
  61499.                 function ($response) {
  61500.                     return $response[0];
  61501.                 }
  61502.             );
  61503.     }
  61504.     /**
  61505.      * Operation updateTaxRateAsyncWithHttpInfo
  61506.      * Updates tax rates
  61507.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  61508.      * @param  \XeroAPI\XeroPHP\Models\Accounting\TaxRates $tax_rates (required)
  61509.      * @throws \InvalidArgumentException
  61510.      * @return \GuzzleHttp\Promise\PromiseInterface */
  61511.     public function updateTaxRateAsyncWithHttpInfo($xero_tenant_id$tax_rates)
  61512.     {
  61513.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\TaxRates';
  61514.         $request $this->updateTaxRateRequest($xero_tenant_id$tax_rates);
  61515.         return $this->client
  61516.             ->sendAsync($request$this->createHttpClientOption())
  61517.             ->then(
  61518.                 function ($response) use ($returnType) {
  61519.                     $responseBody $response->getBody();
  61520.                     if ($returnType === '\SplFileObject') {
  61521.                         $content $responseBody//stream goes to serializer
  61522.                     } else {
  61523.                         $content $responseBody->getContents();
  61524.                     }
  61525.                     return [
  61526.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  61527.                         $response->getStatusCode(),
  61528.                         $response->getHeaders()
  61529.                     ];
  61530.                 },
  61531.                 function ($exception) {
  61532.                     $response $exception->getResponse();
  61533.                     $statusCode $response->getStatusCode();
  61534.                     throw new ApiException(
  61535.                         sprintf(
  61536.                             '[%d] Error connecting to the API (%s)',
  61537.                             $statusCode,
  61538.                             $exception->getRequest()->getUri()
  61539.                         ),
  61540.                         $statusCode,
  61541.                         $response->getHeaders(),
  61542.                         $response->getBody()
  61543.                     );
  61544.                 }
  61545.             );
  61546.     }
  61547.     /**
  61548.      * Create request for operation 'updateTaxRate'
  61549.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  61550.      * @param  \XeroAPI\XeroPHP\Models\Accounting\TaxRates $tax_rates (required)
  61551.      * @throws \InvalidArgumentException
  61552.      * @return \GuzzleHttp\Psr7\Request  */
  61553.     protected function updateTaxRateRequest($xero_tenant_id$tax_rates)
  61554.     {
  61555.         // verify the required parameter 'xero_tenant_id' is set
  61556.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  61557.             throw new \InvalidArgumentException(
  61558.                 'Missing the required parameter $xero_tenant_id when calling updateTaxRate'
  61559.             );
  61560.         }
  61561.         // verify the required parameter 'tax_rates' is set
  61562.         if ($tax_rates === null || (is_array($tax_rates) && count($tax_rates) === 0)) {
  61563.             throw new \InvalidArgumentException(
  61564.                 'Missing the required parameter $tax_rates when calling updateTaxRate'
  61565.             );
  61566.         }
  61567.         $resourcePath '/TaxRates';
  61568.         $formParams = [];
  61569.         $queryParams = [];
  61570.         $headerParams = [];
  61571.         $httpBody '';
  61572.         $multipart false;
  61573.         // header params
  61574.         if ($xero_tenant_id !== null) {
  61575.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  61576.         }
  61577.         // body params
  61578.         $_tempBody null;
  61579.         if (isset($tax_rates)) {
  61580.             $_tempBody $tax_rates;
  61581.         }
  61582.         if ($multipart) {
  61583.             $headers $this->headerSelector->selectHeadersForMultipart(
  61584.                 ['application/json']
  61585.             );
  61586.         } else {
  61587.             $headers $this->headerSelector->selectHeaders(
  61588.                 ['application/json'],
  61589.                 ['application/json']
  61590.             );
  61591.         }
  61592.         // for model (json/xml)
  61593.         if (isset($_tempBody)) {
  61594.             // $_tempBody is the method argument, if present
  61595.             if ($headers['Content-Type'] === 'application/json') {
  61596.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  61597.             } else {
  61598.                 $httpBody $_tempBody;
  61599.             }
  61600.         } elseif (count($formParams) > 0) {
  61601.             if ($multipart) {
  61602.                 $multipartContents = [
  61603.                     [
  61604.                         'Content-type' => 'multipart/form-data',
  61605.                     ]
  61606.                 ];
  61607.                 
  61608.                 // for HTTP post (form)
  61609.                 $httpBody = new MultipartStream($multipartContents);
  61610.             } elseif ($headers['Content-Type'] === 'application/json') {
  61611.                 $httpBody \GuzzleHttp\json_encode($formParams);
  61612.             } else {
  61613.                 // for HTTP post (form)
  61614.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  61615.             }
  61616.         }
  61617.         // this endpoint requires OAuth (access token)
  61618.         if ($this->config->getAccessToken() !== null) {
  61619.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  61620.         }
  61621.         $defaultHeaders = [];
  61622.         if ($this->config->getUserAgent()) {
  61623.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  61624.         }
  61625.         $headers array_merge(
  61626.             $defaultHeaders,
  61627.             $headerParams,
  61628.             $headers
  61629.         );
  61630.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  61631.         return new Request(
  61632.             'POST',
  61633.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  61634.             $headers,
  61635.             $httpBody
  61636.         );
  61637.     }
  61638.     /**
  61639.      * Operation updateTrackingCategory
  61640.      * Updates a specific tracking category
  61641.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  61642.      * @param  string $tracking_category_id Unique identifier for a TrackingCategory (required)
  61643.      * @param  \XeroAPI\XeroPHP\Models\Accounting\TrackingCategory $tracking_category tracking_category (required)
  61644.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  61645.      * @throws \InvalidArgumentException
  61646.      * @return \XeroAPI\XeroPHP\Models\Accounting\TrackingCategories|\XeroAPI\XeroPHP\Models\Accounting\Error
  61647.      */
  61648.     public function updateTrackingCategory($xero_tenant_id$tracking_category_id$tracking_category)
  61649.     {
  61650.         list($response) = $this->updateTrackingCategoryWithHttpInfo($xero_tenant_id$tracking_category_id$tracking_category);
  61651.         return $response;
  61652.     }
  61653.     /**
  61654.      * Operation updateTrackingCategoryWithHttpInfo
  61655.      * Updates a specific tracking category
  61656.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  61657.      * @param  string $tracking_category_id Unique identifier for a TrackingCategory (required)
  61658.      * @param  \XeroAPI\XeroPHP\Models\Accounting\TrackingCategory $tracking_category (required)
  61659.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  61660.      * @throws \InvalidArgumentException
  61661.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\TrackingCategories|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  61662.      */
  61663.     public function updateTrackingCategoryWithHttpInfo($xero_tenant_id$tracking_category_id$tracking_category)
  61664.     {
  61665.         $request $this->updateTrackingCategoryRequest($xero_tenant_id$tracking_category_id$tracking_category);
  61666.         try {
  61667.             $options $this->createHttpClientOption();
  61668.             try {
  61669.                 $response $this->client->send($request$options);
  61670.             } catch (RequestException $e) {
  61671.                 throw new ApiException(
  61672.                     "[{$e->getCode()}{$e->getMessage()}",
  61673.                     $e->getCode(),
  61674.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  61675.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  61676.                 );
  61677.             }
  61678.             $statusCode $response->getStatusCode();
  61679.             if ($statusCode 200 || $statusCode 299) {
  61680.                 throw new ApiException(
  61681.                     sprintf(
  61682.                         '[%d] Error connecting to the API (%s)',
  61683.                         $statusCode,
  61684.                         $request->getUri()
  61685.                     ),
  61686.                     $statusCode,
  61687.                     $response->getHeaders(),
  61688.                     $response->getBody()
  61689.                 );
  61690.             }
  61691.             $responseBody $response->getBody();
  61692.             switch($statusCode) {
  61693.                 case 200:
  61694.                     if ('\XeroAPI\XeroPHP\Models\Accounting\TrackingCategories' === '\SplFileObject') {
  61695.                         $content $responseBody//stream goes to serializer
  61696.                     } else {
  61697.                         $content $responseBody->getContents();
  61698.                     }
  61699.                     return [
  61700.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\TrackingCategories', []),
  61701.                         $response->getStatusCode(),
  61702.                         $response->getHeaders()
  61703.                     ];
  61704.                 case 400:
  61705.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  61706.                         $content $responseBody//stream goes to serializer
  61707.                     } else {
  61708.                         $content $responseBody->getContents();
  61709.                     }
  61710.                     return [
  61711.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  61712.                         $response->getStatusCode(),
  61713.                         $response->getHeaders()
  61714.                     ];
  61715.             }
  61716.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\TrackingCategories';
  61717.             $responseBody $response->getBody();
  61718.             if ($returnType === '\SplFileObject') {
  61719.                 $content $responseBody//stream goes to serializer
  61720.             } else {
  61721.                 $content $responseBody->getContents();
  61722.             }
  61723.             return [
  61724.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  61725.                 $response->getStatusCode(),
  61726.                 $response->getHeaders()
  61727.             ];
  61728.         } catch (ApiException $e) {
  61729.             switch ($e->getCode()) {
  61730.                 case 200:
  61731.                     $data AccountingObjectSerializer::deserialize(
  61732.                         $e->getResponseBody(),
  61733.                         '\XeroAPI\XeroPHP\Models\Accounting\TrackingCategories',
  61734.                         $e->getResponseHeaders()
  61735.                     );
  61736.                     $e->setResponseObject($data);
  61737.                     break;
  61738.                 case 400:
  61739.                     $data AccountingObjectSerializer::deserialize(
  61740.                         $e->getResponseBody(),
  61741.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  61742.                         $e->getResponseHeaders()
  61743.                     );
  61744.                     $e->setResponseObject($data);
  61745.                     break;
  61746.             }
  61747.             throw $e;
  61748.         }
  61749.     }
  61750.     /**
  61751.      * Operation updateTrackingCategoryAsync
  61752.      * Updates a specific tracking category
  61753.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  61754.      * @param  string $tracking_category_id Unique identifier for a TrackingCategory (required)
  61755.      * @param  \XeroAPI\XeroPHP\Models\Accounting\TrackingCategory $tracking_category (required)
  61756.      * @throws \InvalidArgumentException
  61757.      * @return \GuzzleHttp\Promise\PromiseInterface
  61758.      */
  61759.     public function updateTrackingCategoryAsync($xero_tenant_id$tracking_category_id$tracking_category)
  61760.     {
  61761.         return $this->updateTrackingCategoryAsyncWithHttpInfo($xero_tenant_id$tracking_category_id$tracking_category)
  61762.             ->then(
  61763.                 function ($response) {
  61764.                     return $response[0];
  61765.                 }
  61766.             );
  61767.     }
  61768.     /**
  61769.      * Operation updateTrackingCategoryAsyncWithHttpInfo
  61770.      * Updates a specific tracking category
  61771.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  61772.      * @param  string $tracking_category_id Unique identifier for a TrackingCategory (required)
  61773.      * @param  \XeroAPI\XeroPHP\Models\Accounting\TrackingCategory $tracking_category (required)
  61774.      * @throws \InvalidArgumentException
  61775.      * @return \GuzzleHttp\Promise\PromiseInterface */
  61776.     public function updateTrackingCategoryAsyncWithHttpInfo($xero_tenant_id$tracking_category_id$tracking_category)
  61777.     {
  61778.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\TrackingCategories';
  61779.         $request $this->updateTrackingCategoryRequest($xero_tenant_id$tracking_category_id$tracking_category);
  61780.         return $this->client
  61781.             ->sendAsync($request$this->createHttpClientOption())
  61782.             ->then(
  61783.                 function ($response) use ($returnType) {
  61784.                     $responseBody $response->getBody();
  61785.                     if ($returnType === '\SplFileObject') {
  61786.                         $content $responseBody//stream goes to serializer
  61787.                     } else {
  61788.                         $content $responseBody->getContents();
  61789.                     }
  61790.                     return [
  61791.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  61792.                         $response->getStatusCode(),
  61793.                         $response->getHeaders()
  61794.                     ];
  61795.                 },
  61796.                 function ($exception) {
  61797.                     $response $exception->getResponse();
  61798.                     $statusCode $response->getStatusCode();
  61799.                     throw new ApiException(
  61800.                         sprintf(
  61801.                             '[%d] Error connecting to the API (%s)',
  61802.                             $statusCode,
  61803.                             $exception->getRequest()->getUri()
  61804.                         ),
  61805.                         $statusCode,
  61806.                         $response->getHeaders(),
  61807.                         $response->getBody()
  61808.                     );
  61809.                 }
  61810.             );
  61811.     }
  61812.     /**
  61813.      * Create request for operation 'updateTrackingCategory'
  61814.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  61815.      * @param  string $tracking_category_id Unique identifier for a TrackingCategory (required)
  61816.      * @param  \XeroAPI\XeroPHP\Models\Accounting\TrackingCategory $tracking_category (required)
  61817.      * @throws \InvalidArgumentException
  61818.      * @return \GuzzleHttp\Psr7\Request  */
  61819.     protected function updateTrackingCategoryRequest($xero_tenant_id$tracking_category_id$tracking_category)
  61820.     {
  61821.         // verify the required parameter 'xero_tenant_id' is set
  61822.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  61823.             throw new \InvalidArgumentException(
  61824.                 'Missing the required parameter $xero_tenant_id when calling updateTrackingCategory'
  61825.             );
  61826.         }
  61827.         // verify the required parameter 'tracking_category_id' is set
  61828.         if ($tracking_category_id === null || (is_array($tracking_category_id) && count($tracking_category_id) === 0)) {
  61829.             throw new \InvalidArgumentException(
  61830.                 'Missing the required parameter $tracking_category_id when calling updateTrackingCategory'
  61831.             );
  61832.         }
  61833.         // verify the required parameter 'tracking_category' is set
  61834.         if ($tracking_category === null || (is_array($tracking_category) && count($tracking_category) === 0)) {
  61835.             throw new \InvalidArgumentException(
  61836.                 'Missing the required parameter $tracking_category when calling updateTrackingCategory'
  61837.             );
  61838.         }
  61839.         $resourcePath '/TrackingCategories/{TrackingCategoryID}';
  61840.         $formParams = [];
  61841.         $queryParams = [];
  61842.         $headerParams = [];
  61843.         $httpBody '';
  61844.         $multipart false;
  61845.         // header params
  61846.         if ($xero_tenant_id !== null) {
  61847.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  61848.         }
  61849.         // path params
  61850.         if ($tracking_category_id !== null) {
  61851.             $resourcePath str_replace(
  61852.                 '{' 'TrackingCategoryID' '}',
  61853.                 AccountingObjectSerializer::toPathValue($tracking_category_id),
  61854.                 $resourcePath
  61855.             );
  61856.         }
  61857.         // body params
  61858.         $_tempBody null;
  61859.         if (isset($tracking_category)) {
  61860.             $_tempBody $tracking_category;
  61861.         }
  61862.         if ($multipart) {
  61863.             $headers $this->headerSelector->selectHeadersForMultipart(
  61864.                 ['application/json']
  61865.             );
  61866.         } else {
  61867.             $headers $this->headerSelector->selectHeaders(
  61868.                 ['application/json'],
  61869.                 ['application/json']
  61870.             );
  61871.         }
  61872.         // for model (json/xml)
  61873.         if (isset($_tempBody)) {
  61874.             // $_tempBody is the method argument, if present
  61875.             if ($headers['Content-Type'] === 'application/json') {
  61876.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  61877.             } else {
  61878.                 $httpBody $_tempBody;
  61879.             }
  61880.         } elseif (count($formParams) > 0) {
  61881.             if ($multipart) {
  61882.                 $multipartContents = [
  61883.                     [
  61884.                         'Content-type' => 'multipart/form-data',
  61885.                     ]
  61886.                 ];
  61887.                 
  61888.                 // for HTTP post (form)
  61889.                 $httpBody = new MultipartStream($multipartContents);
  61890.             } elseif ($headers['Content-Type'] === 'application/json') {
  61891.                 $httpBody \GuzzleHttp\json_encode($formParams);
  61892.             } else {
  61893.                 // for HTTP post (form)
  61894.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  61895.             }
  61896.         }
  61897.         // this endpoint requires OAuth (access token)
  61898.         if ($this->config->getAccessToken() !== null) {
  61899.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  61900.         }
  61901.         $defaultHeaders = [];
  61902.         if ($this->config->getUserAgent()) {
  61903.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  61904.         }
  61905.         $headers array_merge(
  61906.             $defaultHeaders,
  61907.             $headerParams,
  61908.             $headers
  61909.         );
  61910.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  61911.         return new Request(
  61912.             'POST',
  61913.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  61914.             $headers,
  61915.             $httpBody
  61916.         );
  61917.     }
  61918.     /**
  61919.      * Operation updateTrackingOptions
  61920.      * Updates a specific option for a specific tracking category
  61921.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  61922.      * @param  string $tracking_category_id Unique identifier for a TrackingCategory (required)
  61923.      * @param  string $tracking_option_id Unique identifier for a Tracking Option (required)
  61924.      * @param  \XeroAPI\XeroPHP\Models\Accounting\TrackingOption $tracking_option tracking_option (required)
  61925.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  61926.      * @throws \InvalidArgumentException
  61927.      * @return \XeroAPI\XeroPHP\Models\Accounting\TrackingOptions|\XeroAPI\XeroPHP\Models\Accounting\Error
  61928.      */
  61929.     public function updateTrackingOptions($xero_tenant_id$tracking_category_id$tracking_option_id$tracking_option)
  61930.     {
  61931.         list($response) = $this->updateTrackingOptionsWithHttpInfo($xero_tenant_id$tracking_category_id$tracking_option_id$tracking_option);
  61932.         return $response;
  61933.     }
  61934.     /**
  61935.      * Operation updateTrackingOptionsWithHttpInfo
  61936.      * Updates a specific option for a specific tracking category
  61937.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  61938.      * @param  string $tracking_category_id Unique identifier for a TrackingCategory (required)
  61939.      * @param  string $tracking_option_id Unique identifier for a Tracking Option (required)
  61940.      * @param  \XeroAPI\XeroPHP\Models\Accounting\TrackingOption $tracking_option (required)
  61941.      * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response
  61942.      * @throws \InvalidArgumentException
  61943.      * @return array of \XeroAPI\XeroPHP\Models\Accounting\TrackingOptions|\XeroAPI\XeroPHP\Models\Accounting\Error, HTTP status code, HTTP response headers (array of strings)
  61944.      */
  61945.     public function updateTrackingOptionsWithHttpInfo($xero_tenant_id$tracking_category_id$tracking_option_id$tracking_option)
  61946.     {
  61947.         $request $this->updateTrackingOptionsRequest($xero_tenant_id$tracking_category_id$tracking_option_id$tracking_option);
  61948.         try {
  61949.             $options $this->createHttpClientOption();
  61950.             try {
  61951.                 $response $this->client->send($request$options);
  61952.             } catch (RequestException $e) {
  61953.                 throw new ApiException(
  61954.                     "[{$e->getCode()}{$e->getMessage()}",
  61955.                     $e->getCode(),
  61956.                     $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  61957.                     $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
  61958.                 );
  61959.             }
  61960.             $statusCode $response->getStatusCode();
  61961.             if ($statusCode 200 || $statusCode 299) {
  61962.                 throw new ApiException(
  61963.                     sprintf(
  61964.                         '[%d] Error connecting to the API (%s)',
  61965.                         $statusCode,
  61966.                         $request->getUri()
  61967.                     ),
  61968.                     $statusCode,
  61969.                     $response->getHeaders(),
  61970.                     $response->getBody()
  61971.                 );
  61972.             }
  61973.             $responseBody $response->getBody();
  61974.             switch($statusCode) {
  61975.                 case 200:
  61976.                     if ('\XeroAPI\XeroPHP\Models\Accounting\TrackingOptions' === '\SplFileObject') {
  61977.                         $content $responseBody//stream goes to serializer
  61978.                     } else {
  61979.                         $content $responseBody->getContents();
  61980.                     }
  61981.                     return [
  61982.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\TrackingOptions', []),
  61983.                         $response->getStatusCode(),
  61984.                         $response->getHeaders()
  61985.                     ];
  61986.                 case 400:
  61987.                     if ('\XeroAPI\XeroPHP\Models\Accounting\Error' === '\SplFileObject') {
  61988.                         $content $responseBody//stream goes to serializer
  61989.                     } else {
  61990.                         $content $responseBody->getContents();
  61991.                     }
  61992.                     return [
  61993.                         AccountingObjectSerializer::deserialize($content'\XeroAPI\XeroPHP\Models\Accounting\Error', []),
  61994.                         $response->getStatusCode(),
  61995.                         $response->getHeaders()
  61996.                     ];
  61997.             }
  61998.             $returnType '\XeroAPI\XeroPHP\Models\Accounting\TrackingOptions';
  61999.             $responseBody $response->getBody();
  62000.             if ($returnType === '\SplFileObject') {
  62001.                 $content $responseBody//stream goes to serializer
  62002.             } else {
  62003.                 $content $responseBody->getContents();
  62004.             }
  62005.             return [
  62006.                 AccountingObjectSerializer::deserialize($content$returnType, []),
  62007.                 $response->getStatusCode(),
  62008.                 $response->getHeaders()
  62009.             ];
  62010.         } catch (ApiException $e) {
  62011.             switch ($e->getCode()) {
  62012.                 case 200:
  62013.                     $data AccountingObjectSerializer::deserialize(
  62014.                         $e->getResponseBody(),
  62015.                         '\XeroAPI\XeroPHP\Models\Accounting\TrackingOptions',
  62016.                         $e->getResponseHeaders()
  62017.                     );
  62018.                     $e->setResponseObject($data);
  62019.                     break;
  62020.                 case 400:
  62021.                     $data AccountingObjectSerializer::deserialize(
  62022.                         $e->getResponseBody(),
  62023.                         '\XeroAPI\XeroPHP\Models\Accounting\Error',
  62024.                         $e->getResponseHeaders()
  62025.                     );
  62026.                     $e->setResponseObject($data);
  62027.                     break;
  62028.             }
  62029.             throw $e;
  62030.         }
  62031.     }
  62032.     /**
  62033.      * Operation updateTrackingOptionsAsync
  62034.      * Updates a specific option for a specific tracking category
  62035.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  62036.      * @param  string $tracking_category_id Unique identifier for a TrackingCategory (required)
  62037.      * @param  string $tracking_option_id Unique identifier for a Tracking Option (required)
  62038.      * @param  \XeroAPI\XeroPHP\Models\Accounting\TrackingOption $tracking_option (required)
  62039.      * @throws \InvalidArgumentException
  62040.      * @return \GuzzleHttp\Promise\PromiseInterface
  62041.      */
  62042.     public function updateTrackingOptionsAsync($xero_tenant_id$tracking_category_id$tracking_option_id$tracking_option)
  62043.     {
  62044.         return $this->updateTrackingOptionsAsyncWithHttpInfo($xero_tenant_id$tracking_category_id$tracking_option_id$tracking_option)
  62045.             ->then(
  62046.                 function ($response) {
  62047.                     return $response[0];
  62048.                 }
  62049.             );
  62050.     }
  62051.     /**
  62052.      * Operation updateTrackingOptionsAsyncWithHttpInfo
  62053.      * Updates a specific option for a specific tracking category
  62054.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  62055.      * @param  string $tracking_category_id Unique identifier for a TrackingCategory (required)
  62056.      * @param  string $tracking_option_id Unique identifier for a Tracking Option (required)
  62057.      * @param  \XeroAPI\XeroPHP\Models\Accounting\TrackingOption $tracking_option (required)
  62058.      * @throws \InvalidArgumentException
  62059.      * @return \GuzzleHttp\Promise\PromiseInterface */
  62060.     public function updateTrackingOptionsAsyncWithHttpInfo($xero_tenant_id$tracking_category_id$tracking_option_id$tracking_option)
  62061.     {
  62062.         $returnType '\XeroAPI\XeroPHP\Models\Accounting\TrackingOptions';
  62063.         $request $this->updateTrackingOptionsRequest($xero_tenant_id$tracking_category_id$tracking_option_id$tracking_option);
  62064.         return $this->client
  62065.             ->sendAsync($request$this->createHttpClientOption())
  62066.             ->then(
  62067.                 function ($response) use ($returnType) {
  62068.                     $responseBody $response->getBody();
  62069.                     if ($returnType === '\SplFileObject') {
  62070.                         $content $responseBody//stream goes to serializer
  62071.                     } else {
  62072.                         $content $responseBody->getContents();
  62073.                     }
  62074.                     return [
  62075.                         AccountingObjectSerializer::deserialize($content$returnType, []),
  62076.                         $response->getStatusCode(),
  62077.                         $response->getHeaders()
  62078.                     ];
  62079.                 },
  62080.                 function ($exception) {
  62081.                     $response $exception->getResponse();
  62082.                     $statusCode $response->getStatusCode();
  62083.                     throw new ApiException(
  62084.                         sprintf(
  62085.                             '[%d] Error connecting to the API (%s)',
  62086.                             $statusCode,
  62087.                             $exception->getRequest()->getUri()
  62088.                         ),
  62089.                         $statusCode,
  62090.                         $response->getHeaders(),
  62091.                         $response->getBody()
  62092.                     );
  62093.                 }
  62094.             );
  62095.     }
  62096.     /**
  62097.      * Create request for operation 'updateTrackingOptions'
  62098.      * @param  string $xero_tenant_id Xero identifier for Tenant (required)
  62099.      * @param  string $tracking_category_id Unique identifier for a TrackingCategory (required)
  62100.      * @param  string $tracking_option_id Unique identifier for a Tracking Option (required)
  62101.      * @param  \XeroAPI\XeroPHP\Models\Accounting\TrackingOption $tracking_option (required)
  62102.      * @throws \InvalidArgumentException
  62103.      * @return \GuzzleHttp\Psr7\Request  */
  62104.     protected function updateTrackingOptionsRequest($xero_tenant_id$tracking_category_id$tracking_option_id$tracking_option)
  62105.     {
  62106.         // verify the required parameter 'xero_tenant_id' is set
  62107.         if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) {
  62108.             throw new \InvalidArgumentException(
  62109.                 'Missing the required parameter $xero_tenant_id when calling updateTrackingOptions'
  62110.             );
  62111.         }
  62112.         // verify the required parameter 'tracking_category_id' is set
  62113.         if ($tracking_category_id === null || (is_array($tracking_category_id) && count($tracking_category_id) === 0)) {
  62114.             throw new \InvalidArgumentException(
  62115.                 'Missing the required parameter $tracking_category_id when calling updateTrackingOptions'
  62116.             );
  62117.         }
  62118.         // verify the required parameter 'tracking_option_id' is set
  62119.         if ($tracking_option_id === null || (is_array($tracking_option_id) && count($tracking_option_id) === 0)) {
  62120.             throw new \InvalidArgumentException(
  62121.                 'Missing the required parameter $tracking_option_id when calling updateTrackingOptions'
  62122.             );
  62123.         }
  62124.         // verify the required parameter 'tracking_option' is set
  62125.         if ($tracking_option === null || (is_array($tracking_option) && count($tracking_option) === 0)) {
  62126.             throw new \InvalidArgumentException(
  62127.                 'Missing the required parameter $tracking_option when calling updateTrackingOptions'
  62128.             );
  62129.         }
  62130.         $resourcePath '/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}';
  62131.         $formParams = [];
  62132.         $queryParams = [];
  62133.         $headerParams = [];
  62134.         $httpBody '';
  62135.         $multipart false;
  62136.         // header params
  62137.         if ($xero_tenant_id !== null) {
  62138.             $headerParams['xero-tenant-id'] = AccountingObjectSerializer::toHeaderValue($xero_tenant_id);
  62139.         }
  62140.         // path params
  62141.         if ($tracking_category_id !== null) {
  62142.             $resourcePath str_replace(
  62143.                 '{' 'TrackingCategoryID' '}',
  62144.                 AccountingObjectSerializer::toPathValue($tracking_category_id),
  62145.                 $resourcePath
  62146.             );
  62147.         }
  62148.         // path params
  62149.         if ($tracking_option_id !== null) {
  62150.             $resourcePath str_replace(
  62151.                 '{' 'TrackingOptionID' '}',
  62152.                 AccountingObjectSerializer::toPathValue($tracking_option_id),
  62153.                 $resourcePath
  62154.             );
  62155.         }
  62156.         // body params
  62157.         $_tempBody null;
  62158.         if (isset($tracking_option)) {
  62159.             $_tempBody $tracking_option;
  62160.         }
  62161.         if ($multipart) {
  62162.             $headers $this->headerSelector->selectHeadersForMultipart(
  62163.                 ['application/json']
  62164.             );
  62165.         } else {
  62166.             $headers $this->headerSelector->selectHeaders(
  62167.                 ['application/json'],
  62168.                 ['application/json']
  62169.             );
  62170.         }
  62171.         // for model (json/xml)
  62172.         if (isset($_tempBody)) {
  62173.             // $_tempBody is the method argument, if present
  62174.             if ($headers['Content-Type'] === 'application/json') {
  62175.                 $httpBody \GuzzleHttp\json_encode(AccountingObjectSerializer::sanitizeForSerialization($_tempBody));
  62176.             } else {
  62177.                 $httpBody $_tempBody;
  62178.             }
  62179.         } elseif (count($formParams) > 0) {
  62180.             if ($multipart) {
  62181.                 $multipartContents = [
  62182.                     [
  62183.                         'Content-type' => 'multipart/form-data',
  62184.                     ]
  62185.                 ];
  62186.                 
  62187.                 // for HTTP post (form)
  62188.                 $httpBody = new MultipartStream($multipartContents);
  62189.             } elseif ($headers['Content-Type'] === 'application/json') {
  62190.                 $httpBody \GuzzleHttp\json_encode($formParams);
  62191.             } else {
  62192.                 // for HTTP post (form)
  62193.                 $httpBody \GuzzleHttp\Psr7\Query::build($formParams);
  62194.             }
  62195.         }
  62196.         // this endpoint requires OAuth (access token)
  62197.         if ($this->config->getAccessToken() !== null) {
  62198.             $headers['Authorization'] = 'Bearer ' $this->config->getAccessToken();
  62199.         }
  62200.         $defaultHeaders = [];
  62201.         if ($this->config->getUserAgent()) {
  62202.             $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  62203.         }
  62204.         $headers array_merge(
  62205.             $defaultHeaders,
  62206.             $headerParams,
  62207.             $headers
  62208.         );
  62209.         $query \GuzzleHttp\Psr7\Query::build($queryParams);
  62210.         return new Request(
  62211.             'POST',
  62212.             $this->config->getHostAccounting() . $resourcePath . ($query "?{$query}''),
  62213.             $headers,
  62214.             $httpBody
  62215.         );
  62216.     }
  62217.     /**
  62218.      * Create http client option
  62219.      *
  62220.      * @throws \RuntimeException on file opening failure
  62221.      * @return array of http client options
  62222.      */
  62223.     protected function createHttpClientOption()
  62224.     {
  62225.         $options = [];
  62226.         if ($this->config->getDebug()) {
  62227.             $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
  62228.             if (!$options[RequestOptions::DEBUG]) {
  62229.                 throw new \RuntimeException('Failed to open the debug file: ' $this->config->getDebugFile());
  62230.             }
  62231.         }
  62232.         return $options;
  62233.     }
  62234. }