Skip to content

Added possibility to provide GET-parameters for UserApi::getContactBy… #169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 34 additions & 20 deletions src/Api/UsersApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -1974,14 +1974,17 @@ public function deleteSignatureImageWithHttpInfo($account_id, $image_type, $sign
*
* @param ?string $account_id The external account number (int) or account ID Guid.
* @param ?string $contact_id The unique identifier of a person in the contacts address book.
* @param ?array $queryParams (optional) GET-parameters to HTTP request.
2-dimensional representation of "keys (parameter names)" => "values".\
(If the value has "object" type, it's considered as $options, for backward compatibility.)
* @param \DocuSign\eSign\Api\UsersApi\GetContactByIdOptions $options for modifying the behavior of the function. (optional)
*
* @throws ApiException on non-2xx response
* @return \DocuSign\eSign\Model\ContactGetResponse
*/
public function getContactById($account_id, $contact_id, \DocuSign\eSign\Api\UsersApi\GetContactByIdOptions $options = null)
public function getContactById($account_id, $contact_id, $queryParams = [], \DocuSign\eSign\Api\UsersApi\GetContactByIdOptions $options = null)
{
list($response) = $this->getContactByIdWithHttpInfo($account_id, $contact_id, $options);
list($response) = $this->getContactByIdWithHttpInfo($account_id, $contact_id, $queryParams, $options);
return $response;
}

Expand All @@ -1992,12 +1995,15 @@ public function getContactById($account_id, $contact_id, \DocuSign\eSign\Api\Use
*
* @param ?string $account_id The external account number (int) or account ID Guid.
* @param ?string $contact_id The unique identifier of a person in the contacts address book.
* @param ?array $queryParams (optional) GET-parameters to HTTP request.
2-dimensional representation of "keys (parameter names)" => "values".\
(If the value has "object" type, it's considered as $options, for backward compatibility.)
* @param \DocuSign\eSign\Api\UsersApi\GetContactByIdOptions $options for modifying the behavior of the function. (optional)
*
* @throws ApiException on non-2xx response
* @return array of \DocuSign\eSign\Model\ContactGetResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getContactByIdWithHttpInfo($account_id, $contact_id, \DocuSign\eSign\Api\UsersApi\GetContactByIdOptions $options = null): array
public function getContactByIdWithHttpInfo($account_id, $contact_id, $queryParams = [], \DocuSign\eSign\Api\UsersApi\GetContactByIdOptions $options = null): array
{
// verify the required parameter 'account_id' is set
if ($account_id === null) {
Expand All @@ -2007,19 +2013,21 @@ public function getContactByIdWithHttpInfo($account_id, $contact_id, \DocuSign\e
if ($contact_id === null) {
throw new \InvalidArgumentException('Missing the required parameter $contact_id when calling getContactById');
}
// parse inputs
$resourcePath = "/v2.1/accounts/{accountId}/contacts/{contactId}";
$httpBody = $_tempBody ?? ''; // $_tempBody is the method argument, if present
$queryParams = $headerParams = $formParams = [];
$headerParams['Accept'] ??= $this->apiClient->selectHeaderAccept(['application/json']);
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType([]);

if ($options != null)
{
// query params
if ($options->getCloudProvider() != 'null') {
$queryParams['cloud_provider'] = $this->apiClient->getSerializer()->toQueryValue($options->getCloudProvider());
// parse inputs
$resourcePath = '/v2.1/accounts/{accountId}/contacts/{contactId}';
//$httpBody = $_tempBody ?? ''; // $_tempBody is the method argument, if present // AK 2022-04-10: odd.
// $headerParams = $formParams = []; // AK 2022-04-10: odd.

if ($options === null) {
if ('object' === gettype($queryParams)) { // if $queryParams is 'object', consider it as $options, for backward compatibility.
$options = $queryParams;
$queryParams = [];
}

}elseif ($options->getCloudProvider() !== 'null') {
if (empty($queryParams)) $queryParams = [];
$queryParams['cloud_provider'] = $this->apiClient->getSerializer()->toQueryValue($options->getCloudProvider());
}

// path params
Expand All @@ -2031,26 +2039,32 @@ public function getContactByIdWithHttpInfo($account_id, $contact_id, \DocuSign\e
$resourcePath = self::updateResourcePath($resourcePath, "contactId", $contact_id);
}

/* // AK 2022-04-10: something odd and impossible here, so commented out.
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);

// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
} elseif (count($formParams) > 0) {
$httpBody = $formParams; // for HTTP post (form)
}*/

$headerParams = [
'Accept' => $this->apiClient->selectHeaderAccept(['application/json']),
// 'Content-Type' => $this->apiClient->selectHeaderContentType([]), // AK 2022-04-10: no need to include empty value, so commented out.
];
if ($token = $this->apiClient->getConfig()->getAccessToken()) { // this endpoint requires OAuth (access token)
$headerParams['Authorization'] = 'Bearer ' . $token;
}
// this endpoint requires OAuth (access token)
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
}

// make the API Call
try {
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
$resourcePath,
'GET',
$queryParams,
$httpBody,
'', // $httpBody,
$headerParams,
'\DocuSign\eSign\Model\ContactGetResponse',
'/v2.1/accounts/{accountId}/contacts/{contactId}'
Expand Down