From 94b55147a222f6b19902c1eff2ae1d6d62b5e94b Mon Sep 17 00:00:00 2001 From: pipedrive-bot Date: Wed, 4 Mar 2026 13:23:10 +0000 Subject: [PATCH] Build 315 - version-major --- CHANGELOG.md | 60 + docs/versions/v1/Api/DealsApi.md | 1114 +-- docs/versions/v1/Api/OrganizationsApi.md | 840 +- docs/versions/v1/Api/PersonsApi.md | 794 +- docs/versions/v1/Api/PipelinesApi.md | 329 - docs/versions/v1/Api/ProductsApi.md | 420 - docs/versions/v1/Api/StagesApi.md | 336 - docs/versions/v1/Model/BasePersonItem.md | 2 +- docs/versions/v1/Model/LeadResponse.md | 1 + docs/versions/v1/Model/MergePersonItem.md | 2 +- docs/versions/v1/Model/PersonItem.md | 2 +- docs/versions/v1/Model/PictureData.md | 2 +- docs/versions/v1/Model/PictureDataWithID.md | 2 +- docs/versions/v1/Model/PictureDataWithID1.md | 7 + .../v1/Model/PictureDataWithID1Pictures.md | 10 + docs/versions/v1/Model/PictureDataWithID2.md | 9 + .../versions/v1/Model/PictureDataWithValue.md | 2 +- .../Model/ProjectMandatoryObjectFragment.md | 2 - .../v1/Model/ProjectObjectFragment.md | 2 + docs/versions/v1/Model/ProjectPostObject.md | 4 +- ...nshipOrganizationInfoItemWithActiveFlag.md | 1 + .../v1/Model/RequiredPostProjectParameters.md | 2 - docs/versions/v1/README.md | 249 +- docs/versions/v2/Model/DealItem.md | 1 + lib/versions/v1/Api/DealsApi.php | 7088 ++++------------- lib/versions/v1/Api/OrganizationsApi.php | 4202 +--------- lib/versions/v1/Api/PersonsApi.php | 3951 ++------- lib/versions/v1/Api/PipelinesApi.php | 2033 +---- lib/versions/v1/Api/ProductsApi.php | 2564 +----- lib/versions/v1/Api/StagesApi.php | 1718 +--- lib/versions/v1/Model/BasePersonItem.php | 6 +- .../v1/Model/GetProductFieldResponse.php | 2 +- lib/versions/v1/Model/LeadResponse.php | 30 + lib/versions/v1/Model/MergePersonItem.php | 6 +- lib/versions/v1/Model/PersonItem.php | 6 +- lib/versions/v1/Model/PictureData.php | 6 +- lib/versions/v1/Model/PictureDataWithID.php | 6 +- lib/versions/v1/Model/PictureDataWithID1.php | 220 +- .../v1/Model/PictureDataWithID1Pictures.php | 375 + lib/versions/v1/Model/PictureDataWithID2.php | 345 + .../v1/Model/PictureDataWithValue.php | 6 +- .../Model/ProjectMandatoryObjectFragment.php | 70 +- .../v1/Model/ProjectObjectFragment.php | 60 + lib/versions/v1/Model/ProjectPostObject.php | 14 +- ...shipOrganizationInfoItemWithActiveFlag.php | 30 + .../Model/RequiredPostProjectParameters.php | 76 +- lib/versions/v2/Model/DealItem.php | 30 + 47 files changed, 4379 insertions(+), 22658 deletions(-) create mode 100644 docs/versions/v1/Model/PictureDataWithID1Pictures.md create mode 100644 docs/versions/v1/Model/PictureDataWithID2.md create mode 100644 lib/versions/v1/Model/PictureDataWithID1Pictures.php create mode 100644 lib/versions/v1/Model/PictureDataWithID2.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 3251b199..84c3361a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,66 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Removed +- Removed deprecated v1 endpoints that have v2 equivalents. See the [deprecation announcement](https://developers.pipedrive.com/changelog/post/deprecation-of-selected-api-v1-endpoints) for details. Please migrate to the corresponding v2 endpoints listed below: + - `GET /v1/activities` → `GET /api/v2/activities` + - `GET /v1/activities/collection` → `GET /api/v2/activities` + - `GET /v1/activities/{id}` → `GET /api/v2/activities/{id}` + - `POST /v1/activities` → `POST /api/v2/activities` + - `PUT /v1/activities/{id}` → `PATCH /api/v2/activities/{id}` + - `DELETE /v1/activities/{id}` → `DELETE /api/v2/activities/{id}` + - `GET /v1/deals` → `GET /api/v2/deals` + - `GET /v1/deals/collection` → `GET /api/v2/deals` + - `GET /v1/deals/{id}` → `GET /api/v2/deals/{id}` + - `GET /v1/deals/search` → `GET /api/v2/deals/search` + - `POST /v1/deals` → `POST /api/v2/deals` + - `PUT /v1/deals/{id}` → `PATCH /api/v2/deals/{id}` + - `DELETE /v1/deals/{id}` → `DELETE /api/v2/deals/{id}` + - `GET /v1/deals/{id}/activities` → `GET /api/v2/activities?deal_id={id}` + - `GET /v1/deals/{id}/persons` → `GET /api/v2/persons?deal_id={id}` + - `GET /v1/deals/{id}/products` → `GET /api/v2/deals/{id}/products` + - `POST /v1/deals/{id}/products` → `POST /api/v2/deals/{id}/products` + - `PUT /v1/deals/{id}/products/{product_attachment_id}` → `PATCH /api/v2/deals/{id}/products/{product_attachment_id}` + - `DELETE /v1/deals/{id}/products/{product_attachment_id}` → `DELETE /api/v2/deals/{id}/products/{product_attachment_id}` + - `GET /v1/itemSearch` → `GET /api/v2/itemSearch` + - `GET /v1/itemSearch/field` → `GET /api/v2/itemSearch/field` + - `GET /v1/organizations` → `GET /api/v2/organizations` + - `GET /v1/organizations/collection` → `GET /api/v2/organizations` + - `GET /v1/organizations/{id}` → `GET /api/v2/organizations/{id}` + - `GET /v1/organizations/search` → `GET /api/v2/organizations/search` + - `POST /v1/organizations` → `POST /api/v2/organizations` + - `PUT /v1/organizations/{id}` → `PATCH /api/v2/organizations/{id}` + - `DELETE /v1/organizations/{id}` → `DELETE /api/v2/organizations/{id}` + - `GET /v1/organizations/{id}/deals` → `GET /api/v2/deals?org_id={id}` + - `GET /v1/organizations/{id}/activities` → `GET /api/v2/activities?org_id={id}` + - `GET /v1/organizations/{id}/persons` → `GET /api/v2/persons?org_id={id}` + - `GET /v1/persons` → `GET /api/v2/persons` + - `GET /v1/persons/collection` → `GET /api/v2/persons` + - `GET /v1/persons/{id}` → `GET /api/v2/persons/{id}` + - `GET /v1/persons/search` → `GET /api/v2/persons/search` + - `POST /v1/persons` → `POST /api/v2/persons` + - `PUT /v1/persons/{id}` → `PATCH /api/v2/persons/{id}` + - `DELETE /v1/persons/{id}` → `DELETE /api/v2/persons/{id}` + - `GET /v1/persons/{id}/deals` → `GET /api/v2/deals?person_id={id}` + - `GET /v1/persons/{id}/activities` → `GET /api/v2/activities?person_id={id}` + - `GET /v1/pipelines` → `GET /api/v2/pipelines` + - `GET /v1/pipelines/{id}` → `GET /api/v2/pipelines/{id}` + - `POST /v1/pipelines` → `POST /api/v2/pipelines` + - `PUT /v1/pipelines/{id}` → `PATCH /api/v2/pipelines/{id}` + - `DELETE /v1/pipelines/{id}` → `DELETE /api/v2/pipelines/{id}` + - `GET /v1/products` → `GET /api/v2/products` + - `GET /v1/products/{id}` → `GET /api/v2/products/{id}` + - `GET /v1/products/search` → `GET /api/v2/products/search` + - `POST /v1/products` → `POST /api/v2/products` + - `PUT /v1/products/{id}` → `PATCH /api/v2/products/{id}` + - `DELETE /v1/products/{id}` → `DELETE /api/v2/products/{id}` + - `GET /v1/stages` → `GET /api/v2/stages` + - `GET /v1/stages/{id}` → `GET /api/v2/stages/{id}` + - `POST /v1/stages` → `POST /api/v2/stages` + - `PUT /v1/stages/{id}` → `PATCH /api/v2/stages/{id}` + - `DELETE /v1/stages/{id}` → `DELETE /api/v2/stages/{id}` +### Fixed +- Made `picture_id`, `org_id`, `label`, `last_name`, `cc_email`, `last_incoming_mail_time`, and `last_outgoing_mail_time` nullable in person and organization schemas to match real API behavior ## [15.4.0](https://github.com/pipedrive/client-php/compare/15.3.0...15.4.0) (2026-02-16) diff --git a/docs/versions/v1/Api/DealsApi.md b/docs/versions/v1/Api/DealsApi.md index 9c3ddb3f..ac02c8a3 100644 --- a/docs/versions/v1/Api/DealsApi.md +++ b/docs/versions/v1/Api/DealsApi.md @@ -4,105 +4,27 @@ All URIs are relative to https://api.pipedrive.com/v1. Method | HTTP request | Description ------------- | ------------- | ------------- -[**addDeal()**](DealsApi.md#addDeal) | **POST** /deals | Add a deal [**addDealFollower()**](DealsApi.md#addDealFollower) | **POST** /deals/{id}/followers | Add a follower to a deal [**addDealParticipant()**](DealsApi.md#addDealParticipant) | **POST** /deals/{id}/participants | Add a participant to a deal -[**addDealProduct()**](DealsApi.md#addDealProduct) | **POST** /deals/{id}/products | Add a product to a deal -[**deleteDeal()**](DealsApi.md#deleteDeal) | **DELETE** /deals/{id} | Delete a deal [**deleteDealFollower()**](DealsApi.md#deleteDealFollower) | **DELETE** /deals/{id}/followers/{follower_id} | Delete a follower from a deal [**deleteDealParticipant()**](DealsApi.md#deleteDealParticipant) | **DELETE** /deals/{id}/participants/{deal_participant_id} | Delete a participant from a deal -[**deleteDealProduct()**](DealsApi.md#deleteDealProduct) | **DELETE** /deals/{id}/products/{product_attachment_id} | Delete an attached product from a deal [**duplicateDeal()**](DealsApi.md#duplicateDeal) | **POST** /deals/{id}/duplicate | Duplicate deal [**getArchivedDeals()**](DealsApi.md#getArchivedDeals) | **GET** /deals/archived | Get all archived deals [**getArchivedDealsSummary()**](DealsApi.md#getArchivedDealsSummary) | **GET** /deals/summary/archived | Get archived deals summary [**getArchivedDealsTimeline()**](DealsApi.md#getArchivedDealsTimeline) | **GET** /deals/timeline/archived | Get archived deals timeline -[**getDeal()**](DealsApi.md#getDeal) | **GET** /deals/{id} | Get details of a deal -[**getDealActivities()**](DealsApi.md#getDealActivities) | **GET** /deals/{id}/activities | List activities associated with a deal [**getDealChangelog()**](DealsApi.md#getDealChangelog) | **GET** /deals/{id}/changelog | List updates about deal field values [**getDealFiles()**](DealsApi.md#getDealFiles) | **GET** /deals/{id}/files | List files attached to a deal [**getDealFollowers()**](DealsApi.md#getDealFollowers) | **GET** /deals/{id}/followers | List followers of a deal [**getDealMailMessages()**](DealsApi.md#getDealMailMessages) | **GET** /deals/{id}/mailMessages | List mail messages associated with a deal [**getDealParticipants()**](DealsApi.md#getDealParticipants) | **GET** /deals/{id}/participants | List participants of a deal [**getDealParticipantsChangelog()**](DealsApi.md#getDealParticipantsChangelog) | **GET** /deals/{id}/participantsChangelog | List updates about participants of a deal -[**getDealPersons()**](DealsApi.md#getDealPersons) | **GET** /deals/{id}/persons | List all persons associated with a deal -[**getDealProducts()**](DealsApi.md#getDealProducts) | **GET** /deals/{id}/products | List products attached to a deal [**getDealUpdates()**](DealsApi.md#getDealUpdates) | **GET** /deals/{id}/flow | List updates about a deal [**getDealUsers()**](DealsApi.md#getDealUsers) | **GET** /deals/{id}/permittedUsers | List permitted users -[**getDeals()**](DealsApi.md#getDeals) | **GET** /deals | Get all deals -[**getDealsCollection()**](DealsApi.md#getDealsCollection) | **GET** /deals/collection | Get all deals collection [**getDealsSummary()**](DealsApi.md#getDealsSummary) | **GET** /deals/summary | Get deals summary [**getDealsTimeline()**](DealsApi.md#getDealsTimeline) | **GET** /deals/timeline | Get deals timeline [**mergeDeals()**](DealsApi.md#mergeDeals) | **PUT** /deals/{id}/merge | Merge two deals -[**searchDeals()**](DealsApi.md#searchDeals) | **GET** /deals/search | Search deals -[**updateDeal()**](DealsApi.md#updateDeal) | **PUT** /deals/{id} | Update a deal -[**updateDealProduct()**](DealsApi.md#updateDealProduct) | **PUT** /deals/{id}/products/{product_attachment_id} | Update the product attached to a deal -## `addDeal()` - -```php -addDeal($new_deal): \Pipedrive\versions\v1\Model\GetAddedDeal -``` - -Add a deal - -Adds a new deal. All deals created through the Pipedrive API will have a `origin` set to `API`. Note that you can supply additional custom fields along with the request that are not described here. These custom fields are different for each Pipedrive account and can be recognized by long hashes as keys. To determine which custom fields exists, fetch the dealFields and look for `key` values. For more information, see the tutorial for adding a deal. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\DealsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$new_deal = new \Pipedrive\versions\v1\Model\NewDeal(); // \Pipedrive\versions\v1\Model\NewDeal - -try { - $result = $apiInstance->addDeal($new_deal); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling DealsApi->addDeal: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **new_deal** | [**\Pipedrive\versions\v1\Model\NewDeal**](../Model/NewDeal.md)| | [optional] - -### Return type - -[**\Pipedrive\versions\v1\Model\GetAddedDeal**](../Model/GetAddedDeal.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: `application/json` -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - ## `addDealFollower()` ```php @@ -237,138 +159,6 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `addDealProduct()` - -```php -addDealProduct($id, $new_deal_product): \Pipedrive\versions\v1\Model\GetAddProductAttachmentDetails -``` - -Add a product to a deal - -Adds a product to a deal, creating a new item called a deal-product. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\DealsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$id = 56; // int | The ID of the deal -$new_deal_product = new \Pipedrive\versions\v1\Model\NewDealProduct(); // \Pipedrive\versions\v1\Model\NewDealProduct - -try { - $result = $apiInstance->addDealProduct($id, $new_deal_product); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling DealsApi->addDealProduct: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the deal | - **new_deal_product** | [**\Pipedrive\versions\v1\Model\NewDealProduct**](../Model/NewDealProduct.md)| | [optional] - -### Return type - -[**\Pipedrive\versions\v1\Model\GetAddProductAttachmentDetails**](../Model/GetAddProductAttachmentDetails.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: `application/json` -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -## `deleteDeal()` - -```php -deleteDeal($id): \Pipedrive\versions\v1\Model\DeleteDeal -``` - -Delete a deal - -Marks a deal as deleted. After 30 days, the deal will be permanently deleted. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\DealsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$id = 56; // int | The ID of the deal - -try { - $result = $apiInstance->deleteDeal($id); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling DealsApi->deleteDeal: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the deal | - -### Return type - -[**\Pipedrive\versions\v1\Model\DeleteDeal**](../Model/DeleteDeal.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - ## `deleteDealFollower()` ```php @@ -503,73 +293,6 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `deleteDealProduct()` - -```php -deleteDealProduct($id, $product_attachment_id): \Pipedrive\versions\v1\Model\DeleteDealProduct -``` - -Delete an attached product from a deal - -Deletes a product attachment from a deal, using the `product_attachment_id` Not possible to delete the attached product if the deal has installments associated and the product is the last one enabled - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\DealsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$id = 56; // int | The ID of the deal -$product_attachment_id = 56; // int | The product attachment ID - -try { - $result = $apiInstance->deleteDealProduct($id, $product_attachment_id); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling DealsApi->deleteDealProduct: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the deal | - **product_attachment_id** | **int**| The product attachment ID | - -### Return type - -[**\Pipedrive\versions\v1\Model\DeleteDealProduct**](../Model/DeleteDealProduct.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - ## `duplicateDeal()` ```php @@ -876,15 +599,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `getDeal()` +## `getDealChangelog()` ```php -getDeal($id): \Pipedrive\versions\v1\Model\GetDeal +getDealChangelog($id, $cursor, $limit): \Pipedrive\versions\v1\Model\ChangelogResponse ``` -Get details of a deal +List updates about deal field values -Returns the details of a specific deal. Note that this also returns some additional fields which are not present when asking for all deals – such as deal age and stay in pipeline stages. Also note that custom fields appear as long hashes in the resulting data. These hashes can be mapped against the `key` value of dealFields. For more information, see the tutorial for getting details of a deal. +Lists updates about field values of a deal. ### Example @@ -909,12 +632,14 @@ $apiInstance = new Pipedrive\versions\v1\Api\DealsApi( $config ); $id = 56; // int | The ID of the deal +$cursor = 'cursor_example'; // string | For pagination, the marker (an opaque string value) representing the first item on the next page +$limit = 56; // int | Items shown per page try { - $result = $apiInstance->getDeal($id); + $result = $apiInstance->getDealChangelog($id, $cursor, $limit); print_r($result); } catch (Exception $e) { - echo 'Exception when calling DealsApi->getDeal: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling DealsApi->getDealChangelog: ', $e->getMessage(), PHP_EOL; } ``` @@ -923,10 +648,12 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **int**| The ID of the deal | + **cursor** | **string**| For pagination, the marker (an opaque string value) representing the first item on the next page | [optional] + **limit** | **int**| Items shown per page | [optional] ### Return type -[**\Pipedrive\versions\v1\Model\GetDeal**](../Model/GetDeal.md) +[**\Pipedrive\versions\v1\Model\ChangelogResponse**](../Model/ChangelogResponse.md) ### Authorization @@ -941,15 +668,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `getDealActivities()` +## `getDealFiles()` ```php -getDealActivities($id, $start, $limit, $done, $exclude): \Pipedrive\versions\v1\Model\DealListActivitiesResponse +getDealFiles($id, $start, $limit, $sort): \Pipedrive\versions\v1\Model\ListFilesResponse ``` -List activities associated with a deal +List files attached to a deal -Lists activities associated with a deal.
This endpoint has been deprecated. Please use GET /api/v2/activities?deal_id={id} instead. +Lists files associated with a deal. ### Example @@ -975,15 +702,14 @@ $apiInstance = new Pipedrive\versions\v1\Api\DealsApi( ); $id = 56; // int | The ID of the deal $start = 0; // int | Pagination start -$limit = 56; // int | Items shown per page -$done = new \Pipedrive\versions\v1\Model\\Pipedrive\versions\v1\Model\NumberBoolean(); // \Pipedrive\versions\v1\Model\NumberBoolean | Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted, returns both Done and Not done activities. -$exclude = 'exclude_example'; // string | A comma-separated string of activity IDs to exclude from result +$limit = 56; // int | Items shown per page. Please note that a maximum value of 100 is allowed. +$sort = 'sort_example'; // string | Supported fields: `id`, `update_time` try { - $result = $apiInstance->getDealActivities($id, $start, $limit, $done, $exclude); + $result = $apiInstance->getDealFiles($id, $start, $limit, $sort); print_r($result); } catch (Exception $e) { - echo 'Exception when calling DealsApi->getDealActivities: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling DealsApi->getDealFiles: ', $e->getMessage(), PHP_EOL; } ``` @@ -993,13 +719,12 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **int**| The ID of the deal | **start** | **int**| Pagination start | [optional] [default to 0] - **limit** | **int**| Items shown per page | [optional] - **done** | [**\Pipedrive\versions\v1\Model\NumberBoolean**](../Model/.md)| Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted, returns both Done and Not done activities. | [optional] - **exclude** | **string**| A comma-separated string of activity IDs to exclude from result | [optional] + **limit** | **int**| Items shown per page. Please note that a maximum value of 100 is allowed. | [optional] + **sort** | **string**| Supported fields: `id`, `update_time` | [optional] ### Return type -[**\Pipedrive\versions\v1\Model\DealListActivitiesResponse**](../Model/DealListActivitiesResponse.md) +[**\Pipedrive\versions\v1\Model\ListFilesResponse**](../Model/ListFilesResponse.md) ### Authorization @@ -1014,147 +739,7 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `getDealChangelog()` - -```php -getDealChangelog($id, $cursor, $limit): \Pipedrive\versions\v1\Model\ChangelogResponse -``` - -List updates about deal field values - -Lists updates about field values of a deal. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\DealsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$id = 56; // int | The ID of the deal -$cursor = 'cursor_example'; // string | For pagination, the marker (an opaque string value) representing the first item on the next page -$limit = 56; // int | Items shown per page - -try { - $result = $apiInstance->getDealChangelog($id, $cursor, $limit); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling DealsApi->getDealChangelog: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the deal | - **cursor** | **string**| For pagination, the marker (an opaque string value) representing the first item on the next page | [optional] - **limit** | **int**| Items shown per page | [optional] - -### Return type - -[**\Pipedrive\versions\v1\Model\ChangelogResponse**](../Model/ChangelogResponse.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -## `getDealFiles()` - -```php -getDealFiles($id, $start, $limit, $sort): \Pipedrive\versions\v1\Model\ListFilesResponse -``` - -List files attached to a deal - -Lists files associated with a deal. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\DealsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$id = 56; // int | The ID of the deal -$start = 0; // int | Pagination start -$limit = 56; // int | Items shown per page. Please note that a maximum value of 100 is allowed. -$sort = 'sort_example'; // string | Supported fields: `id`, `update_time` - -try { - $result = $apiInstance->getDealFiles($id, $start, $limit, $sort); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling DealsApi->getDealFiles: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the deal | - **start** | **int**| Pagination start | [optional] [default to 0] - **limit** | **int**| Items shown per page. Please note that a maximum value of 100 is allowed. | [optional] - **sort** | **string**| Supported fields: `id`, `update_time` | [optional] - -### Return type - -[**\Pipedrive\versions\v1\Model\ListFilesResponse**](../Model/ListFilesResponse.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -## `getDealFollowers()` +## `getDealFollowers()` ```php getDealFollowers($id): \Pipedrive\versions\v1\Model\ListFollowersResponse @@ -1426,15 +1011,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `getDealPersons()` +## `getDealUpdates()` ```php -getDealPersons($id, $start, $limit): \Pipedrive\versions\v1\Model\ListPersonsResponse +getDealUpdates($id, $start, $limit, $all_changes, $items): \Pipedrive\versions\v1\Model\DealFlowResponse ``` -List all persons associated with a deal +List updates about a deal -Lists all persons associated with a deal, regardless of whether the person is the primary contact of the deal, or added as a participant.
If a company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also return the `data.marketing_status` field.
This endpoint has been deprecated. Please use GET /api/v2/persons?deal_id={id} instead. +Lists updates about a deal. ### Example @@ -1461,12 +1046,14 @@ $apiInstance = new Pipedrive\versions\v1\Api\DealsApi( $id = 56; // int | The ID of the deal $start = 0; // int | Pagination start $limit = 56; // int | Items shown per page +$all_changes = 'all_changes_example'; // string | Whether to show custom field updates or not. 1 = Include custom field changes. If omitted returns changes without custom field updates. +$items = 'items_example'; // string | A comma-separated string for filtering out item specific updates. (Possible values - call, activity, plannedActivity, change, note, deal, file, dealChange, personChange, organizationChange, follower, dealFollower, personFollower, organizationFollower, participant, comment, mailMessage, mailMessageWithAttachment, invoice, document, marketing_campaign_stat, marketing_status_change). try { - $result = $apiInstance->getDealPersons($id, $start, $limit); + $result = $apiInstance->getDealUpdates($id, $start, $limit, $all_changes, $items); print_r($result); } catch (Exception $e) { - echo 'Exception when calling DealsApi->getDealPersons: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling DealsApi->getDealUpdates: ', $e->getMessage(), PHP_EOL; } ``` @@ -1477,10 +1064,12 @@ Name | Type | Description | Notes **id** | **int**| The ID of the deal | **start** | **int**| Pagination start | [optional] [default to 0] **limit** | **int**| Items shown per page | [optional] + **all_changes** | **string**| Whether to show custom field updates or not. 1 = Include custom field changes. If omitted returns changes without custom field updates. | [optional] + **items** | **string**| A comma-separated string for filtering out item specific updates. (Possible values - call, activity, plannedActivity, change, note, deal, file, dealChange, personChange, organizationChange, follower, dealFollower, personFollower, organizationFollower, participant, comment, mailMessage, mailMessageWithAttachment, invoice, document, marketing_campaign_stat, marketing_status_change). | [optional] ### Return type -[**\Pipedrive\versions\v1\Model\ListPersonsResponse**](../Model/ListPersonsResponse.md) +[**\Pipedrive\versions\v1\Model\DealFlowResponse**](../Model/DealFlowResponse.md) ### Authorization @@ -1495,15 +1084,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `getDealProducts()` +## `getDealUsers()` ```php -getDealProducts($id, $start, $limit, $include_product_data): \Pipedrive\versions\v1\Model\ListProductsResponse +getDealUsers($id): \Pipedrive\versions\v1\Model\ListPermittedUsersResponse ``` -List products attached to a deal +List permitted users -Lists products attached to a deal. +Lists the users permitted to access a deal. ### Example @@ -1528,15 +1117,12 @@ $apiInstance = new Pipedrive\versions\v1\Api\DealsApi( $config ); $id = 56; // int | The ID of the deal -$start = 0; // int | Pagination start -$limit = 56; // int | Items shown per page -$include_product_data = new \Pipedrive\versions\v1\Model\\Pipedrive\versions\v1\Model\NumberBoolean(); // \Pipedrive\versions\v1\Model\NumberBoolean | Whether to fetch product data along with each attached product (1) or not (0, default) try { - $result = $apiInstance->getDealProducts($id, $start, $limit, $include_product_data); + $result = $apiInstance->getDealUsers($id); print_r($result); } catch (Exception $e) { - echo 'Exception when calling DealsApi->getDealProducts: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling DealsApi->getDealUsers: ', $e->getMessage(), PHP_EOL; } ``` @@ -1545,13 +1131,10 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **int**| The ID of the deal | - **start** | **int**| Pagination start | [optional] [default to 0] - **limit** | **int**| Items shown per page | [optional] - **include_product_data** | [**\Pipedrive\versions\v1\Model\NumberBoolean**](../Model/.md)| Whether to fetch product data along with each attached product (1) or not (0, default) | [optional] ### Return type -[**\Pipedrive\versions\v1\Model\ListProductsResponse**](../Model/ListProductsResponse.md) +[**\Pipedrive\versions\v1\Model\ListPermittedUsersResponse**](../Model/ListPermittedUsersResponse.md) ### Authorization @@ -1566,15 +1149,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `getDealUpdates()` +## `getDealsSummary()` ```php -getDealUpdates($id, $start, $limit, $all_changes, $items): \Pipedrive\versions\v1\Model\DealFlowResponse +getDealsSummary($status, $filter_id, $user_id, $pipeline_id, $stage_id): \Pipedrive\versions\v1\Model\GetDealsSummary ``` -List updates about a deal +Get deals summary -Lists updates about a deal. +Returns a summary of all not archived deals. ### Example @@ -1598,17 +1181,17 @@ $apiInstance = new Pipedrive\versions\v1\Api\DealsApi( new GuzzleHttp\Client(), $config ); -$id = 56; // int | The ID of the deal -$start = 0; // int | Pagination start -$limit = 56; // int | Items shown per page -$all_changes = 'all_changes_example'; // string | Whether to show custom field updates or not. 1 = Include custom field changes. If omitted returns changes without custom field updates. -$items = 'items_example'; // string | A comma-separated string for filtering out item specific updates. (Possible values - call, activity, plannedActivity, change, note, deal, file, dealChange, personChange, organizationChange, follower, dealFollower, personFollower, organizationFollower, participant, comment, mailMessage, mailMessageWithAttachment, invoice, document, marketing_campaign_stat, marketing_status_change). +$status = 'status_example'; // string | Only fetch deals with a specific status. open = Open, won = Won, lost = Lost. +$filter_id = 56; // int | user_id will not be considered. Only deals matching the given filter will be returned. +$user_id = 56; // int | Only deals matching the given user will be returned. `user_id` will not be considered if you use `filter_id`. +$pipeline_id = 56; // int | Only deals within the given pipeline will be returned +$stage_id = 56; // int | Only deals within the given stage will be returned try { - $result = $apiInstance->getDealUpdates($id, $start, $limit, $all_changes, $items); + $result = $apiInstance->getDealsSummary($status, $filter_id, $user_id, $pipeline_id, $stage_id); print_r($result); } catch (Exception $e) { - echo 'Exception when calling DealsApi->getDealUpdates: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling DealsApi->getDealsSummary: ', $e->getMessage(), PHP_EOL; } ``` @@ -1616,15 +1199,15 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the deal | - **start** | **int**| Pagination start | [optional] [default to 0] - **limit** | **int**| Items shown per page | [optional] - **all_changes** | **string**| Whether to show custom field updates or not. 1 = Include custom field changes. If omitted returns changes without custom field updates. | [optional] - **items** | **string**| A comma-separated string for filtering out item specific updates. (Possible values - call, activity, plannedActivity, change, note, deal, file, dealChange, personChange, organizationChange, follower, dealFollower, personFollower, organizationFollower, participant, comment, mailMessage, mailMessageWithAttachment, invoice, document, marketing_campaign_stat, marketing_status_change). | [optional] + **status** | **string**| Only fetch deals with a specific status. open = Open, won = Won, lost = Lost. | [optional] + **filter_id** | **int**| <code>user_id</code> will not be considered. Only deals matching the given filter will be returned. | [optional] + **user_id** | **int**| Only deals matching the given user will be returned. `user_id` will not be considered if you use `filter_id`. | [optional] + **pipeline_id** | **int**| Only deals within the given pipeline will be returned | [optional] + **stage_id** | **int**| Only deals within the given stage will be returned | [optional] ### Return type -[**\Pipedrive\versions\v1\Model\DealFlowResponse**](../Model/DealFlowResponse.md) +[**\Pipedrive\versions\v1\Model\GetDealsSummary**](../Model/GetDealsSummary.md) ### Authorization @@ -1639,15 +1222,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `getDealUsers()` +## `getDealsTimeline()` ```php -getDealUsers($id): \Pipedrive\versions\v1\Model\ListPermittedUsersResponse +getDealsTimeline($start_date, $interval, $amount, $field_key, $user_id, $pipeline_id, $filter_id, $exclude_deals, $totals_convert_currency): \Pipedrive\versions\v1\Model\GetDealsTimeline ``` -List permitted users +Get deals timeline -Lists the users permitted to access a deal. +Returns not archived open and won deals, grouped by a defined interval of time set in a date-type dealField (`field_key`) — e.g. when month is the chosen interval, and 3 months are asked starting from January 1st, 2012, deals are returned grouped into 3 groups — January, February and March — based on the value of the given `field_key`. ### Example @@ -1671,13 +1254,21 @@ $apiInstance = new Pipedrive\versions\v1\Api\DealsApi( new GuzzleHttp\Client(), $config ); -$id = 56; // int | The ID of the deal +$start_date = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | The date when the first interval starts. Format: YYYY-MM-DD. +$interval = 'interval_example'; // string | The type of the interval
ValueDescription
`day`Day
`week`A full week (7 days) starting from `start_date`
`month`A full month (depending on the number of days in given month) starting from `start_date`
`quarter`A full quarter (3 months) starting from `start_date`
+$amount = 56; // int | The number of given intervals, starting from `start_date`, to fetch. E.g. 3 (months). +$field_key = 'field_key_example'; // string | The date field key which deals will be retrieved from +$user_id = 56; // int | If supplied, only deals matching the given user will be returned +$pipeline_id = 56; // int | If supplied, only deals matching the given pipeline will be returned +$filter_id = 56; // int | If supplied, only deals matching the given filter will be returned +$exclude_deals = new \Pipedrive\versions\v1\Model\\Pipedrive\versions\v1\Model\NumberBoolean(); // \Pipedrive\versions\v1\Model\NumberBoolean | Whether to exclude deals list (1) or not (0). Note that when deals are excluded, the timeline summary (counts and values) is still returned. +$totals_convert_currency = 'totals_convert_currency_example'; // string | The 3-letter currency code of any of the supported currencies. When supplied, `totals_converted` is returned per each interval which contains the currency-converted total amounts in the given currency. You may also set this parameter to `default_currency` in which case the user's default currency is used. try { - $result = $apiInstance->getDealUsers($id); + $result = $apiInstance->getDealsTimeline($start_date, $interval, $amount, $field_key, $user_id, $pipeline_id, $filter_id, $exclude_deals, $totals_convert_currency); print_r($result); } catch (Exception $e) { - echo 'Exception when calling DealsApi->getDealUsers: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling DealsApi->getDealsTimeline: ', $e->getMessage(), PHP_EOL; } ``` @@ -1685,11 +1276,19 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the deal | + **start_date** | **\DateTime**| The date when the first interval starts. Format: YYYY-MM-DD. | + **interval** | **string**| The type of the interval<table><tr><th>Value</th><th>Description</th></tr><tr><td>`day`</td><td>Day</td></tr><tr><td>`week`</td><td>A full week (7 days) starting from `start_date`</td></tr><tr><td>`month`</td><td>A full month (depending on the number of days in given month) starting from `start_date`</td></tr><tr><td>`quarter`</td><td>A full quarter (3 months) starting from `start_date`</td></tr></table> | + **amount** | **int**| The number of given intervals, starting from `start_date`, to fetch. E.g. 3 (months). | + **field_key** | **string**| The date field key which deals will be retrieved from | + **user_id** | **int**| If supplied, only deals matching the given user will be returned | [optional] + **pipeline_id** | **int**| If supplied, only deals matching the given pipeline will be returned | [optional] + **filter_id** | **int**| If supplied, only deals matching the given filter will be returned | [optional] + **exclude_deals** | [**\Pipedrive\versions\v1\Model\NumberBoolean**](../Model/.md)| Whether to exclude deals list (1) or not (0). Note that when deals are excluded, the timeline summary (counts and values) is still returned. | [optional] + **totals_convert_currency** | **string**| The 3-letter currency code of any of the supported currencies. When supplied, `totals_converted` is returned per each interval which contains the currency-converted total amounts in the given currency. You may also set this parameter to `default_currency` in which case the user's default currency is used. | [optional] ### Return type -[**\Pipedrive\versions\v1\Model\ListPermittedUsersResponse**](../Model/ListPermittedUsersResponse.md) +[**\Pipedrive\versions\v1\Model\GetDealsTimeline**](../Model/GetDealsTimeline.md) ### Authorization @@ -1704,15 +1303,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `getDeals()` +## `mergeDeals()` ```php -getDeals($user_id, $filter_id, $stage_id, $status, $start, $limit, $sort, $owned_by_you): \Pipedrive\versions\v1\Model\GetDeals +mergeDeals($id, $merge_deals_request): \Pipedrive\versions\v1\Model\GetMergedDeal ``` -Get all deals +Merge two deals -Returns all not archived deals. For more information, see the tutorial for getting all deals. +Merges a deal with another deal. For more information, see the tutorial for merging two deals. ### Example @@ -1736,20 +1335,14 @@ $apiInstance = new Pipedrive\versions\v1\Api\DealsApi( new GuzzleHttp\Client(), $config ); -$user_id = 56; // int | If supplied, only deals matching the given user will be returned. However, `filter_id` and `owned_by_you` takes precedence over `user_id` when supplied. -$filter_id = 56; // int | The ID of the filter to use -$stage_id = 56; // int | If supplied, only deals within the given stage will be returned -$status = 'all_not_deleted'; // string | Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. -$start = 0; // int | Pagination start -$limit = 56; // int | Items shown per page -$sort = 'sort_example'; // string | The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). -$owned_by_you = new \Pipedrive\versions\v1\Model\\Pipedrive\versions\v1\Model\NumberBoolean(); // \Pipedrive\versions\v1\Model\NumberBoolean | When supplied, only deals owned by you are returned. However, `filter_id` takes precedence over `owned_by_you` when both are supplied. +$id = 56; // int | The ID of the deal +$merge_deals_request = new \Pipedrive\versions\v1\Model\MergeDealsRequest(); // \Pipedrive\versions\v1\Model\MergeDealsRequest try { - $result = $apiInstance->getDeals($user_id, $filter_id, $stage_id, $status, $start, $limit, $sort, $owned_by_you); + $result = $apiInstance->mergeDeals($id, $merge_deals_request); print_r($result); } catch (Exception $e) { - echo 'Exception when calling DealsApi->getDeals: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling DealsApi->mergeDeals: ', $e->getMessage(), PHP_EOL; } ``` @@ -1757,312 +1350,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **user_id** | **int**| If supplied, only deals matching the given user will be returned. However, `filter_id` and `owned_by_you` takes precedence over `user_id` when supplied. | [optional] - **filter_id** | **int**| The ID of the filter to use | [optional] - **stage_id** | **int**| If supplied, only deals within the given stage will be returned | [optional] - **status** | **string**| Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. | [optional] [default to 'all_not_deleted'] - **start** | **int**| Pagination start | [optional] [default to 0] - **limit** | **int**| Items shown per page | [optional] - **sort** | **string**| The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). | [optional] - **owned_by_you** | [**\Pipedrive\versions\v1\Model\NumberBoolean**](../Model/.md)| When supplied, only deals owned by you are returned. However, `filter_id` takes precedence over `owned_by_you` when both are supplied. | [optional] - -### Return type - -[**\Pipedrive\versions\v1\Model\GetDeals**](../Model/GetDeals.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -## `getDealsCollection()` - -```php -getDealsCollection($cursor, $limit, $since, $until, $user_id, $stage_id, $status): \Pipedrive\versions\v1\Model\GetDealsCollection -``` - -Get all deals collection - -Returns all deals. Please note that only global admins (those with global permissions) can access this endpoint. Users with regular permissions will receive a 403 response. Read more about global permissions here.
This endpoint has been deprecated. Please use GET /api/v2/deals instead. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\DealsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$cursor = 'cursor_example'; // string | For pagination, the marker (an opaque string value) representing the first item on the next page -$limit = 100; // int | For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. -$since = 'since_example'; // string | The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. -$until = 'until_example'; // string | The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. -$user_id = 56; // int | If supplied, only deals matching the given user will be returned -$stage_id = 56; // int | If supplied, only deals within the given stage will be returned -$status = 'status_example'; // string | Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. - -try { - $result = $apiInstance->getDealsCollection($cursor, $limit, $since, $until, $user_id, $stage_id, $status); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling DealsApi->getDealsCollection: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **cursor** | **string**| For pagination, the marker (an opaque string value) representing the first item on the next page | [optional] - **limit** | **int**| For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. | [optional] - **since** | **string**| The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. | [optional] - **until** | **string**| The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. | [optional] - **user_id** | **int**| If supplied, only deals matching the given user will be returned | [optional] - **stage_id** | **int**| If supplied, only deals within the given stage will be returned | [optional] - **status** | **string**| Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. | [optional] - -### Return type - -[**\Pipedrive\versions\v1\Model\GetDealsCollection**](../Model/GetDealsCollection.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -## `getDealsSummary()` - -```php -getDealsSummary($status, $filter_id, $user_id, $pipeline_id, $stage_id): \Pipedrive\versions\v1\Model\GetDealsSummary -``` - -Get deals summary - -Returns a summary of all not archived deals. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\DealsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$status = 'status_example'; // string | Only fetch deals with a specific status. open = Open, won = Won, lost = Lost. -$filter_id = 56; // int | user_id will not be considered. Only deals matching the given filter will be returned. -$user_id = 56; // int | Only deals matching the given user will be returned. `user_id` will not be considered if you use `filter_id`. -$pipeline_id = 56; // int | Only deals within the given pipeline will be returned -$stage_id = 56; // int | Only deals within the given stage will be returned - -try { - $result = $apiInstance->getDealsSummary($status, $filter_id, $user_id, $pipeline_id, $stage_id); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling DealsApi->getDealsSummary: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **status** | **string**| Only fetch deals with a specific status. open = Open, won = Won, lost = Lost. | [optional] - **filter_id** | **int**| <code>user_id</code> will not be considered. Only deals matching the given filter will be returned. | [optional] - **user_id** | **int**| Only deals matching the given user will be returned. `user_id` will not be considered if you use `filter_id`. | [optional] - **pipeline_id** | **int**| Only deals within the given pipeline will be returned | [optional] - **stage_id** | **int**| Only deals within the given stage will be returned | [optional] - -### Return type - -[**\Pipedrive\versions\v1\Model\GetDealsSummary**](../Model/GetDealsSummary.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -## `getDealsTimeline()` - -```php -getDealsTimeline($start_date, $interval, $amount, $field_key, $user_id, $pipeline_id, $filter_id, $exclude_deals, $totals_convert_currency): \Pipedrive\versions\v1\Model\GetDealsTimeline -``` - -Get deals timeline - -Returns not archived open and won deals, grouped by a defined interval of time set in a date-type dealField (`field_key`) — e.g. when month is the chosen interval, and 3 months are asked starting from January 1st, 2012, deals are returned grouped into 3 groups — January, February and March — based on the value of the given `field_key`. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\DealsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$start_date = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | The date when the first interval starts. Format: YYYY-MM-DD. -$interval = 'interval_example'; // string | The type of the interval
ValueDescription
`day`Day
`week`A full week (7 days) starting from `start_date`
`month`A full month (depending on the number of days in given month) starting from `start_date`
`quarter`A full quarter (3 months) starting from `start_date`
-$amount = 56; // int | The number of given intervals, starting from `start_date`, to fetch. E.g. 3 (months). -$field_key = 'field_key_example'; // string | The date field key which deals will be retrieved from -$user_id = 56; // int | If supplied, only deals matching the given user will be returned -$pipeline_id = 56; // int | If supplied, only deals matching the given pipeline will be returned -$filter_id = 56; // int | If supplied, only deals matching the given filter will be returned -$exclude_deals = new \Pipedrive\versions\v1\Model\\Pipedrive\versions\v1\Model\NumberBoolean(); // \Pipedrive\versions\v1\Model\NumberBoolean | Whether to exclude deals list (1) or not (0). Note that when deals are excluded, the timeline summary (counts and values) is still returned. -$totals_convert_currency = 'totals_convert_currency_example'; // string | The 3-letter currency code of any of the supported currencies. When supplied, `totals_converted` is returned per each interval which contains the currency-converted total amounts in the given currency. You may also set this parameter to `default_currency` in which case the user's default currency is used. - -try { - $result = $apiInstance->getDealsTimeline($start_date, $interval, $amount, $field_key, $user_id, $pipeline_id, $filter_id, $exclude_deals, $totals_convert_currency); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling DealsApi->getDealsTimeline: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **start_date** | **\DateTime**| The date when the first interval starts. Format: YYYY-MM-DD. | - **interval** | **string**| The type of the interval<table><tr><th>Value</th><th>Description</th></tr><tr><td>`day`</td><td>Day</td></tr><tr><td>`week`</td><td>A full week (7 days) starting from `start_date`</td></tr><tr><td>`month`</td><td>A full month (depending on the number of days in given month) starting from `start_date`</td></tr><tr><td>`quarter`</td><td>A full quarter (3 months) starting from `start_date`</td></tr></table> | - **amount** | **int**| The number of given intervals, starting from `start_date`, to fetch. E.g. 3 (months). | - **field_key** | **string**| The date field key which deals will be retrieved from | - **user_id** | **int**| If supplied, only deals matching the given user will be returned | [optional] - **pipeline_id** | **int**| If supplied, only deals matching the given pipeline will be returned | [optional] - **filter_id** | **int**| If supplied, only deals matching the given filter will be returned | [optional] - **exclude_deals** | [**\Pipedrive\versions\v1\Model\NumberBoolean**](../Model/.md)| Whether to exclude deals list (1) or not (0). Note that when deals are excluded, the timeline summary (counts and values) is still returned. | [optional] - **totals_convert_currency** | **string**| The 3-letter currency code of any of the supported currencies. When supplied, `totals_converted` is returned per each interval which contains the currency-converted total amounts in the given currency. You may also set this parameter to `default_currency` in which case the user's default currency is used. | [optional] - -### Return type - -[**\Pipedrive\versions\v1\Model\GetDealsTimeline**](../Model/GetDealsTimeline.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -## `mergeDeals()` - -```php -mergeDeals($id, $merge_deals_request): \Pipedrive\versions\v1\Model\GetMergedDeal -``` - -Merge two deals - -Merges a deal with another deal. For more information, see the tutorial for merging two deals. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\DealsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$id = 56; // int | The ID of the deal -$merge_deals_request = new \Pipedrive\versions\v1\Model\MergeDealsRequest(); // \Pipedrive\versions\v1\Model\MergeDealsRequest - -try { - $result = $apiInstance->mergeDeals($id, $merge_deals_request); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling DealsApi->mergeDeals: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the deal | - **merge_deals_request** | [**\Pipedrive\versions\v1\Model\MergeDealsRequest**](../Model/MergeDealsRequest.md)| | [optional] + **id** | **int**| The ID of the deal | + **merge_deals_request** | [**\Pipedrive\versions\v1\Model\MergeDealsRequest**](../Model/MergeDealsRequest.md)| | [optional] ### Return type @@ -2080,220 +1369,3 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -## `searchDeals()` - -```php -searchDeals($term, $fields, $exact_match, $person_id, $organization_id, $status, $include_fields, $start, $limit): \Pipedrive\versions\v1\Model\DealSearchResponse -``` - -Search deals - -Searches all deals by title, notes and/or custom fields. This endpoint is a wrapper of /v1/itemSearch with a narrower OAuth scope. Found deals can be filtered by the person ID and the organization ID. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\DealsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$term = 'term_example'; // string | The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded. -$fields = 'fields_example'; // string | A comma-separated string array. The fields to perform the search from. Defaults to all of them. Only the following custom field types are searchable: `address`, `varchar`, `text`, `varchar_auto`, `double`, `monetary` and `phone`. Read more about searching by custom fields here. -$exact_match = True; // bool | When enabled, only full exact matches against the given term are returned. It is not case sensitive. -$person_id = 56; // int | Will filter deals by the provided person ID. The upper limit of found deals associated with the person is 2000. -$organization_id = 56; // int | Will filter deals by the provided organization ID. The upper limit of found deals associated with the organization is 2000. -$status = 'status_example'; // string | Will filter deals by the provided specific status. open = Open, won = Won, lost = Lost. The upper limit of found deals associated with the status is 2000. -$include_fields = 'include_fields_example'; // string | Supports including optional fields in the results which are not provided by default -$start = 0; // int | Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter. -$limit = 56; // int | Items shown per page - -try { - $result = $apiInstance->searchDeals($term, $fields, $exact_match, $person_id, $organization_id, $status, $include_fields, $start, $limit); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling DealsApi->searchDeals: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **term** | **string**| The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded. | - **fields** | **string**| A comma-separated string array. The fields to perform the search from. Defaults to all of them. Only the following custom field types are searchable: `address`, `varchar`, `text`, `varchar_auto`, `double`, `monetary` and `phone`. Read more about searching by custom fields <a href=\"https://support.pipedrive.com/en/article/search-finding-what-you-need#searching-by-custom-fields\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>. | [optional] - **exact_match** | **bool**| When enabled, only full exact matches against the given term are returned. It is <b>not</b> case sensitive. | [optional] - **person_id** | **int**| Will filter deals by the provided person ID. The upper limit of found deals associated with the person is 2000. | [optional] - **organization_id** | **int**| Will filter deals by the provided organization ID. The upper limit of found deals associated with the organization is 2000. | [optional] - **status** | **string**| Will filter deals by the provided specific status. open = Open, won = Won, lost = Lost. The upper limit of found deals associated with the status is 2000. | [optional] - **include_fields** | **string**| Supports including optional fields in the results which are not provided by default | [optional] - **start** | **int**| Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter. | [optional] [default to 0] - **limit** | **int**| Items shown per page | [optional] - -### Return type - -[**\Pipedrive\versions\v1\Model\DealSearchResponse**](../Model/DealSearchResponse.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -## `updateDeal()` - -```php -updateDeal($id, $update_deal_request): \Pipedrive\versions\v1\Model\GetAddedDeal -``` - -Update a deal - -Updates the properties of a deal. For more information, see the tutorial for updating a deal. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\DealsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$id = 56; // int | The ID of the deal -$update_deal_request = new \Pipedrive\versions\v1\Model\UpdateDealRequest(); // \Pipedrive\versions\v1\Model\UpdateDealRequest - -try { - $result = $apiInstance->updateDeal($id, $update_deal_request); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling DealsApi->updateDeal: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the deal | - **update_deal_request** | [**\Pipedrive\versions\v1\Model\UpdateDealRequest**](../Model/UpdateDealRequest.md)| | [optional] - -### Return type - -[**\Pipedrive\versions\v1\Model\GetAddedDeal**](../Model/GetAddedDeal.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: `application/json` -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -## `updateDealProduct()` - -```php -updateDealProduct($id, $product_attachment_id, $update_deal_product): \Pipedrive\versions\v1\Model\GetProductAttachmentDetails -``` - -Update the product attached to a deal - -Updates the details of the product that has been attached to a deal. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\DealsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$id = 56; // int | The ID of the deal -$product_attachment_id = 56; // int | The ID of the deal-product (the ID of the product attached to the deal) -$update_deal_product = new \Pipedrive\versions\v1\Model\UpdateDealProduct(); // \Pipedrive\versions\v1\Model\UpdateDealProduct - -try { - $result = $apiInstance->updateDealProduct($id, $product_attachment_id, $update_deal_product); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling DealsApi->updateDealProduct: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the deal | - **product_attachment_id** | **int**| The ID of the deal-product (the ID of the product attached to the deal) | - **update_deal_product** | [**\Pipedrive\versions\v1\Model\UpdateDealProduct**](../Model/UpdateDealProduct.md)| | [optional] - -### Return type - -[**\Pipedrive\versions\v1\Model\GetProductAttachmentDetails**](../Model/GetProductAttachmentDetails.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: `application/json` -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) diff --git a/docs/versions/v1/Api/OrganizationsApi.md b/docs/versions/v1/Api/OrganizationsApi.md index aea38ff3..5d44b77d 100644 --- a/docs/versions/v1/Api/OrganizationsApi.md +++ b/docs/versions/v1/Api/OrganizationsApi.md @@ -4,92 +4,17 @@ All URIs are relative to https://api.pipedrive.com/v1. Method | HTTP request | Description ------------- | ------------- | ------------- -[**addOrganization()**](OrganizationsApi.md#addOrganization) | **POST** /organizations | Add an organization [**addOrganizationFollower()**](OrganizationsApi.md#addOrganizationFollower) | **POST** /organizations/{id}/followers | Add a follower to an organization -[**deleteOrganization()**](OrganizationsApi.md#deleteOrganization) | **DELETE** /organizations/{id} | Delete an organization [**deleteOrganizationFollower()**](OrganizationsApi.md#deleteOrganizationFollower) | **DELETE** /organizations/{id}/followers/{follower_id} | Delete a follower from an organization -[**getOrganization()**](OrganizationsApi.md#getOrganization) | **GET** /organizations/{id} | Get details of an organization -[**getOrganizationActivities()**](OrganizationsApi.md#getOrganizationActivities) | **GET** /organizations/{id}/activities | List activities associated with an organization [**getOrganizationChangelog()**](OrganizationsApi.md#getOrganizationChangelog) | **GET** /organizations/{id}/changelog | List updates about organization field values -[**getOrganizationDeals()**](OrganizationsApi.md#getOrganizationDeals) | **GET** /organizations/{id}/deals | List deals associated with an organization [**getOrganizationFiles()**](OrganizationsApi.md#getOrganizationFiles) | **GET** /organizations/{id}/files | List files attached to an organization [**getOrganizationFollowers()**](OrganizationsApi.md#getOrganizationFollowers) | **GET** /organizations/{id}/followers | List followers of an organization [**getOrganizationMailMessages()**](OrganizationsApi.md#getOrganizationMailMessages) | **GET** /organizations/{id}/mailMessages | List mail messages associated with an organization -[**getOrganizationPersons()**](OrganizationsApi.md#getOrganizationPersons) | **GET** /organizations/{id}/persons | List persons of an organization [**getOrganizationUpdates()**](OrganizationsApi.md#getOrganizationUpdates) | **GET** /organizations/{id}/flow | List updates about an organization [**getOrganizationUsers()**](OrganizationsApi.md#getOrganizationUsers) | **GET** /organizations/{id}/permittedUsers | List permitted users -[**getOrganizations()**](OrganizationsApi.md#getOrganizations) | **GET** /organizations | Get all organizations -[**getOrganizationsCollection()**](OrganizationsApi.md#getOrganizationsCollection) | **GET** /organizations/collection | Get all organizations collection [**mergeOrganizations()**](OrganizationsApi.md#mergeOrganizations) | **PUT** /organizations/{id}/merge | Merge two organizations -[**searchOrganization()**](OrganizationsApi.md#searchOrganization) | **GET** /organizations/search | Search organizations -[**updateOrganization()**](OrganizationsApi.md#updateOrganization) | **PUT** /organizations/{id} | Update an organization -## `addOrganization()` - -```php -addOrganization($new_organization): \Pipedrive\versions\v1\Model\OrganizationPostResponse -``` - -Add an organization - -Adds a new organization. Note that you can supply additional custom fields along with the request that are not described here. These custom fields are different for each Pipedrive account and can be recognized by long hashes as keys. To determine which custom fields exists, fetch the organizationFields and look for `key` values. For more information, see the tutorial for adding an organization. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\OrganizationsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$new_organization = new \Pipedrive\versions\v1\Model\NewOrganization(); // \Pipedrive\versions\v1\Model\NewOrganization - -try { - $result = $apiInstance->addOrganization($new_organization); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling OrganizationsApi->addOrganization: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **new_organization** | [**\Pipedrive\versions\v1\Model\NewOrganization**](../Model/NewOrganization.md)| | [optional] - -### Return type - -[**\Pipedrive\versions\v1\Model\OrganizationPostResponse**](../Model/OrganizationPostResponse.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: `application/json` -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - ## `addOrganizationFollower()` ```php @@ -157,71 +82,6 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `deleteOrganization()` - -```php -deleteOrganization($id): \Pipedrive\versions\v1\Model\OrganizationDeleteResponse -``` - -Delete an organization - -Marks an organization as deleted. After 30 days, the organization will be permanently deleted. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\OrganizationsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$id = 56; // int | The ID of the organization - -try { - $result = $apiInstance->deleteOrganization($id); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling OrganizationsApi->deleteOrganization: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the organization | - -### Return type - -[**\Pipedrive\versions\v1\Model\OrganizationDeleteResponse**](../Model/OrganizationDeleteResponse.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - ## `deleteOrganizationFollower()` ```php @@ -289,15 +149,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `getOrganization()` +## `getOrganizationChangelog()` ```php -getOrganization($id): \Pipedrive\versions\v1\Model\OrganizationDetailsGetResponse +getOrganizationChangelog($id, $cursor, $limit): \Pipedrive\versions\v1\Model\ChangelogResponse ``` -Get details of an organization +List updates about organization field values -Returns the details of an organization. Note that this also returns some additional fields which are not present when asking for all organizations. Also note that custom fields appear as long hashes in the resulting data. These hashes can be mapped against the `key` value of organizationFields. +Lists updates about field values of an organization. ### Example @@ -322,12 +182,14 @@ $apiInstance = new Pipedrive\versions\v1\Api\OrganizationsApi( $config ); $id = 56; // int | The ID of the organization +$cursor = 'cursor_example'; // string | For pagination, the marker (an opaque string value) representing the first item on the next page +$limit = 56; // int | Items shown per page try { - $result = $apiInstance->getOrganization($id); + $result = $apiInstance->getOrganizationChangelog($id, $cursor, $limit); print_r($result); } catch (Exception $e) { - echo 'Exception when calling OrganizationsApi->getOrganization: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling OrganizationsApi->getOrganizationChangelog: ', $e->getMessage(), PHP_EOL; } ``` @@ -336,10 +198,12 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **int**| The ID of the organization | + **cursor** | **string**| For pagination, the marker (an opaque string value) representing the first item on the next page | [optional] + **limit** | **int**| Items shown per page | [optional] ### Return type -[**\Pipedrive\versions\v1\Model\OrganizationDetailsGetResponse**](../Model/OrganizationDetailsGetResponse.md) +[**\Pipedrive\versions\v1\Model\ChangelogResponse**](../Model/ChangelogResponse.md) ### Authorization @@ -354,15 +218,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `getOrganizationActivities()` +## `getOrganizationFiles()` ```php -getOrganizationActivities($id, $start, $limit, $done, $exclude): \Pipedrive\versions\v1\Model\ListActivitiesResponse +getOrganizationFiles($id, $start, $limit, $sort): \Pipedrive\versions\v1\Model\ListFilesResponse ``` -List activities associated with an organization +List files attached to an organization -Lists activities associated with an organization.
This endpoint has been deprecated. Please use GET /api/v2/activities?org_id={id} instead. +Lists files associated with an organization. ### Example @@ -388,15 +252,14 @@ $apiInstance = new Pipedrive\versions\v1\Api\OrganizationsApi( ); $id = 56; // int | The ID of the organization $start = 0; // int | Pagination start -$limit = 56; // int | Items shown per page -$done = new \Pipedrive\versions\v1\Model\\Pipedrive\versions\v1\Model\NumberBoolean(); // \Pipedrive\versions\v1\Model\NumberBoolean | Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted returns both Done and Not done activities. -$exclude = 'exclude_example'; // string | A comma-separated string of activity IDs to exclude from result +$limit = 56; // int | Items shown per page. Please note that a maximum value of 100 is allowed. +$sort = 'sort_example'; // string | Supported fields: `id`, `update_time` try { - $result = $apiInstance->getOrganizationActivities($id, $start, $limit, $done, $exclude); + $result = $apiInstance->getOrganizationFiles($id, $start, $limit, $sort); print_r($result); } catch (Exception $e) { - echo 'Exception when calling OrganizationsApi->getOrganizationActivities: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling OrganizationsApi->getOrganizationFiles: ', $e->getMessage(), PHP_EOL; } ``` @@ -406,13 +269,12 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **int**| The ID of the organization | **start** | **int**| Pagination start | [optional] [default to 0] - **limit** | **int**| Items shown per page | [optional] - **done** | [**\Pipedrive\versions\v1\Model\NumberBoolean**](../Model/.md)| Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted returns both Done and Not done activities. | [optional] - **exclude** | **string**| A comma-separated string of activity IDs to exclude from result | [optional] + **limit** | **int**| Items shown per page. Please note that a maximum value of 100 is allowed. | [optional] + **sort** | **string**| Supported fields: `id`, `update_time` | [optional] ### Return type -[**\Pipedrive\versions\v1\Model\ListActivitiesResponse**](../Model/ListActivitiesResponse.md) +[**\Pipedrive\versions\v1\Model\ListFilesResponse**](../Model/ListFilesResponse.md) ### Authorization @@ -427,15 +289,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `getOrganizationChangelog()` +## `getOrganizationFollowers()` ```php -getOrganizationChangelog($id, $cursor, $limit): \Pipedrive\versions\v1\Model\ChangelogResponse +getOrganizationFollowers($id): \Pipedrive\versions\v1\Model\OrganizationFollowersListResponse ``` -List updates about organization field values +List followers of an organization -Lists updates about field values of an organization. +Lists the followers of an organization. ### Example @@ -460,14 +322,12 @@ $apiInstance = new Pipedrive\versions\v1\Api\OrganizationsApi( $config ); $id = 56; // int | The ID of the organization -$cursor = 'cursor_example'; // string | For pagination, the marker (an opaque string value) representing the first item on the next page -$limit = 56; // int | Items shown per page try { - $result = $apiInstance->getOrganizationChangelog($id, $cursor, $limit); + $result = $apiInstance->getOrganizationFollowers($id); print_r($result); } catch (Exception $e) { - echo 'Exception when calling OrganizationsApi->getOrganizationChangelog: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling OrganizationsApi->getOrganizationFollowers: ', $e->getMessage(), PHP_EOL; } ``` @@ -476,12 +336,10 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **int**| The ID of the organization | - **cursor** | **string**| For pagination, the marker (an opaque string value) representing the first item on the next page | [optional] - **limit** | **int**| Items shown per page | [optional] ### Return type -[**\Pipedrive\versions\v1\Model\ChangelogResponse**](../Model/ChangelogResponse.md) +[**\Pipedrive\versions\v1\Model\OrganizationFollowersListResponse**](../Model/OrganizationFollowersListResponse.md) ### Authorization @@ -496,15 +354,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `getOrganizationDeals()` +## `getOrganizationMailMessages()` ```php -getOrganizationDeals($id, $start, $limit, $status, $sort, $only_primary_association): \Pipedrive\versions\v1\Model\ListDealsResponse +getOrganizationMailMessages($id, $start, $limit): \Pipedrive\versions\v1\Model\ListMailMessagesResponse ``` -List deals associated with an organization +List mail messages associated with an organization -Lists deals associated with an organization.
This endpoint has been deprecated. Please use GET /api/v2/deals?org_id={id} instead. +Lists mail messages associated with an organization. ### Example @@ -531,15 +389,12 @@ $apiInstance = new Pipedrive\versions\v1\Api\OrganizationsApi( $id = 56; // int | The ID of the organization $start = 0; // int | Pagination start $limit = 56; // int | Items shown per page -$status = 'all_not_deleted'; // string | Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. -$sort = 'sort_example'; // string | The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). -$only_primary_association = new \Pipedrive\versions\v1\Model\\Pipedrive\versions\v1\Model\NumberBoolean(); // \Pipedrive\versions\v1\Model\NumberBoolean | If set, only deals that are directly associated to the organization are fetched. If not set (default), all deals are fetched that are either directly or indirectly related to the organization. Indirect relations include relations through custom, organization-type fields and through persons of the given organization. try { - $result = $apiInstance->getOrganizationDeals($id, $start, $limit, $status, $sort, $only_primary_association); + $result = $apiInstance->getOrganizationMailMessages($id, $start, $limit); print_r($result); } catch (Exception $e) { - echo 'Exception when calling OrganizationsApi->getOrganizationDeals: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling OrganizationsApi->getOrganizationMailMessages: ', $e->getMessage(), PHP_EOL; } ``` @@ -550,13 +405,10 @@ Name | Type | Description | Notes **id** | **int**| The ID of the organization | **start** | **int**| Pagination start | [optional] [default to 0] **limit** | **int**| Items shown per page | [optional] - **status** | **string**| Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. | [optional] [default to 'all_not_deleted'] - **sort** | **string**| The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). | [optional] - **only_primary_association** | [**\Pipedrive\versions\v1\Model\NumberBoolean**](../Model/.md)| If set, only deals that are directly associated to the organization are fetched. If not set (default), all deals are fetched that are either directly or indirectly related to the organization. Indirect relations include relations through custom, organization-type fields and through persons of the given organization. | [optional] ### Return type -[**\Pipedrive\versions\v1\Model\ListDealsResponse**](../Model/ListDealsResponse.md) +[**\Pipedrive\versions\v1\Model\ListMailMessagesResponse**](../Model/ListMailMessagesResponse.md) ### Authorization @@ -571,15 +423,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `getOrganizationFiles()` +## `getOrganizationUpdates()` ```php -getOrganizationFiles($id, $start, $limit, $sort): \Pipedrive\versions\v1\Model\ListFilesResponse +getOrganizationUpdates($id, $start, $limit, $all_changes, $items): \Pipedrive\versions\v1\Model\OrganizationFlowResponse ``` -List files attached to an organization +List updates about an organization -Lists files associated with an organization. +Lists updates about an organization. ### Example @@ -605,14 +457,15 @@ $apiInstance = new Pipedrive\versions\v1\Api\OrganizationsApi( ); $id = 56; // int | The ID of the organization $start = 0; // int | Pagination start -$limit = 56; // int | Items shown per page. Please note that a maximum value of 100 is allowed. -$sort = 'sort_example'; // string | Supported fields: `id`, `update_time` +$limit = 56; // int | Items shown per page +$all_changes = 'all_changes_example'; // string | Whether to show custom field updates or not. 1 = Include custom field changes. If omitted, returns changes without custom field updates. +$items = 'items_example'; // string | A comma-separated string for filtering out item specific updates. (Possible values - activity, plannedActivity, note, file, change, deal, follower, participant, mailMessage, mailMessageWithAttachment, invoice, activityFile, document). try { - $result = $apiInstance->getOrganizationFiles($id, $start, $limit, $sort); + $result = $apiInstance->getOrganizationUpdates($id, $start, $limit, $all_changes, $items); print_r($result); } catch (Exception $e) { - echo 'Exception when calling OrganizationsApi->getOrganizationFiles: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling OrganizationsApi->getOrganizationUpdates: ', $e->getMessage(), PHP_EOL; } ``` @@ -622,12 +475,13 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **int**| The ID of the organization | **start** | **int**| Pagination start | [optional] [default to 0] - **limit** | **int**| Items shown per page. Please note that a maximum value of 100 is allowed. | [optional] - **sort** | **string**| Supported fields: `id`, `update_time` | [optional] + **limit** | **int**| Items shown per page | [optional] + **all_changes** | **string**| Whether to show custom field updates or not. 1 = Include custom field changes. If omitted, returns changes without custom field updates. | [optional] + **items** | **string**| A comma-separated string for filtering out item specific updates. (Possible values - activity, plannedActivity, note, file, change, deal, follower, participant, mailMessage, mailMessageWithAttachment, invoice, activityFile, document). | [optional] ### Return type -[**\Pipedrive\versions\v1\Model\ListFilesResponse**](../Model/ListFilesResponse.md) +[**\Pipedrive\versions\v1\Model\OrganizationFlowResponse**](../Model/OrganizationFlowResponse.md) ### Authorization @@ -642,15 +496,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `getOrganizationFollowers()` +## `getOrganizationUsers()` ```php -getOrganizationFollowers($id): \Pipedrive\versions\v1\Model\OrganizationFollowersListResponse +getOrganizationUsers($id): \Pipedrive\versions\v1\Model\ListPermittedUsersResponse1 ``` -List followers of an organization +List permitted users -Lists the followers of an organization. +List users permitted to access an organization. ### Example @@ -677,10 +531,10 @@ $apiInstance = new Pipedrive\versions\v1\Api\OrganizationsApi( $id = 56; // int | The ID of the organization try { - $result = $apiInstance->getOrganizationFollowers($id); + $result = $apiInstance->getOrganizationUsers($id); print_r($result); } catch (Exception $e) { - echo 'Exception when calling OrganizationsApi->getOrganizationFollowers: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling OrganizationsApi->getOrganizationUsers: ', $e->getMessage(), PHP_EOL; } ``` @@ -692,7 +546,7 @@ Name | Type | Description | Notes ### Return type -[**\Pipedrive\versions\v1\Model\OrganizationFollowersListResponse**](../Model/OrganizationFollowersListResponse.md) +[**\Pipedrive\versions\v1\Model\ListPermittedUsersResponse1**](../Model/ListPermittedUsersResponse1.md) ### Authorization @@ -707,15 +561,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `getOrganizationMailMessages()` +## `mergeOrganizations()` ```php -getOrganizationMailMessages($id, $start, $limit): \Pipedrive\versions\v1\Model\ListMailMessagesResponse +mergeOrganizations($id, $merge_organizations_request): \Pipedrive\versions\v1\Model\OrganizationsMergeResponse ``` -List mail messages associated with an organization +Merge two organizations -Lists mail messages associated with an organization. +Merges an organization with another organization. For more information, see the tutorial for merging two organizations. ### Example @@ -740,14 +594,13 @@ $apiInstance = new Pipedrive\versions\v1\Api\OrganizationsApi( $config ); $id = 56; // int | The ID of the organization -$start = 0; // int | Pagination start -$limit = 56; // int | Items shown per page +$merge_organizations_request = new \Pipedrive\versions\v1\Model\MergeOrganizationsRequest(); // \Pipedrive\versions\v1\Model\MergeOrganizationsRequest try { - $result = $apiInstance->getOrganizationMailMessages($id, $start, $limit); + $result = $apiInstance->mergeOrganizations($id, $merge_organizations_request); print_r($result); } catch (Exception $e) { - echo 'Exception when calling OrganizationsApi->getOrganizationMailMessages: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling OrganizationsApi->mergeOrganizations: ', $e->getMessage(), PHP_EOL; } ``` @@ -756,432 +609,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **int**| The ID of the organization | - **start** | **int**| Pagination start | [optional] [default to 0] - **limit** | **int**| Items shown per page | [optional] - -### Return type - -[**\Pipedrive\versions\v1\Model\ListMailMessagesResponse**](../Model/ListMailMessagesResponse.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -## `getOrganizationPersons()` - -```php -getOrganizationPersons($id, $start, $limit): \Pipedrive\versions\v1\Model\ListPersonsResponse -``` - -List persons of an organization - -Lists persons associated with an organization.
If a company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also return the `data.marketing_status` field.
This endpoint has been deprecated. Please use GET /api/v2/persons?org_id={id} instead. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\OrganizationsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$id = 56; // int | The ID of the organization -$start = 0; // int | Pagination start -$limit = 56; // int | Items shown per page - -try { - $result = $apiInstance->getOrganizationPersons($id, $start, $limit); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling OrganizationsApi->getOrganizationPersons: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the organization | - **start** | **int**| Pagination start | [optional] [default to 0] - **limit** | **int**| Items shown per page | [optional] - -### Return type - -[**\Pipedrive\versions\v1\Model\ListPersonsResponse**](../Model/ListPersonsResponse.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -## `getOrganizationUpdates()` - -```php -getOrganizationUpdates($id, $start, $limit, $all_changes, $items): \Pipedrive\versions\v1\Model\OrganizationFlowResponse -``` - -List updates about an organization - -Lists updates about an organization. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\OrganizationsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$id = 56; // int | The ID of the organization -$start = 0; // int | Pagination start -$limit = 56; // int | Items shown per page -$all_changes = 'all_changes_example'; // string | Whether to show custom field updates or not. 1 = Include custom field changes. If omitted, returns changes without custom field updates. -$items = 'items_example'; // string | A comma-separated string for filtering out item specific updates. (Possible values - activity, plannedActivity, note, file, change, deal, follower, participant, mailMessage, mailMessageWithAttachment, invoice, activityFile, document). - -try { - $result = $apiInstance->getOrganizationUpdates($id, $start, $limit, $all_changes, $items); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling OrganizationsApi->getOrganizationUpdates: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the organization | - **start** | **int**| Pagination start | [optional] [default to 0] - **limit** | **int**| Items shown per page | [optional] - **all_changes** | **string**| Whether to show custom field updates or not. 1 = Include custom field changes. If omitted, returns changes without custom field updates. | [optional] - **items** | **string**| A comma-separated string for filtering out item specific updates. (Possible values - activity, plannedActivity, note, file, change, deal, follower, participant, mailMessage, mailMessageWithAttachment, invoice, activityFile, document). | [optional] - -### Return type - -[**\Pipedrive\versions\v1\Model\OrganizationFlowResponse**](../Model/OrganizationFlowResponse.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -## `getOrganizationUsers()` - -```php -getOrganizationUsers($id): \Pipedrive\versions\v1\Model\ListPermittedUsersResponse1 -``` - -List permitted users - -List users permitted to access an organization. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\OrganizationsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$id = 56; // int | The ID of the organization - -try { - $result = $apiInstance->getOrganizationUsers($id); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling OrganizationsApi->getOrganizationUsers: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the organization | - -### Return type - -[**\Pipedrive\versions\v1\Model\ListPermittedUsersResponse1**](../Model/ListPermittedUsersResponse1.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -## `getOrganizations()` - -```php -getOrganizations($user_id, $filter_id, $first_char, $start, $limit, $sort): \Pipedrive\versions\v1\Model\AllOrganizationsGetResponse -``` - -Get all organizations - -Returns all organizations. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\OrganizationsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$user_id = 56; // int | If supplied, only organizations owned by the given user will be returned. However, `filter_id` takes precedence over `user_id` when both are supplied. -$filter_id = 56; // int | The ID of the filter to use -$first_char = 'first_char_example'; // string | If supplied, only organizations whose name starts with the specified letter will be returned (case-insensitive) -$start = 0; // int | Pagination start -$limit = 56; // int | Items shown per page -$sort = 'sort_example'; // string | The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). - -try { - $result = $apiInstance->getOrganizations($user_id, $filter_id, $first_char, $start, $limit, $sort); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling OrganizationsApi->getOrganizations: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **user_id** | **int**| If supplied, only organizations owned by the given user will be returned. However, `filter_id` takes precedence over `user_id` when both are supplied. | [optional] - **filter_id** | **int**| The ID of the filter to use | [optional] - **first_char** | **string**| If supplied, only organizations whose name starts with the specified letter will be returned (case-insensitive) | [optional] - **start** | **int**| Pagination start | [optional] [default to 0] - **limit** | **int**| Items shown per page | [optional] - **sort** | **string**| The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). | [optional] - -### Return type - -[**\Pipedrive\versions\v1\Model\AllOrganizationsGetResponse**](../Model/AllOrganizationsGetResponse.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -## `getOrganizationsCollection()` - -```php -getOrganizationsCollection($cursor, $limit, $since, $until, $owner_id, $first_char): \Pipedrive\versions\v1\Model\InlineResponse200 -``` - -Get all organizations collection - -Returns all organizations. Please note that only global admins (those with global permissions) can access this endpoint. Users with regular permissions will receive a 403 response. Read more about global permissions here.
This endpoint has been deprecated. Please use GET /api/v2/organizations instead. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\OrganizationsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$cursor = 'cursor_example'; // string | For pagination, the marker (an opaque string value) representing the first item on the next page -$limit = 100; // int | For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. -$since = 'since_example'; // string | The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. -$until = 'until_example'; // string | The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. -$owner_id = 56; // int | If supplied, only organizations owned by the given user will be returned -$first_char = 'first_char_example'; // string | If supplied, only organizations whose name starts with the specified letter will be returned (case-insensitive) - -try { - $result = $apiInstance->getOrganizationsCollection($cursor, $limit, $since, $until, $owner_id, $first_char); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling OrganizationsApi->getOrganizationsCollection: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **cursor** | **string**| For pagination, the marker (an opaque string value) representing the first item on the next page | [optional] - **limit** | **int**| For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. | [optional] - **since** | **string**| The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. | [optional] - **until** | **string**| The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. | [optional] - **owner_id** | **int**| If supplied, only organizations owned by the given user will be returned | [optional] - **first_char** | **string**| If supplied, only organizations whose name starts with the specified letter will be returned (case-insensitive) | [optional] - -### Return type - -[**\Pipedrive\versions\v1\Model\InlineResponse200**](../Model/InlineResponse200.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -## `mergeOrganizations()` - -```php -mergeOrganizations($id, $merge_organizations_request): \Pipedrive\versions\v1\Model\OrganizationsMergeResponse -``` - -Merge two organizations - -Merges an organization with another organization. For more information, see the tutorial for merging two organizations. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\OrganizationsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$id = 56; // int | The ID of the organization -$merge_organizations_request = new \Pipedrive\versions\v1\Model\MergeOrganizationsRequest(); // \Pipedrive\versions\v1\Model\MergeOrganizationsRequest - -try { - $result = $apiInstance->mergeOrganizations($id, $merge_organizations_request); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling OrganizationsApi->mergeOrganizations: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the organization | - **merge_organizations_request** | [**\Pipedrive\versions\v1\Model\MergeOrganizationsRequest**](../Model/MergeOrganizationsRequest.md)| | [optional] + **merge_organizations_request** | [**\Pipedrive\versions\v1\Model\MergeOrganizationsRequest**](../Model/MergeOrganizationsRequest.md)| | [optional] ### Return type @@ -1199,143 +627,3 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -## `searchOrganization()` - -```php -searchOrganization($term, $fields, $exact_match, $start, $limit): \Pipedrive\versions\v1\Model\OrganizationSearchResponse -``` - -Search organizations - -Searches all organizations by name, address, notes and/or custom fields. This endpoint is a wrapper of /v1/itemSearch with a narrower OAuth scope. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\OrganizationsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$term = 'term_example'; // string | The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded. -$fields = 'fields_example'; // string | A comma-separated string array. The fields to perform the search from. Defaults to all of them. Only the following custom field types are searchable: `address`, `varchar`, `text`, `varchar_auto`, `double`, `monetary` and `phone`. Read more about searching by custom fields here. -$exact_match = True; // bool | When enabled, only full exact matches against the given term are returned. It is not case sensitive. -$start = 0; // int | Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter. -$limit = 56; // int | Items shown per page - -try { - $result = $apiInstance->searchOrganization($term, $fields, $exact_match, $start, $limit); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling OrganizationsApi->searchOrganization: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **term** | **string**| The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded. | - **fields** | **string**| A comma-separated string array. The fields to perform the search from. Defaults to all of them. Only the following custom field types are searchable: `address`, `varchar`, `text`, `varchar_auto`, `double`, `monetary` and `phone`. Read more about searching by custom fields <a href=\"https://support.pipedrive.com/en/article/search-finding-what-you-need#searching-by-custom-fields\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>. | [optional] - **exact_match** | **bool**| When enabled, only full exact matches against the given term are returned. It is <b>not</b> case sensitive. | [optional] - **start** | **int**| Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter. | [optional] [default to 0] - **limit** | **int**| Items shown per page | [optional] - -### Return type - -[**\Pipedrive\versions\v1\Model\OrganizationSearchResponse**](../Model/OrganizationSearchResponse.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -## `updateOrganization()` - -```php -updateOrganization($id, $update_organization): \Pipedrive\versions\v1\Model\OrganizationUpdateResponse -``` - -Update an organization - -Updates the properties of an organization. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\OrganizationsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$id = 56; // int | The ID of the organization -$update_organization = new \Pipedrive\versions\v1\Model\UpdateOrganization(); // \Pipedrive\versions\v1\Model\UpdateOrganization - -try { - $result = $apiInstance->updateOrganization($id, $update_organization); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling OrganizationsApi->updateOrganization: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the organization | - **update_organization** | [**\Pipedrive\versions\v1\Model\UpdateOrganization**](../Model/UpdateOrganization.md)| | [optional] - -### Return type - -[**\Pipedrive\versions\v1\Model\OrganizationUpdateResponse**](../Model/OrganizationUpdateResponse.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: `application/json` -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) diff --git a/docs/versions/v1/Api/PersonsApi.md b/docs/versions/v1/Api/PersonsApi.md index f2209ba0..72f2a776 100644 --- a/docs/versions/v1/Api/PersonsApi.md +++ b/docs/versions/v1/Api/PersonsApi.md @@ -4,94 +4,20 @@ All URIs are relative to https://api.pipedrive.com/v1. Method | HTTP request | Description ------------- | ------------- | ------------- -[**addPerson()**](PersonsApi.md#addPerson) | **POST** /persons | Add a person [**addPersonFollower()**](PersonsApi.md#addPersonFollower) | **POST** /persons/{id}/followers | Add a follower to a person [**addPersonPicture()**](PersonsApi.md#addPersonPicture) | **POST** /persons/{id}/picture | Add person picture -[**deletePerson()**](PersonsApi.md#deletePerson) | **DELETE** /persons/{id} | Delete a person [**deletePersonFollower()**](PersonsApi.md#deletePersonFollower) | **DELETE** /persons/{id}/followers/{follower_id} | Delete a follower from a person [**deletePersonPicture()**](PersonsApi.md#deletePersonPicture) | **DELETE** /persons/{id}/picture | Delete person picture -[**getPerson()**](PersonsApi.md#getPerson) | **GET** /persons/{id} | Get details of a person -[**getPersonActivities()**](PersonsApi.md#getPersonActivities) | **GET** /persons/{id}/activities | List activities associated with a person [**getPersonChangelog()**](PersonsApi.md#getPersonChangelog) | **GET** /persons/{id}/changelog | List updates about person field values -[**getPersonDeals()**](PersonsApi.md#getPersonDeals) | **GET** /persons/{id}/deals | List deals associated with a person [**getPersonFiles()**](PersonsApi.md#getPersonFiles) | **GET** /persons/{id}/files | List files attached to a person [**getPersonFollowers()**](PersonsApi.md#getPersonFollowers) | **GET** /persons/{id}/followers | List followers of a person [**getPersonMailMessages()**](PersonsApi.md#getPersonMailMessages) | **GET** /persons/{id}/mailMessages | List mail messages associated with a person [**getPersonProducts()**](PersonsApi.md#getPersonProducts) | **GET** /persons/{id}/products | List products associated with a person [**getPersonUpdates()**](PersonsApi.md#getPersonUpdates) | **GET** /persons/{id}/flow | List updates about a person [**getPersonUsers()**](PersonsApi.md#getPersonUsers) | **GET** /persons/{id}/permittedUsers | List permitted users -[**getPersons()**](PersonsApi.md#getPersons) | **GET** /persons | Get all persons -[**getPersonsCollection()**](PersonsApi.md#getPersonsCollection) | **GET** /persons/collection | Get all persons collection [**mergePersons()**](PersonsApi.md#mergePersons) | **PUT** /persons/{id}/merge | Merge two persons -[**searchPersons()**](PersonsApi.md#searchPersons) | **GET** /persons/search | Search persons -[**updatePerson()**](PersonsApi.md#updatePerson) | **PUT** /persons/{id} | Update a person -## `addPerson()` - -```php -addPerson($new_person): \Pipedrive\versions\v1\Model\AddPersonResponse -``` - -Add a person - -Adds a new person. Note that you can supply additional custom fields along with the request that are not described here. These custom fields are different for each Pipedrive account and can be recognized by long hashes as keys. To determine which custom fields exists, fetch the personFields and look for `key` values.
If a company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also accept and return the `data.marketing_status` field. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\PersonsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$new_person = new \Pipedrive\versions\v1\Model\NewPerson(); // \Pipedrive\versions\v1\Model\NewPerson - -try { - $result = $apiInstance->addPerson($new_person); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling PersonsApi->addPerson: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **new_person** | [**\Pipedrive\versions\v1\Model\NewPerson**](../Model/NewPerson.md)| | [optional] - -### Return type - -[**\Pipedrive\versions\v1\Model\AddPersonResponse**](../Model/AddPersonResponse.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: `application/json` -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - ## `addPersonFollower()` ```php @@ -234,71 +160,6 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `deletePerson()` - -```php -deletePerson($id): \Pipedrive\versions\v1\Model\DeletePersonResponse -``` - -Delete a person - -Marks a person as deleted. After 30 days, the person will be permanently deleted. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\PersonsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$id = 56; // int | The ID of the person - -try { - $result = $apiInstance->deletePerson($id); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling PersonsApi->deletePerson: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the person | - -### Return type - -[**\Pipedrive\versions\v1\Model\DeletePersonResponse**](../Model/DeletePersonResponse.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - ## `deletePersonFollower()` ```php @@ -431,15 +292,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `getPerson()` +## `getPersonChangelog()` ```php -getPerson($id): \Pipedrive\versions\v1\Model\GetPersonDetailsResponse +getPersonChangelog($id, $cursor, $limit): \Pipedrive\versions\v1\Model\ChangelogResponse ``` -Get details of a person +List updates about person field values -Returns the details of a person. Note that this also returns some additional fields which are not present when asking for all persons. Also note that custom fields appear as long hashes in the resulting data. These hashes can be mapped against the `key` value of personFields.
If a company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also return the `data.marketing_status` field. +Lists updates about field values of a person. ### Example @@ -464,12 +325,14 @@ $apiInstance = new Pipedrive\versions\v1\Api\PersonsApi( $config ); $id = 56; // int | The ID of the person +$cursor = 'cursor_example'; // string | For pagination, the marker (an opaque string value) representing the first item on the next page +$limit = 56; // int | Items shown per page try { - $result = $apiInstance->getPerson($id); + $result = $apiInstance->getPersonChangelog($id, $cursor, $limit); print_r($result); } catch (Exception $e) { - echo 'Exception when calling PersonsApi->getPerson: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling PersonsApi->getPersonChangelog: ', $e->getMessage(), PHP_EOL; } ``` @@ -478,10 +341,12 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **int**| The ID of the person | + **cursor** | **string**| For pagination, the marker (an opaque string value) representing the first item on the next page | [optional] + **limit** | **int**| Items shown per page | [optional] ### Return type -[**\Pipedrive\versions\v1\Model\GetPersonDetailsResponse**](../Model/GetPersonDetailsResponse.md) +[**\Pipedrive\versions\v1\Model\ChangelogResponse**](../Model/ChangelogResponse.md) ### Authorization @@ -496,15 +361,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `getPersonActivities()` +## `getPersonFiles()` ```php -getPersonActivities($id, $start, $limit, $done, $exclude): \Pipedrive\versions\v1\Model\ListActivitiesResponse +getPersonFiles($id, $start, $limit, $sort): \Pipedrive\versions\v1\Model\ListFilesResponse ``` -List activities associated with a person +List files attached to a person -Lists activities associated with a person.
This endpoint has been deprecated. Please use GET /api/v2/activities?person_id={id} instead. +Lists files associated with a person. ### Example @@ -530,15 +395,14 @@ $apiInstance = new Pipedrive\versions\v1\Api\PersonsApi( ); $id = 56; // int | The ID of the person $start = 0; // int | Pagination start -$limit = 56; // int | Items shown per page -$done = new \Pipedrive\versions\v1\Model\\Pipedrive\versions\v1\Model\NumberBoolean(); // \Pipedrive\versions\v1\Model\NumberBoolean | Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted, returns both Done and Not done activities. -$exclude = 'exclude_example'; // string | A comma-separated string of activity IDs to exclude from result +$limit = 56; // int | Items shown per page. Please note that a maximum value of 100 is allowed. +$sort = 'sort_example'; // string | Supported fields: `id`, `update_time` try { - $result = $apiInstance->getPersonActivities($id, $start, $limit, $done, $exclude); + $result = $apiInstance->getPersonFiles($id, $start, $limit, $sort); print_r($result); } catch (Exception $e) { - echo 'Exception when calling PersonsApi->getPersonActivities: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling PersonsApi->getPersonFiles: ', $e->getMessage(), PHP_EOL; } ``` @@ -548,13 +412,12 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **int**| The ID of the person | **start** | **int**| Pagination start | [optional] [default to 0] - **limit** | **int**| Items shown per page | [optional] - **done** | [**\Pipedrive\versions\v1\Model\NumberBoolean**](../Model/.md)| Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted, returns both Done and Not done activities. | [optional] - **exclude** | **string**| A comma-separated string of activity IDs to exclude from result | [optional] + **limit** | **int**| Items shown per page. Please note that a maximum value of 100 is allowed. | [optional] + **sort** | **string**| Supported fields: `id`, `update_time` | [optional] ### Return type -[**\Pipedrive\versions\v1\Model\ListActivitiesResponse**](../Model/ListActivitiesResponse.md) +[**\Pipedrive\versions\v1\Model\ListFilesResponse**](../Model/ListFilesResponse.md) ### Authorization @@ -569,15 +432,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `getPersonChangelog()` +## `getPersonFollowers()` ```php -getPersonChangelog($id, $cursor, $limit): \Pipedrive\versions\v1\Model\ChangelogResponse +getPersonFollowers($id): \Pipedrive\versions\v1\Model\ListFollowersResponse ``` -List updates about person field values +List followers of a person -Lists updates about field values of a person. +Lists the followers of a person. ### Example @@ -602,14 +465,12 @@ $apiInstance = new Pipedrive\versions\v1\Api\PersonsApi( $config ); $id = 56; // int | The ID of the person -$cursor = 'cursor_example'; // string | For pagination, the marker (an opaque string value) representing the first item on the next page -$limit = 56; // int | Items shown per page try { - $result = $apiInstance->getPersonChangelog($id, $cursor, $limit); + $result = $apiInstance->getPersonFollowers($id); print_r($result); } catch (Exception $e) { - echo 'Exception when calling PersonsApi->getPersonChangelog: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling PersonsApi->getPersonFollowers: ', $e->getMessage(), PHP_EOL; } ``` @@ -618,12 +479,10 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **int**| The ID of the person | - **cursor** | **string**| For pagination, the marker (an opaque string value) representing the first item on the next page | [optional] - **limit** | **int**| Items shown per page | [optional] ### Return type -[**\Pipedrive\versions\v1\Model\ChangelogResponse**](../Model/ChangelogResponse.md) +[**\Pipedrive\versions\v1\Model\ListFollowersResponse**](../Model/ListFollowersResponse.md) ### Authorization @@ -638,15 +497,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `getPersonDeals()` +## `getPersonMailMessages()` ```php -getPersonDeals($id, $start, $limit, $status, $sort): \Pipedrive\versions\v1\Model\ListDealsResponse +getPersonMailMessages($id, $start, $limit): \Pipedrive\versions\v1\Model\ListMailMessagesResponse ``` -List deals associated with a person +List mail messages associated with a person -Lists deals associated with a person.
This endpoint has been deprecated. Please use GET /api/v2/deals?person_id={id} instead. +Lists mail messages associated with a person. ### Example @@ -673,14 +532,12 @@ $apiInstance = new Pipedrive\versions\v1\Api\PersonsApi( $id = 56; // int | The ID of the person $start = 0; // int | Pagination start $limit = 56; // int | Items shown per page -$status = 'all_not_deleted'; // string | Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. -$sort = 'sort_example'; // string | The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). try { - $result = $apiInstance->getPersonDeals($id, $start, $limit, $status, $sort); + $result = $apiInstance->getPersonMailMessages($id, $start, $limit); print_r($result); } catch (Exception $e) { - echo 'Exception when calling PersonsApi->getPersonDeals: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling PersonsApi->getPersonMailMessages: ', $e->getMessage(), PHP_EOL; } ``` @@ -691,12 +548,10 @@ Name | Type | Description | Notes **id** | **int**| The ID of the person | **start** | **int**| Pagination start | [optional] [default to 0] **limit** | **int**| Items shown per page | [optional] - **status** | **string**| Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. | [optional] [default to 'all_not_deleted'] - **sort** | **string**| The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). | [optional] ### Return type -[**\Pipedrive\versions\v1\Model\ListDealsResponse**](../Model/ListDealsResponse.md) +[**\Pipedrive\versions\v1\Model\ListMailMessagesResponse**](../Model/ListMailMessagesResponse.md) ### Authorization @@ -711,15 +566,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `getPersonFiles()` +## `getPersonProducts()` ```php -getPersonFiles($id, $start, $limit, $sort): \Pipedrive\versions\v1\Model\ListFilesResponse +getPersonProducts($id, $start, $limit): \Pipedrive\versions\v1\Model\ListPersonProductsResponse ``` -List files attached to a person +List products associated with a person -Lists files associated with a person. +Lists products associated with a person. ### Example @@ -745,14 +600,13 @@ $apiInstance = new Pipedrive\versions\v1\Api\PersonsApi( ); $id = 56; // int | The ID of the person $start = 0; // int | Pagination start -$limit = 56; // int | Items shown per page. Please note that a maximum value of 100 is allowed. -$sort = 'sort_example'; // string | Supported fields: `id`, `update_time` +$limit = 56; // int | Items shown per page try { - $result = $apiInstance->getPersonFiles($id, $start, $limit, $sort); + $result = $apiInstance->getPersonProducts($id, $start, $limit); print_r($result); } catch (Exception $e) { - echo 'Exception when calling PersonsApi->getPersonFiles: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling PersonsApi->getPersonProducts: ', $e->getMessage(), PHP_EOL; } ``` @@ -762,12 +616,11 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **int**| The ID of the person | **start** | **int**| Pagination start | [optional] [default to 0] - **limit** | **int**| Items shown per page. Please note that a maximum value of 100 is allowed. | [optional] - **sort** | **string**| Supported fields: `id`, `update_time` | [optional] + **limit** | **int**| Items shown per page | [optional] ### Return type -[**\Pipedrive\versions\v1\Model\ListFilesResponse**](../Model/ListFilesResponse.md) +[**\Pipedrive\versions\v1\Model\ListPersonProductsResponse**](../Model/ListPersonProductsResponse.md) ### Authorization @@ -782,15 +635,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `getPersonFollowers()` +## `getPersonUpdates()` ```php -getPersonFollowers($id): \Pipedrive\versions\v1\Model\ListFollowersResponse +getPersonUpdates($id, $start, $limit, $all_changes, $items): \Pipedrive\versions\v1\Model\PersonFlowResponse ``` -List followers of a person +List updates about a person -Lists the followers of a person. +Lists updates about a person.
If a company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint's response will also include updates for the `marketing_status` field. ### Example @@ -815,12 +668,16 @@ $apiInstance = new Pipedrive\versions\v1\Api\PersonsApi( $config ); $id = 56; // int | The ID of the person +$start = 0; // int | Pagination start +$limit = 56; // int | Items shown per page +$all_changes = 'all_changes_example'; // string | Whether to show custom field updates or not. 1 = Include custom field changes. If omitted returns changes without custom field updates. +$items = 'items_example'; // string | A comma-separated string for filtering out item specific updates. (Possible values - call, activity, plannedActivity, change, note, deal, file, dealChange, personChange, organizationChange, follower, dealFollower, personFollower, organizationFollower, participant, comment, mailMessage, mailMessageWithAttachment, invoice, document, marketing_campaign_stat, marketing_status_change). try { - $result = $apiInstance->getPersonFollowers($id); + $result = $apiInstance->getPersonUpdates($id, $start, $limit, $all_changes, $items); print_r($result); } catch (Exception $e) { - echo 'Exception when calling PersonsApi->getPersonFollowers: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling PersonsApi->getPersonUpdates: ', $e->getMessage(), PHP_EOL; } ``` @@ -829,10 +686,14 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **int**| The ID of the person | + **start** | **int**| Pagination start | [optional] [default to 0] + **limit** | **int**| Items shown per page | [optional] + **all_changes** | **string**| Whether to show custom field updates or not. 1 = Include custom field changes. If omitted returns changes without custom field updates. | [optional] + **items** | **string**| A comma-separated string for filtering out item specific updates. (Possible values - call, activity, plannedActivity, change, note, deal, file, dealChange, personChange, organizationChange, follower, dealFollower, personFollower, organizationFollower, participant, comment, mailMessage, mailMessageWithAttachment, invoice, document, marketing_campaign_stat, marketing_status_change). | [optional] ### Return type -[**\Pipedrive\versions\v1\Model\ListFollowersResponse**](../Model/ListFollowersResponse.md) +[**\Pipedrive\versions\v1\Model\PersonFlowResponse**](../Model/PersonFlowResponse.md) ### Authorization @@ -847,15 +708,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `getPersonMailMessages()` +## `getPersonUsers()` ```php -getPersonMailMessages($id, $start, $limit): \Pipedrive\versions\v1\Model\ListMailMessagesResponse +getPersonUsers($id): \Pipedrive\versions\v1\Model\ListPermittedUsersResponse1 ``` -List mail messages associated with a person +List permitted users -Lists mail messages associated with a person. +List users permitted to access a person. ### Example @@ -880,14 +741,12 @@ $apiInstance = new Pipedrive\versions\v1\Api\PersonsApi( $config ); $id = 56; // int | The ID of the person -$start = 0; // int | Pagination start -$limit = 56; // int | Items shown per page try { - $result = $apiInstance->getPersonMailMessages($id, $start, $limit); + $result = $apiInstance->getPersonUsers($id); print_r($result); } catch (Exception $e) { - echo 'Exception when calling PersonsApi->getPersonMailMessages: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling PersonsApi->getPersonUsers: ', $e->getMessage(), PHP_EOL; } ``` @@ -896,12 +755,10 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **int**| The ID of the person | - **start** | **int**| Pagination start | [optional] [default to 0] - **limit** | **int**| Items shown per page | [optional] ### Return type -[**\Pipedrive\versions\v1\Model\ListMailMessagesResponse**](../Model/ListMailMessagesResponse.md) +[**\Pipedrive\versions\v1\Model\ListPermittedUsersResponse1**](../Model/ListPermittedUsersResponse1.md) ### Authorization @@ -916,15 +773,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `getPersonProducts()` +## `mergePersons()` ```php -getPersonProducts($id, $start, $limit): \Pipedrive\versions\v1\Model\ListPersonProductsResponse +mergePersons($id, $merge_persons_request): \Pipedrive\versions\v1\Model\MergePersonsResponse ``` -List products associated with a person +Merge two persons -Lists products associated with a person. +Merges a person with another person. For more information, see the tutorial for merging two persons. ### Example @@ -949,14 +806,13 @@ $apiInstance = new Pipedrive\versions\v1\Api\PersonsApi( $config ); $id = 56; // int | The ID of the person -$start = 0; // int | Pagination start -$limit = 56; // int | Items shown per page +$merge_persons_request = new \Pipedrive\versions\v1\Model\MergePersonsRequest(); // \Pipedrive\versions\v1\Model\MergePersonsRequest try { - $result = $apiInstance->getPersonProducts($id, $start, $limit); + $result = $apiInstance->mergePersons($id, $merge_persons_request); print_r($result); } catch (Exception $e) { - echo 'Exception when calling PersonsApi->getPersonProducts: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling PersonsApi->mergePersons: ', $e->getMessage(), PHP_EOL; } ``` @@ -965,363 +821,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **int**| The ID of the person | - **start** | **int**| Pagination start | [optional] [default to 0] - **limit** | **int**| Items shown per page | [optional] - -### Return type - -[**\Pipedrive\versions\v1\Model\ListPersonProductsResponse**](../Model/ListPersonProductsResponse.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -## `getPersonUpdates()` - -```php -getPersonUpdates($id, $start, $limit, $all_changes, $items): \Pipedrive\versions\v1\Model\PersonFlowResponse -``` - -List updates about a person - -Lists updates about a person.
If a company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint's response will also include updates for the `marketing_status` field. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\PersonsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$id = 56; // int | The ID of the person -$start = 0; // int | Pagination start -$limit = 56; // int | Items shown per page -$all_changes = 'all_changes_example'; // string | Whether to show custom field updates or not. 1 = Include custom field changes. If omitted returns changes without custom field updates. -$items = 'items_example'; // string | A comma-separated string for filtering out item specific updates. (Possible values - call, activity, plannedActivity, change, note, deal, file, dealChange, personChange, organizationChange, follower, dealFollower, personFollower, organizationFollower, participant, comment, mailMessage, mailMessageWithAttachment, invoice, document, marketing_campaign_stat, marketing_status_change). - -try { - $result = $apiInstance->getPersonUpdates($id, $start, $limit, $all_changes, $items); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling PersonsApi->getPersonUpdates: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the person | - **start** | **int**| Pagination start | [optional] [default to 0] - **limit** | **int**| Items shown per page | [optional] - **all_changes** | **string**| Whether to show custom field updates or not. 1 = Include custom field changes. If omitted returns changes without custom field updates. | [optional] - **items** | **string**| A comma-separated string for filtering out item specific updates. (Possible values - call, activity, plannedActivity, change, note, deal, file, dealChange, personChange, organizationChange, follower, dealFollower, personFollower, organizationFollower, participant, comment, mailMessage, mailMessageWithAttachment, invoice, document, marketing_campaign_stat, marketing_status_change). | [optional] - -### Return type - -[**\Pipedrive\versions\v1\Model\PersonFlowResponse**](../Model/PersonFlowResponse.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -## `getPersonUsers()` - -```php -getPersonUsers($id): \Pipedrive\versions\v1\Model\ListPermittedUsersResponse1 -``` - -List permitted users - -List users permitted to access a person. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\PersonsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$id = 56; // int | The ID of the person - -try { - $result = $apiInstance->getPersonUsers($id); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling PersonsApi->getPersonUsers: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the person | - -### Return type - -[**\Pipedrive\versions\v1\Model\ListPermittedUsersResponse1**](../Model/ListPermittedUsersResponse1.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -## `getPersons()` - -```php -getPersons($user_id, $filter_id, $first_char, $start, $limit, $sort): \Pipedrive\versions\v1\Model\GetAllPersonsResponse -``` - -Get all persons - -Returns all persons. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\PersonsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$user_id = 56; // int | If supplied, only persons owned by the given user will be returned. However, `filter_id` takes precedence over `user_id` when both are supplied. -$filter_id = 56; // int | The ID of the filter to use -$first_char = 'first_char_example'; // string | If supplied, only persons whose name starts with the specified letter will be returned (case-insensitive) -$start = 0; // int | Pagination start -$limit = 56; // int | Items shown per page -$sort = 'sort_example'; // string | The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). - -try { - $result = $apiInstance->getPersons($user_id, $filter_id, $first_char, $start, $limit, $sort); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling PersonsApi->getPersons: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **user_id** | **int**| If supplied, only persons owned by the given user will be returned. However, `filter_id` takes precedence over `user_id` when both are supplied. | [optional] - **filter_id** | **int**| The ID of the filter to use | [optional] - **first_char** | **string**| If supplied, only persons whose name starts with the specified letter will be returned (case-insensitive) | [optional] - **start** | **int**| Pagination start | [optional] [default to 0] - **limit** | **int**| Items shown per page | [optional] - **sort** | **string**| The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). | [optional] - -### Return type - -[**\Pipedrive\versions\v1\Model\GetAllPersonsResponse**](../Model/GetAllPersonsResponse.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -## `getPersonsCollection()` - -```php -getPersonsCollection($cursor, $limit, $since, $until, $owner_id, $first_char): \Pipedrive\versions\v1\Model\InlineResponse2001 -``` - -Get all persons collection - -Returns all persons. Please note that only global admins (those with global permissions) can access this endpoint. Users with regular permissions will receive a 403 response. Read more about global permissions here.
This endpoint has been deprecated. Please use GET /api/v2/persons instead. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\PersonsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$cursor = 'cursor_example'; // string | For pagination, the marker (an opaque string value) representing the first item on the next page -$limit = 100; // int | For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. -$since = 'since_example'; // string | The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. -$until = 'until_example'; // string | The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. -$owner_id = 56; // int | If supplied, only persons owned by the given user will be returned -$first_char = 'first_char_example'; // string | If supplied, only persons whose name starts with the specified letter will be returned (case-insensitive) - -try { - $result = $apiInstance->getPersonsCollection($cursor, $limit, $since, $until, $owner_id, $first_char); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling PersonsApi->getPersonsCollection: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **cursor** | **string**| For pagination, the marker (an opaque string value) representing the first item on the next page | [optional] - **limit** | **int**| For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. | [optional] - **since** | **string**| The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. | [optional] - **until** | **string**| The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. | [optional] - **owner_id** | **int**| If supplied, only persons owned by the given user will be returned | [optional] - **first_char** | **string**| If supplied, only persons whose name starts with the specified letter will be returned (case-insensitive) | [optional] - -### Return type - -[**\Pipedrive\versions\v1\Model\InlineResponse2001**](../Model/InlineResponse2001.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -## `mergePersons()` - -```php -mergePersons($id, $merge_persons_request): \Pipedrive\versions\v1\Model\MergePersonsResponse -``` - -Merge two persons - -Merges a person with another person. For more information, see the tutorial for merging two persons. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\PersonsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$id = 56; // int | The ID of the person -$merge_persons_request = new \Pipedrive\versions\v1\Model\MergePersonsRequest(); // \Pipedrive\versions\v1\Model\MergePersonsRequest - -try { - $result = $apiInstance->mergePersons($id, $merge_persons_request); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling PersonsApi->mergePersons: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the person | - **merge_persons_request** | [**\Pipedrive\versions\v1\Model\MergePersonsRequest**](../Model/MergePersonsRequest.md)| | [optional] + **merge_persons_request** | [**\Pipedrive\versions\v1\Model\MergePersonsRequest**](../Model/MergePersonsRequest.md)| | [optional] ### Return type @@ -1339,147 +839,3 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -## `searchPersons()` - -```php -searchPersons($term, $fields, $exact_match, $organization_id, $include_fields, $start, $limit): \Pipedrive\versions\v1\Model\PersonSearchResponse -``` - -Search persons - -Searches all persons by name, email, phone, notes and/or custom fields. This endpoint is a wrapper of /v1/itemSearch with a narrower OAuth scope. Found persons can be filtered by organization ID. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\PersonsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$term = 'term_example'; // string | The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded. -$fields = 'fields_example'; // string | A comma-separated string array. The fields to perform the search from. Defaults to all of them. Only the following custom field types are searchable: `address`, `varchar`, `text`, `varchar_auto`, `double`, `monetary` and `phone`. Read more about searching by custom fields here. -$exact_match = True; // bool | When enabled, only full exact matches against the given term are returned. It is not case sensitive. -$organization_id = 56; // int | Will filter persons by the provided organization ID. The upper limit of found persons associated with the organization is 2000. -$include_fields = 'include_fields_example'; // string | Supports including optional fields in the results which are not provided by default -$start = 0; // int | Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter. -$limit = 56; // int | Items shown per page - -try { - $result = $apiInstance->searchPersons($term, $fields, $exact_match, $organization_id, $include_fields, $start, $limit); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling PersonsApi->searchPersons: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **term** | **string**| The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded. | - **fields** | **string**| A comma-separated string array. The fields to perform the search from. Defaults to all of them. Only the following custom field types are searchable: `address`, `varchar`, `text`, `varchar_auto`, `double`, `monetary` and `phone`. Read more about searching by custom fields <a href=\"https://support.pipedrive.com/en/article/search-finding-what-you-need#searching-by-custom-fields\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>. | [optional] - **exact_match** | **bool**| When enabled, only full exact matches against the given term are returned. It is <b>not</b> case sensitive. | [optional] - **organization_id** | **int**| Will filter persons by the provided organization ID. The upper limit of found persons associated with the organization is 2000. | [optional] - **include_fields** | **string**| Supports including optional fields in the results which are not provided by default | [optional] - **start** | **int**| Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter. | [optional] [default to 0] - **limit** | **int**| Items shown per page | [optional] - -### Return type - -[**\Pipedrive\versions\v1\Model\PersonSearchResponse**](../Model/PersonSearchResponse.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -## `updatePerson()` - -```php -updatePerson($id, $update_person): \Pipedrive\versions\v1\Model\UpdatePersonResponse -``` - -Update a person - -Updates the properties of a person. For more information, see the tutorial for updating a person.
If a company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also accept and return the `data.marketing_status` field. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\PersonsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$id = 56; // int | The ID of the person -$update_person = new \Pipedrive\versions\v1\Model\UpdatePerson(); // \Pipedrive\versions\v1\Model\UpdatePerson - -try { - $result = $apiInstance->updatePerson($id, $update_person); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling PersonsApi->updatePerson: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the person | - **update_person** | [**\Pipedrive\versions\v1\Model\UpdatePerson**](../Model/UpdatePerson.md)| | [optional] - -### Return type - -[**\Pipedrive\versions\v1\Model\UpdatePersonResponse**](../Model/UpdatePersonResponse.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: `application/json` -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) diff --git a/docs/versions/v1/Api/PipelinesApi.md b/docs/versions/v1/Api/PipelinesApi.md index 9d806618..4ee1c6c2 100644 --- a/docs/versions/v1/Api/PipelinesApi.md +++ b/docs/versions/v1/Api/PipelinesApi.md @@ -4,211 +4,11 @@ All URIs are relative to https://api.pipedrive.com/v1. Method | HTTP request | Description ------------- | ------------- | ------------- -[**addPipeline()**](PipelinesApi.md#addPipeline) | **POST** /pipelines | Add a new pipeline -[**deletePipeline()**](PipelinesApi.md#deletePipeline) | **DELETE** /pipelines/{id} | Delete a pipeline -[**getPipeline()**](PipelinesApi.md#getPipeline) | **GET** /pipelines/{id} | Get one pipeline [**getPipelineConversionStatistics()**](PipelinesApi.md#getPipelineConversionStatistics) | **GET** /pipelines/{id}/conversion_statistics | Get deals conversion rates in pipeline [**getPipelineDeals()**](PipelinesApi.md#getPipelineDeals) | **GET** /pipelines/{id}/deals | Get deals in a pipeline [**getPipelineMovementStatistics()**](PipelinesApi.md#getPipelineMovementStatistics) | **GET** /pipelines/{id}/movement_statistics | Get deals movements in pipeline -[**getPipelines()**](PipelinesApi.md#getPipelines) | **GET** /pipelines | Get all pipelines -[**updatePipeline()**](PipelinesApi.md#updatePipeline) | **PUT** /pipelines/{id} | Update a pipeline -## `addPipeline()` - -```php -addPipeline($pipeline): \Pipedrive\versions\v1\Model\AddNewPipeline -``` - -Add a new pipeline - -Adds a new pipeline. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\PipelinesApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$pipeline = new \Pipedrive\versions\v1\Model\Pipeline(); // \Pipedrive\versions\v1\Model\Pipeline - -try { - $result = $apiInstance->addPipeline($pipeline); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling PipelinesApi->addPipeline: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pipeline** | [**\Pipedrive\versions\v1\Model\Pipeline**](../Model/Pipeline.md)| | [optional] - -### Return type - -[**\Pipedrive\versions\v1\Model\AddNewPipeline**](../Model/AddNewPipeline.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: `application/json` -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -## `deletePipeline()` - -```php -deletePipeline($id): \Pipedrive\versions\v1\Model\DeletePipelineResponse -``` - -Delete a pipeline - -Marks a pipeline as deleted. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\PipelinesApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$id = 56; // int | The ID of the pipeline - -try { - $result = $apiInstance->deletePipeline($id); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling PipelinesApi->deletePipeline: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the pipeline | - -### Return type - -[**\Pipedrive\versions\v1\Model\DeletePipelineResponse**](../Model/DeletePipelineResponse.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -## `getPipeline()` - -```php -getPipeline($id): \Pipedrive\versions\v1\Model\GetOnePipeline -``` - -Get one pipeline - -Returns data about a specific pipeline. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\PipelinesApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$id = 56; // int | The ID of the pipeline - -try { - $result = $apiInstance->getPipeline($id); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling PipelinesApi->getPipeline: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the pipeline | - -### Return type - -[**\Pipedrive\versions\v1\Model\GetOnePipeline**](../Model/GetOnePipeline.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - ## `getPipelineConversionStatistics()` ```php @@ -431,132 +231,3 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -## `getPipelines()` - -```php -getPipelines(): \Pipedrive\versions\v1\Model\GetAllPipelines -``` - -Get all pipelines - -Returns data about all pipelines. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\PipelinesApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); - -try { - $result = $apiInstance->getPipelines(); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling PipelinesApi->getPipelines: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -This endpoint does not need any parameter. - -### Return type - -[**\Pipedrive\versions\v1\Model\GetAllPipelines**](../Model/GetAllPipelines.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -## `updatePipeline()` - -```php -updatePipeline($id, $pipeline): \Pipedrive\versions\v1\Model\EditPipeline -``` - -Update a pipeline - -Updates the properties of a pipeline. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\PipelinesApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$id = 56; // int | The ID of the pipeline -$pipeline = new \Pipedrive\versions\v1\Model\Pipeline(); // \Pipedrive\versions\v1\Model\Pipeline - -try { - $result = $apiInstance->updatePipeline($id, $pipeline); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling PipelinesApi->updatePipeline: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the pipeline | - **pipeline** | [**\Pipedrive\versions\v1\Model\Pipeline**](../Model/Pipeline.md)| | [optional] - -### Return type - -[**\Pipedrive\versions\v1\Model\EditPipeline**](../Model/EditPipeline.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: `application/json` -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) diff --git a/docs/versions/v1/Api/ProductsApi.md b/docs/versions/v1/Api/ProductsApi.md index 0fcae813..826591fd 100644 --- a/docs/versions/v1/Api/ProductsApi.md +++ b/docs/versions/v1/Api/ProductsApi.md @@ -4,85 +4,14 @@ All URIs are relative to https://api.pipedrive.com/v1. Method | HTTP request | Description ------------- | ------------- | ------------- -[**addProduct()**](ProductsApi.md#addProduct) | **POST** /products | Add a product [**addProductFollower()**](ProductsApi.md#addProductFollower) | **POST** /products/{id}/followers | Add a follower to a product -[**deleteProduct()**](ProductsApi.md#deleteProduct) | **DELETE** /products/{id} | Delete a product [**deleteProductFollower()**](ProductsApi.md#deleteProductFollower) | **DELETE** /products/{id}/followers/{follower_id} | Delete a follower from a product -[**getProduct()**](ProductsApi.md#getProduct) | **GET** /products/{id} | Get one product [**getProductDeals()**](ProductsApi.md#getProductDeals) | **GET** /products/{id}/deals | Get deals where a product is attached to [**getProductFiles()**](ProductsApi.md#getProductFiles) | **GET** /products/{id}/files | List files attached to a product [**getProductFollowers()**](ProductsApi.md#getProductFollowers) | **GET** /products/{id}/followers | List followers of a product [**getProductUsers()**](ProductsApi.md#getProductUsers) | **GET** /products/{id}/permittedUsers | List permitted users -[**getProducts()**](ProductsApi.md#getProducts) | **GET** /products | Get all products -[**searchProducts()**](ProductsApi.md#searchProducts) | **GET** /products/search | Search products -[**updateProduct()**](ProductsApi.md#updateProduct) | **PUT** /products/{id} | Update a product -## `addProduct()` - -```php -addProduct($add_product_request_body): \Pipedrive\versions\v1\Model\ProductResponse -``` - -Add a product - -Adds a new product to the Products inventory. For more information, see the tutorial for adding a product. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\ProductsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$add_product_request_body = new \Pipedrive\versions\v1\Model\AddProductRequestBody(); // \Pipedrive\versions\v1\Model\AddProductRequestBody - -try { - $result = $apiInstance->addProduct($add_product_request_body); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling ProductsApi->addProduct: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **add_product_request_body** | [**\Pipedrive\versions\v1\Model\AddProductRequestBody**](../Model/AddProductRequestBody.md)| | [optional] - -### Return type - -[**\Pipedrive\versions\v1\Model\ProductResponse**](../Model/ProductResponse.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: `application/json` -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - ## `addProductFollower()` ```php @@ -150,71 +79,6 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `deleteProduct()` - -```php -deleteProduct($id): \Pipedrive\versions\v1\Model\DeleteProductResponse -``` - -Delete a product - -Marks a product as deleted. After 30 days, the product will be permanently deleted. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\ProductsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$id = 56; // int | The ID of the product - -try { - $result = $apiInstance->deleteProduct($id); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling ProductsApi->deleteProduct: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the product | - -### Return type - -[**\Pipedrive\versions\v1\Model\DeleteProductResponse**](../Model/DeleteProductResponse.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - ## `deleteProductFollower()` ```php @@ -282,71 +146,6 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `getProduct()` - -```php -getProduct($id): \Pipedrive\versions\v1\Model\ProductResponse -``` - -Get one product - -Returns data about a specific product. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\ProductsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$id = 56; // int | The ID of the product - -try { - $result = $apiInstance->getProduct($id); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling ProductsApi->getProduct: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the product | - -### Return type - -[**\Pipedrive\versions\v1\Model\ProductResponse**](../Model/ProductResponse.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - ## `getProductDeals()` ```php @@ -622,222 +421,3 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -## `getProducts()` - -```php -getProducts($user_id, $filter_id, $ids, $first_char, $get_summary, $start, $limit): \Pipedrive\versions\v1\Model\ProductsResponse -``` - -Get all products - -Returns data about all products. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\ProductsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$user_id = 56; // int | If supplied, only products owned by the given user will be returned -$filter_id = 56; // int | The ID of the filter to use -$ids = array(56); // int[] | An array of integers with the IDs of the products that should be returned in the response -$first_char = 'first_char_example'; // string | If supplied, only products whose name starts with the specified letter will be returned (case-insensitive) -$get_summary = True; // bool | If supplied, the response will return the total numbers of products in the `additional_data.summary.total_count` property -$start = 0; // int | Pagination start -$limit = 56; // int | Items shown per page - -try { - $result = $apiInstance->getProducts($user_id, $filter_id, $ids, $first_char, $get_summary, $start, $limit); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling ProductsApi->getProducts: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **user_id** | **int**| If supplied, only products owned by the given user will be returned | [optional] - **filter_id** | **int**| The ID of the filter to use | [optional] - **ids** | [**int[]**](../Model/int.md)| An array of integers with the IDs of the products that should be returned in the response | [optional] - **first_char** | **string**| If supplied, only products whose name starts with the specified letter will be returned (case-insensitive) | [optional] - **get_summary** | **bool**| If supplied, the response will return the total numbers of products in the `additional_data.summary.total_count` property | [optional] - **start** | **int**| Pagination start | [optional] [default to 0] - **limit** | **int**| Items shown per page | [optional] - -### Return type - -[**\Pipedrive\versions\v1\Model\ProductsResponse**](../Model/ProductsResponse.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -## `searchProducts()` - -```php -searchProducts($term, $fields, $exact_match, $include_fields, $start, $limit): \Pipedrive\versions\v1\Model\ProductSearchResponse -``` - -Search products - -Searches all products by name, code and/or custom fields. This endpoint is a wrapper of /v1/itemSearch with a narrower OAuth scope. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\ProductsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$term = 'term_example'; // string | The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded. -$fields = 'fields_example'; // string | A comma-separated string array. The fields to perform the search from. Defaults to all of them. Only the following custom field types are searchable: `address`, `varchar`, `text`, `varchar_auto`, `double`, `monetary` and `phone`. Read more about searching by custom fields here. -$exact_match = True; // bool | When enabled, only full exact matches against the given term are returned. It is not case sensitive. -$include_fields = 'include_fields_example'; // string | Supports including optional fields in the results which are not provided by default -$start = 0; // int | Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter. -$limit = 56; // int | Items shown per page - -try { - $result = $apiInstance->searchProducts($term, $fields, $exact_match, $include_fields, $start, $limit); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling ProductsApi->searchProducts: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **term** | **string**| The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded. | - **fields** | **string**| A comma-separated string array. The fields to perform the search from. Defaults to all of them. Only the following custom field types are searchable: `address`, `varchar`, `text`, `varchar_auto`, `double`, `monetary` and `phone`. Read more about searching by custom fields <a href=\"https://support.pipedrive.com/en/article/search-finding-what-you-need#searching-by-custom-fields\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>. | [optional] - **exact_match** | **bool**| When enabled, only full exact matches against the given term are returned. It is <b>not</b> case sensitive. | [optional] - **include_fields** | **string**| Supports including optional fields in the results which are not provided by default | [optional] - **start** | **int**| Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter. | [optional] [default to 0] - **limit** | **int**| Items shown per page | [optional] - -### Return type - -[**\Pipedrive\versions\v1\Model\ProductSearchResponse**](../Model/ProductSearchResponse.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -## `updateProduct()` - -```php -updateProduct($id, $update_product_request_body): \Pipedrive\versions\v1\Model\UpdateProductResponse -``` - -Update a product - -Updates product data. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\ProductsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$id = 56; // int | The ID of the product -$update_product_request_body = new \Pipedrive\versions\v1\Model\UpdateProductRequestBody(); // \Pipedrive\versions\v1\Model\UpdateProductRequestBody - -try { - $result = $apiInstance->updateProduct($id, $update_product_request_body); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling ProductsApi->updateProduct: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the product | - **update_product_request_body** | [**\Pipedrive\versions\v1\Model\UpdateProductRequestBody**](../Model/UpdateProductRequestBody.md)| | [optional] - -### Return type - -[**\Pipedrive\versions\v1\Model\UpdateProductResponse**](../Model/UpdateProductResponse.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: `application/json` -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) diff --git a/docs/versions/v1/Api/StagesApi.md b/docs/versions/v1/Api/StagesApi.md index 78ab1618..17859063 100644 --- a/docs/versions/v1/Api/StagesApi.md +++ b/docs/versions/v1/Api/StagesApi.md @@ -4,209 +4,9 @@ All URIs are relative to https://api.pipedrive.com/v1. Method | HTTP request | Description ------------- | ------------- | ------------- -[**addStage()**](StagesApi.md#addStage) | **POST** /stages | Add a new stage -[**deleteStage()**](StagesApi.md#deleteStage) | **DELETE** /stages/{id} | Delete a stage -[**getStage()**](StagesApi.md#getStage) | **GET** /stages/{id} | Get one stage [**getStageDeals()**](StagesApi.md#getStageDeals) | **GET** /stages/{id}/deals | Get deals in a stage -[**getStages()**](StagesApi.md#getStages) | **GET** /stages | Get all stages -[**updateStage()**](StagesApi.md#updateStage) | **PUT** /stages/{id} | Update stage details -## `addStage()` - -```php -addStage($stage): \Pipedrive\versions\v1\Model\GetAddUpdateStage -``` - -Add a new stage - -Adds a new stage, returns the ID upon success. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\StagesApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$stage = new \Pipedrive\versions\v1\Model\Stage(); // \Pipedrive\versions\v1\Model\Stage - -try { - $result = $apiInstance->addStage($stage); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling StagesApi->addStage: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **stage** | [**\Pipedrive\versions\v1\Model\Stage**](../Model/Stage.md)| | [optional] - -### Return type - -[**\Pipedrive\versions\v1\Model\GetAddUpdateStage**](../Model/GetAddUpdateStage.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: `application/json` -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -## `deleteStage()` - -```php -deleteStage($id): \Pipedrive\versions\v1\Model\DeleteStageResponse -``` - -Delete a stage - -Marks a stage as deleted. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\StagesApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$id = 56; // int | The ID of the stage - -try { - $result = $apiInstance->deleteStage($id); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling StagesApi->deleteStage: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the stage | - -### Return type - -[**\Pipedrive\versions\v1\Model\DeleteStageResponse**](../Model/DeleteStageResponse.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -## `getStage()` - -```php -getStage($id): \Pipedrive\versions\v1\Model\GetOneStage -``` - -Get one stage - -Returns data about a specific stage. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\StagesApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$id = 56; // int | The ID of the stage - -try { - $result = $apiInstance->getStage($id); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling StagesApi->getStage: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the stage | - -### Return type - -[**\Pipedrive\versions\v1\Model\GetOneStage**](../Model/GetOneStage.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - ## `getStageDeals()` ```php @@ -281,139 +81,3 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -## `getStages()` - -```php -getStages($pipeline_id, $start, $limit): \Pipedrive\versions\v1\Model\GetStages -``` - -Get all stages - -Returns data about all stages. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\StagesApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$pipeline_id = 56; // int | The ID of the pipeline to fetch stages for. If omitted, stages for all pipelines will be fetched. -$start = 0; // int | Pagination start -$limit = 56; // int | Items shown per page - -try { - $result = $apiInstance->getStages($pipeline_id, $start, $limit); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling StagesApi->getStages: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pipeline_id** | **int**| The ID of the pipeline to fetch stages for. If omitted, stages for all pipelines will be fetched. | [optional] - **start** | **int**| Pagination start | [optional] [default to 0] - **limit** | **int**| Items shown per page | [optional] - -### Return type - -[**\Pipedrive\versions\v1\Model\GetStages**](../Model/GetStages.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -## `updateStage()` - -```php -updateStage($id, $update_stage_request): \Pipedrive\versions\v1\Model\GetAddUpdateStage -``` - -Update stage details - -Updates the properties of a stage. - -### Example - -```php -setApiKey('x-api-token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = (new Pipedrive\versions\v1\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v1\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v1\Api\StagesApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$id = 56; // int | The ID of the stage -$update_stage_request = new \Pipedrive\versions\v1\Model\UpdateStageRequest(); // \Pipedrive\versions\v1\Model\UpdateStageRequest - -try { - $result = $apiInstance->updateStage($id, $update_stage_request); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling StagesApi->updateStage: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the stage | - **update_stage_request** | [**\Pipedrive\versions\v1\Model\UpdateStageRequest**](../Model/UpdateStageRequest.md)| | [optional] - -### Return type - -[**\Pipedrive\versions\v1\Model\GetAddUpdateStage**](../Model/GetAddUpdateStage.md) - -### Authorization - -[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) - -### HTTP request headers - -- **Content-Type**: `application/json` -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) diff --git a/docs/versions/v1/Model/BasePersonItem.md b/docs/versions/v1/Model/BasePersonItem.md index e9d068b1..4f040f36 100644 --- a/docs/versions/v1/Model/BasePersonItem.md +++ b/docs/versions/v1/Model/BasePersonItem.md @@ -13,7 +13,7 @@ Name | Type | Description | Notes **add_time** | **string** | The date and time when the person was added/created. Format: YYYY-MM-DD HH:MM:SS | [optional] **update_time** | **string** | The last updated date and time of the person. Format: YYYY-MM-DD HH:MM:SS | [optional] **visible_to** | **string** | The visibility group ID of who can see the person | [optional] -**picture_id** | [**\Pipedrive\versions\v1\Model\PictureDataWithID**](PictureDataWithID.md) | | [optional] +**picture_id** | [**\Pipedrive\versions\v1\Model\PictureDataWithID1**](PictureDataWithID1.md) | | [optional] **label** | **int** | The label assigned to the person. When the `label` field is updated, the `label_ids` field value will be overwritten by the `label` field value. | [optional] **label_ids** | **int[]** | The IDs of labels assigned to the person. When the `label_ids` field is updated, the `label` field value will be set to the first value of the `label_ids` field. | [optional] **org_name** | **string** | The name of the organization associated with the person | [optional] diff --git a/docs/versions/v1/Model/LeadResponse.md b/docs/versions/v1/Model/LeadResponse.md index 6ffcdb42..10cec6ac 100644 --- a/docs/versions/v1/Model/LeadResponse.md +++ b/docs/versions/v1/Model/LeadResponse.md @@ -16,6 +16,7 @@ Name | Type | Description | Notes **origin_id** | **string** | The optional ID to further distinguish the origin of the lead - e.g. Which API integration created this Lead. | [optional] **channel** | **int** | The ID of your Marketing channel this Lead was created from. Recognized Marketing channels can be configured in your <a href=\"https://app.pipedrive.com/settings/fields\" target=\"_blank\" rel=\"noopener noreferrer\">Company settings</a>. | [optional] **channel_id** | **string** | The optional ID to further distinguish the Marketing channel. | [optional] +**source_deal_id** | **int** | The ID of the deal if the lead was converted from a deal. | [optional] **is_archived** | **bool** | A flag indicating whether the lead is archived or not | [optional] **was_seen** | **bool** | A flag indicating whether the lead was seen by someone in the Pipedrive UI | [optional] **value** | [**\Pipedrive\versions\v1\Model\LeadValue**](LeadValue.md) | | [optional] diff --git a/docs/versions/v1/Model/MergePersonItem.md b/docs/versions/v1/Model/MergePersonItem.md index 4c0cfeca..a6f1ae0b 100644 --- a/docs/versions/v1/Model/MergePersonItem.md +++ b/docs/versions/v1/Model/MergePersonItem.md @@ -13,7 +13,7 @@ Name | Type | Description | Notes **add_time** | **string** | The date and time when the person was added/created. Format: YYYY-MM-DD HH:MM:SS | [optional] **update_time** | **string** | The last updated date and time of the person. Format: YYYY-MM-DD HH:MM:SS | [optional] **visible_to** | **string** | The visibility group ID of who can see the person | [optional] -**picture_id** | [**\Pipedrive\versions\v1\Model\PictureDataWithID**](PictureDataWithID.md) | | [optional] +**picture_id** | [**\Pipedrive\versions\v1\Model\PictureDataWithID1**](PictureDataWithID1.md) | | [optional] **label** | **int** | The label assigned to the person. When the `label` field is updated, the `label_ids` field value will be overwritten by the `label` field value. | [optional] **label_ids** | **int[]** | The IDs of labels assigned to the person. When the `label_ids` field is updated, the `label` field value will be set to the first value of the `label_ids` field. | [optional] **org_name** | **string** | The name of the organization associated with the person | [optional] diff --git a/docs/versions/v1/Model/PersonItem.md b/docs/versions/v1/Model/PersonItem.md index 91c8f7c7..43ac1d4b 100644 --- a/docs/versions/v1/Model/PersonItem.md +++ b/docs/versions/v1/Model/PersonItem.md @@ -13,7 +13,7 @@ Name | Type | Description | Notes **add_time** | **string** | The date and time when the person was added/created. Format: YYYY-MM-DD HH:MM:SS | [optional] **update_time** | **string** | The last updated date and time of the person. Format: YYYY-MM-DD HH:MM:SS | [optional] **visible_to** | **string** | The visibility group ID of who can see the person | [optional] -**picture_id** | [**\Pipedrive\versions\v1\Model\PictureDataWithID**](PictureDataWithID.md) | | [optional] +**picture_id** | [**\Pipedrive\versions\v1\Model\PictureDataWithID1**](PictureDataWithID1.md) | | [optional] **label** | **int** | The label assigned to the person. When the `label` field is updated, the `label_ids` field value will be overwritten by the `label` field value. | [optional] **label_ids** | **int[]** | The IDs of labels assigned to the person. When the `label_ids` field is updated, the `label` field value will be set to the first value of the `label_ids` field. | [optional] **org_name** | **string** | The name of the organization associated with the person | [optional] diff --git a/docs/versions/v1/Model/PictureData.md b/docs/versions/v1/Model/PictureData.md index 43339eb5..30ecc623 100644 --- a/docs/versions/v1/Model/PictureData.md +++ b/docs/versions/v1/Model/PictureData.md @@ -10,6 +10,6 @@ Name | Type | Description | Notes **add_time** | **string** | The add time of the picture | [optional] **update_time** | **string** | The update time of the picture | [optional] **added_by_user_id** | **int** | The ID of the user who added the picture | [optional] -**pictures** | [**\Pipedrive\versions\v1\Model\PictureDataPictures**](PictureDataPictures.md) | | [optional] +**pictures** | [**\Pipedrive\versions\v1\Model\PictureDataWithID1Pictures**](PictureDataWithID1Pictures.md) | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/versions/v1/Model/PictureDataWithID.md b/docs/versions/v1/Model/PictureDataWithID.md index ce6ab40c..54493366 100644 --- a/docs/versions/v1/Model/PictureDataWithID.md +++ b/docs/versions/v1/Model/PictureDataWithID.md @@ -11,6 +11,6 @@ Name | Type | Description | Notes **add_time** | **string** | The add time of the picture | [optional] **update_time** | **string** | The update time of the picture | [optional] **added_by_user_id** | **int** | The ID of the user who added the picture | [optional] -**pictures** | [**\Pipedrive\versions\v1\Model\PictureDataPictures**](PictureDataPictures.md) | | [optional] +**pictures** | [**\Pipedrive\versions\v1\Model\PictureDataWithID1Pictures**](PictureDataWithID1Pictures.md) | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/versions/v1/Model/PictureDataWithID1.md b/docs/versions/v1/Model/PictureDataWithID1.md index 5b673bf4..180430cb 100644 --- a/docs/versions/v1/Model/PictureDataWithID1.md +++ b/docs/versions/v1/Model/PictureDataWithID1.md @@ -5,5 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **int** | The ID of the picture associated with the item | [optional] +**item_type** | **string** | The type of item the picture is related to | [optional] +**item_id** | **int** | The ID of related item | [optional] +**active_flag** | **bool** | Whether the associated picture is active or not | [optional] +**add_time** | **string** | The add time of the picture | [optional] +**update_time** | **string** | The update time of the picture | [optional] +**added_by_user_id** | **int** | The ID of the user who added the picture | [optional] +**pictures** | [**\Pipedrive\versions\v1\Model\PictureDataWithID1Pictures**](PictureDataWithID1Pictures.md) | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/versions/v1/Model/PictureDataWithID1Pictures.md b/docs/versions/v1/Model/PictureDataWithID1Pictures.md new file mode 100644 index 00000000..5d7ddc99 --- /dev/null +++ b/docs/versions/v1/Model/PictureDataWithID1Pictures.md @@ -0,0 +1,10 @@ +# # PictureDataWithID1Pictures + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**_128** | **string** | The URL of the 128*128 picture | [optional] +**_512** | **string** | The URL of the 512*512 picture | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/versions/v1/Model/PictureDataWithID2.md b/docs/versions/v1/Model/PictureDataWithID2.md new file mode 100644 index 00000000..aad774ac --- /dev/null +++ b/docs/versions/v1/Model/PictureDataWithID2.md @@ -0,0 +1,9 @@ +# # PictureDataWithID2 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | The ID of the picture associated with the item | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/versions/v1/Model/PictureDataWithValue.md b/docs/versions/v1/Model/PictureDataWithValue.md index 89d52f01..72d74ab4 100644 --- a/docs/versions/v1/Model/PictureDataWithValue.md +++ b/docs/versions/v1/Model/PictureDataWithValue.md @@ -11,6 +11,6 @@ Name | Type | Description | Notes **add_time** | **string** | The add time of the picture | [optional] **update_time** | **string** | The update time of the picture | [optional] **added_by_user_id** | **int** | The ID of the user who added the picture | [optional] -**pictures** | [**\Pipedrive\versions\v1\Model\PictureDataPictures**](PictureDataPictures.md) | | [optional] +**pictures** | [**\Pipedrive\versions\v1\Model\PictureDataWithID1Pictures**](PictureDataWithID1Pictures.md) | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/versions/v1/Model/ProjectMandatoryObjectFragment.md b/docs/versions/v1/Model/ProjectMandatoryObjectFragment.md index e06b5ec9..314aa8c5 100644 --- a/docs/versions/v1/Model/ProjectMandatoryObjectFragment.md +++ b/docs/versions/v1/Model/ProjectMandatoryObjectFragment.md @@ -5,7 +5,5 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **title** | **string** | The title of the project | [optional] -**board_id** | **float** | The ID of the board this project is associated with | [optional] -**phase_id** | **float** | The ID of the phase this project is associated with | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/versions/v1/Model/ProjectObjectFragment.md b/docs/versions/v1/Model/ProjectObjectFragment.md index 26415f54..64fc271d 100644 --- a/docs/versions/v1/Model/ProjectObjectFragment.md +++ b/docs/versions/v1/Model/ProjectObjectFragment.md @@ -4,6 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**board_id** | **float** | The ID of the board this project is associated with | [optional] +**phase_id** | **float** | The ID of the phase this project is associated with | [optional] **description** | **string** | The description of the project | [optional] **status** | **string** | The status of the project | [optional] **owner_id** | **float** | The ID of a project owner | [optional] diff --git a/docs/versions/v1/Model/ProjectPostObject.md b/docs/versions/v1/Model/ProjectPostObject.md index 89a31da9..264dd682 100644 --- a/docs/versions/v1/Model/ProjectPostObject.md +++ b/docs/versions/v1/Model/ProjectPostObject.md @@ -5,8 +5,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **title** | **string** | The title of the project | -**board_id** | **float** | The ID of a project board | -**phase_id** | **float** | The ID of a phase on a project board | +**board_id** | **float** | The ID of the board this project is associated with | [optional] +**phase_id** | **float** | The ID of the phase this project is associated with | [optional] **description** | **string** | The description of the project | [optional] **status** | **string** | The status of the project | [optional] **owner_id** | **float** | The ID of a project owner | [optional] diff --git a/docs/versions/v1/Model/RelationshipOrganizationInfoItemWithActiveFlag.md b/docs/versions/v1/Model/RelationshipOrganizationInfoItemWithActiveFlag.md index a10dd0c8..249de1ba 100644 --- a/docs/versions/v1/Model/RelationshipOrganizationInfoItemWithActiveFlag.md +++ b/docs/versions/v1/Model/RelationshipOrganizationInfoItemWithActiveFlag.md @@ -9,6 +9,7 @@ Name | Type | Description | Notes **owner_id** | **int** | The ID of the owner of the organization that is associated with the item | [optional] **address** | **string** | The address of the organization | [optional] **cc_email** | **string** | The BCC email of the organization associated with the item | [optional] +**label_ids** | **int[]** | The IDs of labels assigned to the organization | [optional] **value** | **int** | The ID of the organization | [optional] **active_flag** | **bool** | Whether the associated organization is active or not | [optional] diff --git a/docs/versions/v1/Model/RequiredPostProjectParameters.md b/docs/versions/v1/Model/RequiredPostProjectParameters.md index 8774b6d3..2955d16d 100644 --- a/docs/versions/v1/Model/RequiredPostProjectParameters.md +++ b/docs/versions/v1/Model/RequiredPostProjectParameters.md @@ -5,7 +5,5 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **title** | **string** | The title of the project | -**board_id** | **float** | The ID of a project board | -**phase_id** | **float** | The ID of a phase on a project board | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/versions/v1/README.md b/docs/versions/v1/README.md index 5b29253a..6f0ef5f6 100644 --- a/docs/versions/v1/README.md +++ b/docs/versions/v1/README.md @@ -265,12 +265,6 @@ All URIs are relative to *https://api.pipedrive.com/v1* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*ActivitiesApi* | [**addActivity**](Api/ActivitiesApi.md#addactivity) | **POST** /activities | Add an activity -*ActivitiesApi* | [**deleteActivity**](Api/ActivitiesApi.md#deleteactivity) | **DELETE** /activities/{id} | Delete an activity -*ActivitiesApi* | [**getActivities**](Api/ActivitiesApi.md#getactivities) | **GET** /activities | Get all activities assigned to a particular user -*ActivitiesApi* | [**getActivitiesCollection**](Api/ActivitiesApi.md#getactivitiescollection) | **GET** /activities/collection | Get all activities collection -*ActivitiesApi* | [**getActivity**](Api/ActivitiesApi.md#getactivity) | **GET** /activities/{id} | Get details of an activity -*ActivitiesApi* | [**updateActivity**](Api/ActivitiesApi.md#updateactivity) | **PUT** /activities/{id} | Update an activity *ActivityFieldsApi* | [**getActivityFields**](Api/ActivityFieldsApi.md#getactivityfields) | **GET** /activityFields | Get all activity fields *ActivityTypesApi* | [**addActivityType**](Api/ActivityTypesApi.md#addactivitytype) | **POST** /activityTypes | Add new activity type *ActivityTypesApi* | [**deleteActivityType**](Api/ActivityTypesApi.md#deleteactivitytype) | **DELETE** /activityTypes/{id} | Delete an activity type @@ -293,38 +287,25 @@ Class | Method | HTTP request | Description *DealFieldsApi* | [**getDealField**](Api/DealFieldsApi.md#getdealfield) | **GET** /dealFields/{id} | Get one deal field *DealFieldsApi* | [**getDealFields**](Api/DealFieldsApi.md#getdealfields) | **GET** /dealFields | Get all deal fields *DealFieldsApi* | [**updateDealField**](Api/DealFieldsApi.md#updatedealfield) | **PUT** /dealFields/{id} | Update a deal field -*DealsApi* | [**addDeal**](Api/DealsApi.md#adddeal) | **POST** /deals | Add a deal *DealsApi* | [**addDealFollower**](Api/DealsApi.md#adddealfollower) | **POST** /deals/{id}/followers | Add a follower to a deal *DealsApi* | [**addDealParticipant**](Api/DealsApi.md#adddealparticipant) | **POST** /deals/{id}/participants | Add a participant to a deal -*DealsApi* | [**addDealProduct**](Api/DealsApi.md#adddealproduct) | **POST** /deals/{id}/products | Add a product to a deal -*DealsApi* | [**deleteDeal**](Api/DealsApi.md#deletedeal) | **DELETE** /deals/{id} | Delete a deal *DealsApi* | [**deleteDealFollower**](Api/DealsApi.md#deletedealfollower) | **DELETE** /deals/{id}/followers/{follower_id} | Delete a follower from a deal *DealsApi* | [**deleteDealParticipant**](Api/DealsApi.md#deletedealparticipant) | **DELETE** /deals/{id}/participants/{deal_participant_id} | Delete a participant from a deal -*DealsApi* | [**deleteDealProduct**](Api/DealsApi.md#deletedealproduct) | **DELETE** /deals/{id}/products/{product_attachment_id} | Delete an attached product from a deal *DealsApi* | [**duplicateDeal**](Api/DealsApi.md#duplicatedeal) | **POST** /deals/{id}/duplicate | Duplicate deal *DealsApi* | [**getArchivedDeals**](Api/DealsApi.md#getarchiveddeals) | **GET** /deals/archived | Get all archived deals *DealsApi* | [**getArchivedDealsSummary**](Api/DealsApi.md#getarchiveddealssummary) | **GET** /deals/summary/archived | Get archived deals summary *DealsApi* | [**getArchivedDealsTimeline**](Api/DealsApi.md#getarchiveddealstimeline) | **GET** /deals/timeline/archived | Get archived deals timeline -*DealsApi* | [**getDeal**](Api/DealsApi.md#getdeal) | **GET** /deals/{id} | Get details of a deal -*DealsApi* | [**getDealActivities**](Api/DealsApi.md#getdealactivities) | **GET** /deals/{id}/activities | List activities associated with a deal *DealsApi* | [**getDealChangelog**](Api/DealsApi.md#getdealchangelog) | **GET** /deals/{id}/changelog | List updates about deal field values *DealsApi* | [**getDealFiles**](Api/DealsApi.md#getdealfiles) | **GET** /deals/{id}/files | List files attached to a deal *DealsApi* | [**getDealFollowers**](Api/DealsApi.md#getdealfollowers) | **GET** /deals/{id}/followers | List followers of a deal *DealsApi* | [**getDealMailMessages**](Api/DealsApi.md#getdealmailmessages) | **GET** /deals/{id}/mailMessages | List mail messages associated with a deal *DealsApi* | [**getDealParticipants**](Api/DealsApi.md#getdealparticipants) | **GET** /deals/{id}/participants | List participants of a deal *DealsApi* | [**getDealParticipantsChangelog**](Api/DealsApi.md#getdealparticipantschangelog) | **GET** /deals/{id}/participantsChangelog | List updates about participants of a deal -*DealsApi* | [**getDealPersons**](Api/DealsApi.md#getdealpersons) | **GET** /deals/{id}/persons | List all persons associated with a deal -*DealsApi* | [**getDealProducts**](Api/DealsApi.md#getdealproducts) | **GET** /deals/{id}/products | List products attached to a deal *DealsApi* | [**getDealUpdates**](Api/DealsApi.md#getdealupdates) | **GET** /deals/{id}/flow | List updates about a deal *DealsApi* | [**getDealUsers**](Api/DealsApi.md#getdealusers) | **GET** /deals/{id}/permittedUsers | List permitted users -*DealsApi* | [**getDeals**](Api/DealsApi.md#getdeals) | **GET** /deals | Get all deals -*DealsApi* | [**getDealsCollection**](Api/DealsApi.md#getdealscollection) | **GET** /deals/collection | Get all deals collection *DealsApi* | [**getDealsSummary**](Api/DealsApi.md#getdealssummary) | **GET** /deals/summary | Get deals summary *DealsApi* | [**getDealsTimeline**](Api/DealsApi.md#getdealstimeline) | **GET** /deals/timeline | Get deals timeline *DealsApi* | [**mergeDeals**](Api/DealsApi.md#mergedeals) | **PUT** /deals/{id}/merge | Merge two deals -*DealsApi* | [**searchDeals**](Api/DealsApi.md#searchdeals) | **GET** /deals/search | Search deals -*DealsApi* | [**updateDeal**](Api/DealsApi.md#updatedeal) | **PUT** /deals/{id} | Update a deal -*DealsApi* | [**updateDealProduct**](Api/DealsApi.md#updatedealproduct) | **PUT** /deals/{id}/products/{product_attachment_id} | Update the product attached to a deal *FilesApi* | [**addFile**](Api/FilesApi.md#addfile) | **POST** /files | Add file *FilesApi* | [**addFileAndLinkIt**](Api/FilesApi.md#addfileandlinkit) | **POST** /files/remote | Create a remote file and link it to an item *FilesApi* | [**deleteFile**](Api/FilesApi.md#deletefile) | **DELETE** /files/{id} | Delete a file @@ -345,8 +326,6 @@ Class | Method | HTTP request | Description *GoalsApi* | [**getGoalResult**](Api/GoalsApi.md#getgoalresult) | **GET** /goals/{id}/results | Get result of a goal *GoalsApi* | [**getGoals**](Api/GoalsApi.md#getgoals) | **GET** /goals/find | Find goals *GoalsApi* | [**updateGoal**](Api/GoalsApi.md#updategoal) | **PUT** /goals/{id} | Update existing goal -*ItemSearchApi* | [**searchItem**](Api/ItemSearchApi.md#searchitem) | **GET** /itemSearch | Perform a search from multiple item types -*ItemSearchApi* | [**searchItemByField**](Api/ItemSearchApi.md#searchitembyfield) | **GET** /itemSearch/field | Perform a search using a specific field from an item type *LeadFieldsApi* | [**getLeadFields**](Api/LeadFieldsApi.md#getleadfields) | **GET** /leadFields | Get all lead fields *LeadLabelsApi* | [**addLeadLabel**](Api/LeadLabelsApi.md#addleadlabel) | **POST** /leadLabels | Add a lead label *LeadLabelsApi* | [**deleteLeadLabel**](Api/LeadLabelsApi.md#deleteleadlabel) | **DELETE** /leadLabels/{id} | Delete a lead label @@ -399,25 +378,15 @@ Class | Method | HTTP request | Description *OrganizationRelationshipsApi* | [**getOrganizationRelationship**](Api/OrganizationRelationshipsApi.md#getorganizationrelationship) | **GET** /organizationRelationships/{id} | Get one organization relationship *OrganizationRelationshipsApi* | [**getOrganizationRelationships**](Api/OrganizationRelationshipsApi.md#getorganizationrelationships) | **GET** /organizationRelationships | Get all relationships for organization *OrganizationRelationshipsApi* | [**updateOrganizationRelationship**](Api/OrganizationRelationshipsApi.md#updateorganizationrelationship) | **PUT** /organizationRelationships/{id} | Update an organization relationship -*OrganizationsApi* | [**addOrganization**](Api/OrganizationsApi.md#addorganization) | **POST** /organizations | Add an organization *OrganizationsApi* | [**addOrganizationFollower**](Api/OrganizationsApi.md#addorganizationfollower) | **POST** /organizations/{id}/followers | Add a follower to an organization -*OrganizationsApi* | [**deleteOrganization**](Api/OrganizationsApi.md#deleteorganization) | **DELETE** /organizations/{id} | Delete an organization *OrganizationsApi* | [**deleteOrganizationFollower**](Api/OrganizationsApi.md#deleteorganizationfollower) | **DELETE** /organizations/{id}/followers/{follower_id} | Delete a follower from an organization -*OrganizationsApi* | [**getOrganization**](Api/OrganizationsApi.md#getorganization) | **GET** /organizations/{id} | Get details of an organization -*OrganizationsApi* | [**getOrganizationActivities**](Api/OrganizationsApi.md#getorganizationactivities) | **GET** /organizations/{id}/activities | List activities associated with an organization *OrganizationsApi* | [**getOrganizationChangelog**](Api/OrganizationsApi.md#getorganizationchangelog) | **GET** /organizations/{id}/changelog | List updates about organization field values -*OrganizationsApi* | [**getOrganizationDeals**](Api/OrganizationsApi.md#getorganizationdeals) | **GET** /organizations/{id}/deals | List deals associated with an organization *OrganizationsApi* | [**getOrganizationFiles**](Api/OrganizationsApi.md#getorganizationfiles) | **GET** /organizations/{id}/files | List files attached to an organization *OrganizationsApi* | [**getOrganizationFollowers**](Api/OrganizationsApi.md#getorganizationfollowers) | **GET** /organizations/{id}/followers | List followers of an organization *OrganizationsApi* | [**getOrganizationMailMessages**](Api/OrganizationsApi.md#getorganizationmailmessages) | **GET** /organizations/{id}/mailMessages | List mail messages associated with an organization -*OrganizationsApi* | [**getOrganizationPersons**](Api/OrganizationsApi.md#getorganizationpersons) | **GET** /organizations/{id}/persons | List persons of an organization *OrganizationsApi* | [**getOrganizationUpdates**](Api/OrganizationsApi.md#getorganizationupdates) | **GET** /organizations/{id}/flow | List updates about an organization *OrganizationsApi* | [**getOrganizationUsers**](Api/OrganizationsApi.md#getorganizationusers) | **GET** /organizations/{id}/permittedUsers | List permitted users -*OrganizationsApi* | [**getOrganizations**](Api/OrganizationsApi.md#getorganizations) | **GET** /organizations | Get all organizations -*OrganizationsApi* | [**getOrganizationsCollection**](Api/OrganizationsApi.md#getorganizationscollection) | **GET** /organizations/collection | Get all organizations collection *OrganizationsApi* | [**mergeOrganizations**](Api/OrganizationsApi.md#mergeorganizations) | **PUT** /organizations/{id}/merge | Merge two organizations -*OrganizationsApi* | [**searchOrganization**](Api/OrganizationsApi.md#searchorganization) | **GET** /organizations/search | Search organizations -*OrganizationsApi* | [**updateOrganization**](Api/OrganizationsApi.md#updateorganization) | **PUT** /organizations/{id} | Update an organization *PermissionSetsApi* | [**getPermissionSet**](Api/PermissionSetsApi.md#getpermissionset) | **GET** /permissionSets/{id} | Get one permission set *PermissionSetsApi* | [**getPermissionSetAssignments**](Api/PermissionSetsApi.md#getpermissionsetassignments) | **GET** /permissionSets/{id}/assignments | List permission set assignments *PermissionSetsApi* | [**getPermissionSets**](Api/PermissionSetsApi.md#getpermissionsets) | **GET** /permissionSets | Get all permission sets @@ -427,53 +396,33 @@ Class | Method | HTTP request | Description *PersonFieldsApi* | [**getPersonField**](Api/PersonFieldsApi.md#getpersonfield) | **GET** /personFields/{id} | Get one person field *PersonFieldsApi* | [**getPersonFields**](Api/PersonFieldsApi.md#getpersonfields) | **GET** /personFields | Get all person fields *PersonFieldsApi* | [**updatePersonField**](Api/PersonFieldsApi.md#updatepersonfield) | **PUT** /personFields/{id} | Update a person field -*PersonsApi* | [**addPerson**](Api/PersonsApi.md#addperson) | **POST** /persons | Add a person *PersonsApi* | [**addPersonFollower**](Api/PersonsApi.md#addpersonfollower) | **POST** /persons/{id}/followers | Add a follower to a person *PersonsApi* | [**addPersonPicture**](Api/PersonsApi.md#addpersonpicture) | **POST** /persons/{id}/picture | Add person picture -*PersonsApi* | [**deletePerson**](Api/PersonsApi.md#deleteperson) | **DELETE** /persons/{id} | Delete a person *PersonsApi* | [**deletePersonFollower**](Api/PersonsApi.md#deletepersonfollower) | **DELETE** /persons/{id}/followers/{follower_id} | Delete a follower from a person *PersonsApi* | [**deletePersonPicture**](Api/PersonsApi.md#deletepersonpicture) | **DELETE** /persons/{id}/picture | Delete person picture -*PersonsApi* | [**getPerson**](Api/PersonsApi.md#getperson) | **GET** /persons/{id} | Get details of a person -*PersonsApi* | [**getPersonActivities**](Api/PersonsApi.md#getpersonactivities) | **GET** /persons/{id}/activities | List activities associated with a person *PersonsApi* | [**getPersonChangelog**](Api/PersonsApi.md#getpersonchangelog) | **GET** /persons/{id}/changelog | List updates about person field values -*PersonsApi* | [**getPersonDeals**](Api/PersonsApi.md#getpersondeals) | **GET** /persons/{id}/deals | List deals associated with a person *PersonsApi* | [**getPersonFiles**](Api/PersonsApi.md#getpersonfiles) | **GET** /persons/{id}/files | List files attached to a person *PersonsApi* | [**getPersonFollowers**](Api/PersonsApi.md#getpersonfollowers) | **GET** /persons/{id}/followers | List followers of a person *PersonsApi* | [**getPersonMailMessages**](Api/PersonsApi.md#getpersonmailmessages) | **GET** /persons/{id}/mailMessages | List mail messages associated with a person *PersonsApi* | [**getPersonProducts**](Api/PersonsApi.md#getpersonproducts) | **GET** /persons/{id}/products | List products associated with a person *PersonsApi* | [**getPersonUpdates**](Api/PersonsApi.md#getpersonupdates) | **GET** /persons/{id}/flow | List updates about a person *PersonsApi* | [**getPersonUsers**](Api/PersonsApi.md#getpersonusers) | **GET** /persons/{id}/permittedUsers | List permitted users -*PersonsApi* | [**getPersons**](Api/PersonsApi.md#getpersons) | **GET** /persons | Get all persons -*PersonsApi* | [**getPersonsCollection**](Api/PersonsApi.md#getpersonscollection) | **GET** /persons/collection | Get all persons collection *PersonsApi* | [**mergePersons**](Api/PersonsApi.md#mergepersons) | **PUT** /persons/{id}/merge | Merge two persons -*PersonsApi* | [**searchPersons**](Api/PersonsApi.md#searchpersons) | **GET** /persons/search | Search persons -*PersonsApi* | [**updatePerson**](Api/PersonsApi.md#updateperson) | **PUT** /persons/{id} | Update a person -*PipelinesApi* | [**addPipeline**](Api/PipelinesApi.md#addpipeline) | **POST** /pipelines | Add a new pipeline -*PipelinesApi* | [**deletePipeline**](Api/PipelinesApi.md#deletepipeline) | **DELETE** /pipelines/{id} | Delete a pipeline -*PipelinesApi* | [**getPipeline**](Api/PipelinesApi.md#getpipeline) | **GET** /pipelines/{id} | Get one pipeline *PipelinesApi* | [**getPipelineConversionStatistics**](Api/PipelinesApi.md#getpipelineconversionstatistics) | **GET** /pipelines/{id}/conversion_statistics | Get deals conversion rates in pipeline *PipelinesApi* | [**getPipelineDeals**](Api/PipelinesApi.md#getpipelinedeals) | **GET** /pipelines/{id}/deals | Get deals in a pipeline *PipelinesApi* | [**getPipelineMovementStatistics**](Api/PipelinesApi.md#getpipelinemovementstatistics) | **GET** /pipelines/{id}/movement_statistics | Get deals movements in pipeline -*PipelinesApi* | [**getPipelines**](Api/PipelinesApi.md#getpipelines) | **GET** /pipelines | Get all pipelines -*PipelinesApi* | [**updatePipeline**](Api/PipelinesApi.md#updatepipeline) | **PUT** /pipelines/{id} | Update a pipeline *ProductFieldsApi* | [**addProductField**](Api/ProductFieldsApi.md#addproductfield) | **POST** /productFields | Add a new product field *ProductFieldsApi* | [**deleteProductField**](Api/ProductFieldsApi.md#deleteproductfield) | **DELETE** /productFields/{id} | Delete a product field *ProductFieldsApi* | [**deleteProductFields**](Api/ProductFieldsApi.md#deleteproductfields) | **DELETE** /productFields | Delete multiple product fields in bulk *ProductFieldsApi* | [**getProductField**](Api/ProductFieldsApi.md#getproductfield) | **GET** /productFields/{id} | Get one product field *ProductFieldsApi* | [**getProductFields**](Api/ProductFieldsApi.md#getproductfields) | **GET** /productFields | Get all product fields *ProductFieldsApi* | [**updateProductField**](Api/ProductFieldsApi.md#updateproductfield) | **PUT** /productFields/{id} | Update a product field -*ProductsApi* | [**addProduct**](Api/ProductsApi.md#addproduct) | **POST** /products | Add a product *ProductsApi* | [**addProductFollower**](Api/ProductsApi.md#addproductfollower) | **POST** /products/{id}/followers | Add a follower to a product -*ProductsApi* | [**deleteProduct**](Api/ProductsApi.md#deleteproduct) | **DELETE** /products/{id} | Delete a product *ProductsApi* | [**deleteProductFollower**](Api/ProductsApi.md#deleteproductfollower) | **DELETE** /products/{id}/followers/{follower_id} | Delete a follower from a product -*ProductsApi* | [**getProduct**](Api/ProductsApi.md#getproduct) | **GET** /products/{id} | Get one product *ProductsApi* | [**getProductDeals**](Api/ProductsApi.md#getproductdeals) | **GET** /products/{id}/deals | Get deals where a product is attached to *ProductsApi* | [**getProductFiles**](Api/ProductsApi.md#getproductfiles) | **GET** /products/{id}/files | List files attached to a product *ProductsApi* | [**getProductFollowers**](Api/ProductsApi.md#getproductfollowers) | **GET** /products/{id}/followers | List followers of a product *ProductsApi* | [**getProductUsers**](Api/ProductsApi.md#getproductusers) | **GET** /products/{id}/permittedUsers | List permitted users -*ProductsApi* | [**getProducts**](Api/ProductsApi.md#getproducts) | **GET** /products | Get all products -*ProductsApi* | [**searchProducts**](Api/ProductsApi.md#searchproducts) | **GET** /products/search | Search products -*ProductsApi* | [**updateProduct**](Api/ProductsApi.md#updateproduct) | **PUT** /products/{id} | Update a product *ProjectTemplatesApi* | [**getProjectTemplate**](Api/ProjectTemplatesApi.md#getprojecttemplate) | **GET** /projectTemplates/{id} | Get details of a template *ProjectTemplatesApi* | [**getProjectTemplates**](Api/ProjectTemplatesApi.md#getprojecttemplates) | **GET** /projectTemplates | Get all project templates *ProjectTemplatesApi* | [**getProjectsBoard**](Api/ProjectTemplatesApi.md#getprojectsboard) | **GET** /projects/boards/{id} | Get details of a board @@ -505,12 +454,7 @@ Class | Method | HTTP request | Description *RolesApi* | [**getRoles**](Api/RolesApi.md#getroles) | **GET** /roles | Get all roles *RolesApi* | [**updateRole**](Api/RolesApi.md#updaterole) | **PUT** /roles/{id} | Update role details *RolesApi* | [**updateRolePipelines**](Api/RolesApi.md#updaterolepipelines) | **PUT** /roles/{id}/pipelines | Update pipeline visibility for a role -*StagesApi* | [**addStage**](Api/StagesApi.md#addstage) | **POST** /stages | Add a new stage -*StagesApi* | [**deleteStage**](Api/StagesApi.md#deletestage) | **DELETE** /stages/{id} | Delete a stage -*StagesApi* | [**getStage**](Api/StagesApi.md#getstage) | **GET** /stages/{id} | Get one stage *StagesApi* | [**getStageDeals**](Api/StagesApi.md#getstagedeals) | **GET** /stages/{id}/deals | Get deals in a stage -*StagesApi* | [**getStages**](Api/StagesApi.md#getstages) | **GET** /stages | Get all stages -*StagesApi* | [**updateStage**](Api/StagesApi.md#updatestage) | **PUT** /stages/{id} | Update stage details *TasksApi* | [**addTask**](Api/TasksApi.md#addtask) | **POST** /tasks | Add a task *TasksApi* | [**deleteTask**](Api/TasksApi.md#deletetask) | **DELETE** /tasks/{id} | Delete a task *TasksApi* | [**getTask**](Api/TasksApi.md#gettask) | **GET** /tasks/{id} | Get details of a task @@ -537,20 +481,10 @@ Class | Method | HTTP request | Description - [ActivityCollectionResponseObject](Model/ActivityCollectionResponseObject.md) - [ActivityCollectionResponseObjectAllOf](Model/ActivityCollectionResponseObjectAllOf.md) - - [ActivityDistribution](Model/ActivityDistribution.md) - - [ActivityDistributionData](Model/ActivityDistributionData.md) - - [ActivityDistributionDataWithAdditionalData](Model/ActivityDistributionDataWithAdditionalData.md) - - [ActivityDistributionItem](Model/ActivityDistributionItem.md) - [ActivityInfo](Model/ActivityInfo.md) - [ActivityObjectFragment](Model/ActivityObjectFragment.md) - - [ActivityPostObject](Model/ActivityPostObject.md) - - [ActivityPostObjectAllOf](Model/ActivityPostObjectAllOf.md) - - [ActivityPutObject](Model/ActivityPutObject.md) - - [ActivityPutObjectAllOf](Model/ActivityPutObjectAllOf.md) - - [ActivityRecordAdditionalData](Model/ActivityRecordAdditionalData.md) - [ActivityResponseObject](Model/ActivityResponseObject.md) - [ActivityResponseObjectAllOf](Model/ActivityResponseObjectAllOf.md) - - [ActivityTypeCount](Model/ActivityTypeCount.md) - [ActivityTypeCreateRequest](Model/ActivityTypeCreateRequest.md) - [ActivityTypeCreateUpdateDeleteResponse](Model/ActivityTypeCreateUpdateDeleteResponse.md) - [ActivityTypeCreateUpdateDeleteResponseAllOf](Model/ActivityTypeCreateUpdateDeleteResponseAllOf.md) @@ -558,8 +492,6 @@ Class | Method | HTTP request | Description - [ActivityTypeListResponseAllOf](Model/ActivityTypeListResponseAllOf.md) - [ActivityTypeObjectResponse](Model/ActivityTypeObjectResponse.md) - [ActivityTypeUpdateRequest](Model/ActivityTypeUpdateRequest.md) - - [AddActivityResponse](Model/AddActivityResponse.md) - - [AddActivityResponseRelatedObjects](Model/AddActivityResponseRelatedObjects.md) - [AddChannelBadRequestResponse](Model/AddChannelBadRequestResponse.md) - [AddChannelBadRequestResponseAdditionalData](Model/AddChannelBadRequestResponseAdditionalData.md) - [AddChannelForbiddenErrorResponse](Model/AddChannelForbiddenErrorResponse.md) @@ -573,8 +505,6 @@ Class | Method | HTTP request | Description - [AddFollowerToPersonResponseAllOfData](Model/AddFollowerToPersonResponseAllOfData.md) - [AddLeadLabelRequest](Model/AddLeadLabelRequest.md) - [AddLeadRequest](Model/AddLeadRequest.md) - - [AddNewPipeline](Model/AddNewPipeline.md) - - [AddNewPipelineAllOf](Model/AddNewPipelineAllOf.md) - [AddNoteRequest](Model/AddNoteRequest.md) - [AddNoteRequestAllOf](Model/AddNoteRequestAllOf.md) - [AddOrUpdateRoleSettingRequest](Model/AddOrUpdateRoleSettingRequest.md) @@ -583,14 +513,7 @@ Class | Method | HTTP request | Description - [AddPersonFollowerRequest](Model/AddPersonFollowerRequest.md) - [AddPersonPictureResponse](Model/AddPersonPictureResponse.md) - [AddPersonPictureResponseAllOf](Model/AddPersonPictureResponseAllOf.md) - - [AddPersonResponse](Model/AddPersonResponse.md) - - [AddPersonResponseAllOf](Model/AddPersonResponseAllOf.md) - - [AddProductAttachmentDetails](Model/AddProductAttachmentDetails.md) - - [AddProductAttachmentDetailsAllOf](Model/AddProductAttachmentDetailsAllOf.md) - [AddProductFollowerRequest](Model/AddProductFollowerRequest.md) - - [AddProductRequestBody](Model/AddProductRequestBody.md) - - [AddProductRequestBodyAllOf](Model/AddProductRequestBodyAllOf.md) - - [AddProductRequestBodyAllOf1](Model/AddProductRequestBodyAllOf1.md) - [AddProjectResponse](Model/AddProjectResponse.md) - [AddRole](Model/AddRole.md) - [AddRoleAssignmentRequest](Model/AddRoleAssignmentRequest.md) @@ -613,10 +536,6 @@ Class | Method | HTTP request | Description - [AllOrganizationRelationshipsGetResponse](Model/AllOrganizationRelationshipsGetResponse.md) - [AllOrganizationRelationshipsGetResponseAllOf](Model/AllOrganizationRelationshipsGetResponseAllOf.md) - [AllOrganizationRelationshipsGetResponseAllOfRelatedObjects](Model/AllOrganizationRelationshipsGetResponseAllOfRelatedObjects.md) - - [AllOrganizationsGetResponse](Model/AllOrganizationsGetResponse.md) - - [AllOrganizationsGetResponseAllOf](Model/AllOrganizationsGetResponseAllOf.md) - - [AllOrganizationsGetResponseAllOfRelatedObjects](Model/AllOrganizationsGetResponseAllOfRelatedObjects.md) - - [ArrayPrices](Model/ArrayPrices.md) - [Assignee](Model/Assignee.md) - [BaseComment](Model/BaseComment.md) - [BaseCurrency](Model/BaseCurrency.md) @@ -634,16 +553,11 @@ Class | Method | HTTP request | Description - [BaseNoteProject](Model/BaseNoteProject.md) - [BaseOrganizationItem](Model/BaseOrganizationItem.md) - [BaseOrganizationItemFields](Model/BaseOrganizationItemFields.md) - - [BaseOrganizationItemWithEditNameFlag](Model/BaseOrganizationItemWithEditNameFlag.md) - - [BaseOrganizationItemWithEditNameFlagAllOf](Model/BaseOrganizationItemWithEditNameFlagAllOf.md) - [BaseOrganizationRelationshipItem](Model/BaseOrganizationRelationshipItem.md) - [BasePersonItem](Model/BasePersonItem.md) - [BasePersonItemEmail](Model/BasePersonItemEmail.md) - [BasePersonItemPhone](Model/BasePersonItemPhone.md) - [BasePipeline](Model/BasePipeline.md) - - [BasePipelineWithSelectedFlag](Model/BasePipelineWithSelectedFlag.md) - - [BasePipelineWithSelectedFlagAllOf](Model/BasePipelineWithSelectedFlagAllOf.md) - - [BaseProduct](Model/BaseProduct.md) - [BaseResponse](Model/BaseResponse.md) - [BaseResponseWithStatus](Model/BaseResponseWithStatus.md) - [BaseResponseWithStatusAllOf](Model/BaseResponseWithStatusAllOf.md) @@ -656,15 +570,7 @@ Class | Method | HTTP request | Description - [BaseUserMeAllOf](Model/BaseUserMeAllOf.md) - [BaseUserMeAllOfLanguage](Model/BaseUserMeAllOfLanguage.md) - [BaseWebhook](Model/BaseWebhook.md) - - [BasicDeal](Model/BasicDeal.md) - - [BasicDealProduct](Model/BasicDealProduct.md) - - [BasicDealProductAllOf](Model/BasicDealProductAllOf.md) - [BasicGoal](Model/BasicGoal.md) - - [BasicOrganization](Model/BasicOrganization.md) - - [BasicPerson](Model/BasicPerson.md) - - [BasicPersonEmail](Model/BasicPersonEmail.md) - - [BillingFrequency](Model/BillingFrequency.md) - - [BillingFrequency1](Model/BillingFrequency1.md) - [BulkDeleteResponse](Model/BulkDeleteResponse.md) - [BulkDeleteResponseAllOf](Model/BulkDeleteResponseAllOf.md) - [BulkDeleteResponseAllOfData](Model/BulkDeleteResponseAllOfData.md) @@ -690,23 +596,14 @@ Class | Method | HTTP request | Description - [CreateRemoteFileAndLinkItToItem](Model/CreateRemoteFileAndLinkItToItem.md) - [CreateTeam](Model/CreateTeam.md) - [Currencies](Model/Currencies.md) - - [DealCollectionResponseObject](Model/DealCollectionResponseObject.md) - [DealCountAndActivityInfo](Model/DealCountAndActivityInfo.md) - [DealFlowResponse](Model/DealFlowResponse.md) - [DealFlowResponseAllOf](Model/DealFlowResponseAllOf.md) - [DealFlowResponseAllOfData](Model/DealFlowResponseAllOfData.md) - [DealFlowResponseAllOfRelatedObjects](Model/DealFlowResponseAllOfRelatedObjects.md) - - [DealListActivitiesResponse](Model/DealListActivitiesResponse.md) - - [DealListActivitiesResponseAllOf](Model/DealListActivitiesResponseAllOf.md) - - [DealListActivitiesResponseAllOfRelatedObjects](Model/DealListActivitiesResponseAllOfRelatedObjects.md) - [DealNonStrict](Model/DealNonStrict.md) - [DealNonStrictModeFields](Model/DealNonStrictModeFields.md) - [DealNonStrictModeFieldsCreatorUserId](Model/DealNonStrictModeFieldsCreatorUserId.md) - - [DealNonStrictWithDetails](Model/DealNonStrictWithDetails.md) - - [DealNonStrictWithDetailsAllOf](Model/DealNonStrictWithDetailsAllOf.md) - - [DealNonStrictWithDetailsAllOfAge](Model/DealNonStrictWithDetailsAllOfAge.md) - - [DealNonStrictWithDetailsAllOfAverageTimeToWon](Model/DealNonStrictWithDetailsAllOfAverageTimeToWon.md) - - [DealNonStrictWithDetailsAllOfStayInPipelineStages](Model/DealNonStrictWithDetailsAllOfStayInPipelineStages.md) - [DealOrganizationData](Model/DealOrganizationData.md) - [DealOrganizationDataWithId](Model/DealOrganizationDataWithId.md) - [DealOrganizationDataWithIdAllOf](Model/DealOrganizationDataWithIdAllOf.md) @@ -722,21 +619,10 @@ Class | Method | HTTP request | Description - [DealPersonDataPhone](Model/DealPersonDataPhone.md) - [DealPersonDataWithId](Model/DealPersonDataWithId.md) - [DealPersonDataWithIdAllOf](Model/DealPersonDataWithIdAllOf.md) - - [DealProductRequestBody](Model/DealProductRequestBody.md) - - [DealSearchItem](Model/DealSearchItem.md) - - [DealSearchItemItem](Model/DealSearchItemItem.md) - - [DealSearchItemItemOrganization](Model/DealSearchItemItemOrganization.md) - - [DealSearchItemItemOwner](Model/DealSearchItemItemOwner.md) - - [DealSearchItemItemPerson](Model/DealSearchItemItemPerson.md) - - [DealSearchItemItemStage](Model/DealSearchItemItemStage.md) - - [DealSearchResponse](Model/DealSearchResponse.md) - - [DealSearchResponseAllOf](Model/DealSearchResponseAllOf.md) - - [DealSearchResponseAllOfData](Model/DealSearchResponseAllOfData.md) - [DealStrict](Model/DealStrict.md) - [DealStrictModeFields](Model/DealStrictModeFields.md) - [DealStrictWithMergeId](Model/DealStrictWithMergeId.md) - [DealStrictWithMergeIdAllOf](Model/DealStrictWithMergeIdAllOf.md) - - [DealTitleParameter](Model/DealTitleParameter.md) - [DealUserData](Model/DealUserData.md) - [DealUserDataWithId](Model/DealUserDataWithId.md) - [DealUserDataWithIdAllOf](Model/DealUserDataWithIdAllOf.md) @@ -745,8 +631,6 @@ Class | Method | HTTP request | Description - [DealsMovementsInfo](Model/DealsMovementsInfo.md) - [DealsMovementsInfoFormattedValues](Model/DealsMovementsInfoFormattedValues.md) - [DealsMovementsInfoValues](Model/DealsMovementsInfoValues.md) - - [DeleteActivityResponse](Model/DeleteActivityResponse.md) - - [DeleteActivityResponseData](Model/DeleteActivityResponseData.md) - [DeleteChannelSuccess](Model/DeleteChannelSuccess.md) - [DeleteComment](Model/DeleteComment.md) - [DeleteConversationForbiddenErrorResponse](Model/DeleteConversationForbiddenErrorResponse.md) @@ -754,14 +638,10 @@ Class | Method | HTTP request | Description - [DeleteConversationNotFoundErrorResponse](Model/DeleteConversationNotFoundErrorResponse.md) - [DeleteConversationNotFoundErrorResponseAdditionalData](Model/DeleteConversationNotFoundErrorResponseAdditionalData.md) - [DeleteConversationSuccess](Model/DeleteConversationSuccess.md) - - [DeleteDeal](Model/DeleteDeal.md) - - [DeleteDealData](Model/DeleteDealData.md) - [DeleteDealFollower](Model/DeleteDealFollower.md) - [DeleteDealFollowerData](Model/DeleteDealFollowerData.md) - [DeleteDealParticipant](Model/DeleteDealParticipant.md) - [DeleteDealParticipantData](Model/DeleteDealParticipantData.md) - - [DeleteDealProduct](Model/DeleteDealProduct.md) - - [DeleteDealProductData](Model/DeleteDealProductData.md) - [DeleteFile](Model/DeleteFile.md) - [DeleteFileData](Model/DeleteFileData.md) - [DeleteGoalResponse](Model/DeleteGoalResponse.md) @@ -772,14 +652,10 @@ Class | Method | HTTP request | Description - [DeletePersonResponse](Model/DeletePersonResponse.md) - [DeletePersonResponseAllOf](Model/DeletePersonResponseAllOf.md) - [DeletePersonResponseAllOfData](Model/DeletePersonResponseAllOfData.md) - - [DeletePipelineResponse](Model/DeletePipelineResponse.md) - - [DeletePipelineResponseData](Model/DeletePipelineResponseData.md) - [DeleteProductFieldResponse](Model/DeleteProductFieldResponse.md) - [DeleteProductFieldResponseData](Model/DeleteProductFieldResponseData.md) - [DeleteProductFollowerResponse](Model/DeleteProductFollowerResponse.md) - [DeleteProductFollowerResponseData](Model/DeleteProductFollowerResponseData.md) - - [DeleteProductResponse](Model/DeleteProductResponse.md) - - [DeleteProductResponseData](Model/DeleteProductResponseData.md) - [DeleteProject](Model/DeleteProject.md) - [DeleteProjectData](Model/DeleteProjectData.md) - [DeleteProjectResponse](Model/DeleteProjectResponse.md) @@ -793,15 +669,11 @@ Class | Method | HTTP request | Description - [DeleteRoleAssignmentResponseDataData](Model/DeleteRoleAssignmentResponseDataData.md) - [DeleteRoleResponseData](Model/DeleteRoleResponseData.md) - [DeleteRoleResponseDataData](Model/DeleteRoleResponseDataData.md) - - [DeleteStageResponse](Model/DeleteStageResponse.md) - - [DeleteStageResponseData](Model/DeleteStageResponseData.md) - [DeleteTask](Model/DeleteTask.md) - [DeleteTaskData](Model/DeleteTaskData.md) - [DeleteTaskResponse](Model/DeleteTaskResponse.md) - [DeleteTeamUserRequest](Model/DeleteTeamUserRequest.md) - [Duration](Model/Duration.md) - - [EditPipeline](Model/EditPipeline.md) - - [EditPipelineAllOf](Model/EditPipelineAllOf.md) - [EmailInfo](Model/EmailInfo.md) - [ExpectedOutcome](Model/ExpectedOutcome.md) - [FailResponse](Model/FailResponse.md) @@ -833,32 +705,15 @@ Class | Method | HTTP request | Description - [FiltersPostResponse](Model/FiltersPostResponse.md) - [FiltersPostResponseAllOf](Model/FiltersPostResponseAllOf.md) - [FindGoalResponse](Model/FindGoalResponse.md) - - [FollowerData](Model/FollowerData.md) - - [FollowerDataWithID](Model/FollowerDataWithID.md) - - [FollowerDataWithIDAllOf](Model/FollowerDataWithIDAllOf.md) - [FullProjectObject](Model/FullProjectObject.md) - [FullRole](Model/FullRole.md) - [FullRoleAllOf](Model/FullRoleAllOf.md) - [FullTaskObject](Model/FullTaskObject.md) - [GetActivitiesCollectionResponse](Model/GetActivitiesCollectionResponse.md) - - [GetActivitiesResponse](Model/GetActivitiesResponse.md) - - [GetActivitiesResponseRelatedObjects](Model/GetActivitiesResponseRelatedObjects.md) - - [GetActivityResponse](Model/GetActivityResponse.md) - - [GetAddProductAttachmentDetails](Model/GetAddProductAttachmentDetails.md) - - [GetAddUpdateStage](Model/GetAddUpdateStage.md) - - [GetAddedDeal](Model/GetAddedDeal.md) - [GetAllFiles](Model/GetAllFiles.md) - - [GetAllPersonsResponse](Model/GetAllPersonsResponse.md) - - [GetAllPersonsResponseAllOf](Model/GetAllPersonsResponseAllOf.md) - - [GetAllPipelines](Model/GetAllPipelines.md) - - [GetAllPipelinesAllOf](Model/GetAllPipelinesAllOf.md) - [GetAllProductFieldsResponse](Model/GetAllProductFieldsResponse.md) - [GetComments](Model/GetComments.md) - - [GetDeal](Model/GetDeal.md) - - [GetDealAdditionalData](Model/GetDealAdditionalData.md) - - [GetDealRelatedObjects](Model/GetDealRelatedObjects.md) - [GetDeals](Model/GetDeals.md) - - [GetDealsCollection](Model/GetDealsCollection.md) - [GetDealsConversionRatesInPipeline](Model/GetDealsConversionRatesInPipeline.md) - [GetDealsConversionRatesInPipelineAllOf](Model/GetDealsConversionRatesInPipelineAllOf.md) - [GetDealsConversionRatesInPipelineAllOfData](Model/GetDealsConversionRatesInPipelineAllOfData.md) @@ -891,13 +746,6 @@ Class | Method | HTTP request | Description - [GetNoteField](Model/GetNoteField.md) - [GetNotes](Model/GetNotes.md) - [GetOneFile](Model/GetOneFile.md) - - [GetOnePipeline](Model/GetOnePipeline.md) - - [GetOnePipelineAllOf](Model/GetOnePipelineAllOf.md) - - [GetOneStage](Model/GetOneStage.md) - - [GetPersonDetailsResponse](Model/GetPersonDetailsResponse.md) - - [GetPersonDetailsResponseAllOf](Model/GetPersonDetailsResponseAllOf.md) - - [GetPersonDetailsResponseAllOfAdditionalData](Model/GetPersonDetailsResponseAllOfAdditionalData.md) - - [GetProductAttachmentDetails](Model/GetProductAttachmentDetails.md) - [GetProductField](Model/GetProductField.md) - [GetProductFieldResponse](Model/GetProductFieldResponse.md) - [GetProjectBoardResponse](Model/GetProjectBoardResponse.md) @@ -926,7 +774,6 @@ Class | Method | HTTP request | Description - [GetRoles](Model/GetRoles.md) - [GetRolesAllOf](Model/GetRolesAllOf.md) - [GetStageDeals](Model/GetStageDeals.md) - - [GetStages](Model/GetStages.md) - [GetTaskResponse](Model/GetTaskResponse.md) - [GetTasksResponse](Model/GetTasksResponse.md) - [GetUserConnectionsResponseData](Model/GetUserConnectionsResponseData.md) @@ -938,18 +785,9 @@ Class | Method | HTTP request | Description - [GoalType](Model/GoalType.md) - [GoalsResponseComponent](Model/GoalsResponseComponent.md) - [IconKey](Model/IconKey.md) - - [InlineResponse200](Model/InlineResponse200.md) - - [InlineResponse2001](Model/InlineResponse2001.md) - [InternalFieldType](Model/InternalFieldType.md) - [ItemSearchAdditionalData](Model/ItemSearchAdditionalData.md) - [ItemSearchAdditionalDataPagination](Model/ItemSearchAdditionalDataPagination.md) - - [ItemSearchFieldResponse](Model/ItemSearchFieldResponse.md) - - [ItemSearchFieldResponseAllOf](Model/ItemSearchFieldResponseAllOf.md) - - [ItemSearchFieldResponseAllOfData](Model/ItemSearchFieldResponseAllOfData.md) - - [ItemSearchItem](Model/ItemSearchItem.md) - - [ItemSearchResponse](Model/ItemSearchResponse.md) - - [ItemSearchResponseAllOf](Model/ItemSearchResponseAllOf.md) - - [ItemSearchResponseAllOfData](Model/ItemSearchResponseAllOfData.md) - [LeadLabelColor](Model/LeadLabelColor.md) - [LeadLabelResponse](Model/LeadLabelResponse.md) - [LeadNotFoundResponse](Model/LeadNotFoundResponse.md) @@ -965,8 +803,6 @@ Class | Method | HTTP request | Description - [LeadSource](Model/LeadSource.md) - [LeadValue](Model/LeadValue.md) - [LinkRemoteFileToItem](Model/LinkRemoteFileToItem.md) - - [ListActivitiesResponse](Model/ListActivitiesResponse.md) - - [ListActivitiesResponseAllOf](Model/ListActivitiesResponseAllOf.md) - [ListDealsResponse](Model/ListDealsResponse.md) - [ListDealsResponseAllOf](Model/ListDealsResponseAllOf.md) - [ListDealsResponseAllOfRelatedObjects](Model/ListDealsResponseAllOfRelatedObjects.md) @@ -985,19 +821,11 @@ Class | Method | HTTP request | Description - [ListPersonProductsResponseAllOf](Model/ListPersonProductsResponseAllOf.md) - [ListPersonProductsResponseAllOfDEALID](Model/ListPersonProductsResponseAllOfDEALID.md) - [ListPersonProductsResponseAllOfData](Model/ListPersonProductsResponseAllOfData.md) - - [ListPersonsResponse](Model/ListPersonsResponse.md) - - [ListPersonsResponseAllOf](Model/ListPersonsResponseAllOf.md) - - [ListPersonsResponseAllOfRelatedObjects](Model/ListPersonsResponseAllOfRelatedObjects.md) - - [ListProductAdditionalData](Model/ListProductAdditionalData.md) - - [ListProductAdditionalDataAllOf](Model/ListProductAdditionalDataAllOf.md) - [ListProductFilesResponse](Model/ListProductFilesResponse.md) - [ListProductFilesResponseAllOf](Model/ListProductFilesResponseAllOf.md) - [ListProductFollowersResponse](Model/ListProductFollowersResponse.md) - [ListProductFollowersResponseAllOf](Model/ListProductFollowersResponseAllOf.md) - [ListProductFollowersResponseAllOfData](Model/ListProductFollowersResponseAllOfData.md) - - [ListProductsResponse](Model/ListProductsResponse.md) - - [ListProductsResponseAllOf](Model/ListProductsResponseAllOf.md) - - [ListProductsResponseAllOfRelatedObjects](Model/ListProductsResponseAllOfRelatedObjects.md) - [MailMessage](Model/MailMessage.md) - [MailMessageAllOf](Model/MailMessageAllOf.md) - [MailMessageData](Model/MailMessageData.md) @@ -1017,7 +845,6 @@ Class | Method | HTTP request | Description - [MailThreadParticipant](Model/MailThreadParticipant.md) - [MailThreadPut](Model/MailThreadPut.md) - [MailThreadPutAllOf](Model/MailThreadPutAllOf.md) - - [MarketingStatus](Model/MarketingStatus.md) - [MergeDealsRequest](Model/MergeDealsRequest.md) - [MergeOrganizationsRequest](Model/MergeOrganizationsRequest.md) - [MergePersonDealRelatedInfo](Model/MergePersonDealRelatedInfo.md) @@ -1027,20 +854,9 @@ Class | Method | HTTP request | Description - [MergePersonsResponseAllOf](Model/MergePersonsResponseAllOf.md) - [MessageObject](Model/MessageObject.md) - [MessageObjectAttachments](Model/MessageObjectAttachments.md) - - [NameObject](Model/NameObject.md) - - [NewDeal](Model/NewDeal.md) - - [NewDealParameters](Model/NewDealParameters.md) - - [NewDealProduct](Model/NewDealProduct.md) - - [NewDealProductAllOf](Model/NewDealProductAllOf.md) - - [NewDealProductAllOf1](Model/NewDealProductAllOf1.md) - - [NewDealProductAllOf2](Model/NewDealProductAllOf2.md) - [NewFollowerResponse](Model/NewFollowerResponse.md) - [NewFollowerResponseData](Model/NewFollowerResponseData.md) - [NewGoal](Model/NewGoal.md) - - [NewOrganization](Model/NewOrganization.md) - - [NewOrganizationAllOf](Model/NewOrganizationAllOf.md) - - [NewPerson](Model/NewPerson.md) - - [NewPersonAllOf](Model/NewPersonAllOf.md) - [NewProductField](Model/NewProductField.md) - [Note](Model/Note.md) - [NoteAllOf](Model/NoteAllOf.md) @@ -1063,11 +879,6 @@ Class | Method | HTTP request | Description - [OrganizationDataWithIdAllOf](Model/OrganizationDataWithIdAllOf.md) - [OrganizationDataWithIdAndActiveFlag](Model/OrganizationDataWithIdAndActiveFlag.md) - [OrganizationDataWithIdAndActiveFlagAllOf](Model/OrganizationDataWithIdAndActiveFlagAllOf.md) - - [OrganizationDeleteResponse](Model/OrganizationDeleteResponse.md) - - [OrganizationDeleteResponseData](Model/OrganizationDeleteResponseData.md) - - [OrganizationDetailsGetResponse](Model/OrganizationDetailsGetResponse.md) - - [OrganizationDetailsGetResponseAllOf](Model/OrganizationDetailsGetResponseAllOf.md) - - [OrganizationDetailsGetResponseAllOfAdditionalData](Model/OrganizationDetailsGetResponseAllOfAdditionalData.md) - [OrganizationFlowResponse](Model/OrganizationFlowResponse.md) - [OrganizationFlowResponseAllOf](Model/OrganizationFlowResponseAllOf.md) - [OrganizationFlowResponseAllOfData](Model/OrganizationFlowResponseAllOfData.md) @@ -1078,10 +889,6 @@ Class | Method | HTTP request | Description - [OrganizationFollowerItemAllOf](Model/OrganizationFollowerItemAllOf.md) - [OrganizationFollowerPostResponse](Model/OrganizationFollowerPostResponse.md) - [OrganizationFollowersListResponse](Model/OrganizationFollowersListResponse.md) - - [OrganizationItem](Model/OrganizationItem.md) - - [OrganizationItemAllOf](Model/OrganizationItemAllOf.md) - - [OrganizationPostResponse](Model/OrganizationPostResponse.md) - - [OrganizationPostResponseAllOf](Model/OrganizationPostResponseAllOf.md) - [OrganizationRelationship](Model/OrganizationRelationship.md) - [OrganizationRelationshipDeleteResponse](Model/OrganizationRelationshipDeleteResponse.md) - [OrganizationRelationshipDeleteResponseAllOf](Model/OrganizationRelationshipDeleteResponseAllOf.md) @@ -1093,15 +900,6 @@ Class | Method | HTTP request | Description - [OrganizationRelationshipPostResponseAllOf](Model/OrganizationRelationshipPostResponseAllOf.md) - [OrganizationRelationshipUpdateResponse](Model/OrganizationRelationshipUpdateResponse.md) - [OrganizationRelationshipWithCalculatedFields](Model/OrganizationRelationshipWithCalculatedFields.md) - - [OrganizationSearchItem](Model/OrganizationSearchItem.md) - - [OrganizationSearchItemItem](Model/OrganizationSearchItemItem.md) - - [OrganizationSearchResponse](Model/OrganizationSearchResponse.md) - - [OrganizationSearchResponseAllOf](Model/OrganizationSearchResponseAllOf.md) - - [OrganizationSearchResponseAllOfData](Model/OrganizationSearchResponseAllOfData.md) - - [OrganizationUpdateResponse](Model/OrganizationUpdateResponse.md) - - [OrganizationUpdateResponseAllOf](Model/OrganizationUpdateResponseAllOf.md) - - [OrganizationsCollectionResponseObject](Model/OrganizationsCollectionResponseObject.md) - - [OrganizationsCollectionResponseObjectAllOf](Model/OrganizationsCollectionResponseObjectAllOf.md) - [OrganizationsMergeResponse](Model/OrganizationsMergeResponse.md) - [OrganizationsMergeResponseData](Model/OrganizationsMergeResponseData.md) - [Owner](Model/Owner.md) @@ -1131,23 +929,14 @@ Class | Method | HTTP request | Description - [PersonNameCountAndEmailInfoWithIdsAllOf](Model/PersonNameCountAndEmailInfoWithIdsAllOf.md) - [PersonNameInfo](Model/PersonNameInfo.md) - [PersonNameInfoWithOrgAndOwnerId](Model/PersonNameInfoWithOrgAndOwnerId.md) - - [PersonSearchItem](Model/PersonSearchItem.md) - - [PersonSearchItemItem](Model/PersonSearchItemItem.md) - - [PersonSearchItemItemOrganization](Model/PersonSearchItemItemOrganization.md) - - [PersonSearchItemItemOwner](Model/PersonSearchItemItemOwner.md) - - [PersonSearchResponse](Model/PersonSearchResponse.md) - - [PersonSearchResponseAllOf](Model/PersonSearchResponseAllOf.md) - - [PersonSearchResponseAllOfData](Model/PersonSearchResponseAllOfData.md) - - [PersonsCollectionResponseObject](Model/PersonsCollectionResponseObject.md) - [PhoneData](Model/PhoneData.md) - [PictureData](Model/PictureData.md) - - [PictureDataPictures](Model/PictureDataPictures.md) - [PictureDataWithID](Model/PictureDataWithID.md) - [PictureDataWithID1](Model/PictureDataWithID1.md) + - [PictureDataWithID1Pictures](Model/PictureDataWithID1Pictures.md) + - [PictureDataWithID2](Model/PictureDataWithID2.md) - [PictureDataWithValue](Model/PictureDataWithValue.md) - [PictureDataWithValue1](Model/PictureDataWithValue1.md) - - [Pipeline](Model/Pipeline.md) - - [PipelineDetails](Model/PipelineDetails.md) - [PostComment](Model/PostComment.md) - [PostDealParticipants](Model/PostDealParticipants.md) - [PostDealParticipantsRelatedObjects](Model/PostDealParticipantsRelatedObjects.md) @@ -1157,23 +946,10 @@ Class | Method | HTTP request | Description - [PostRoleSettings](Model/PostRoleSettings.md) - [PostRoles](Model/PostRoles.md) - [PostRolesAllOf](Model/PostRolesAllOf.md) - - [ProductAttachementFields](Model/ProductAttachementFields.md) - - [ProductAttachmentDetails](Model/ProductAttachmentDetails.md) - [ProductBaseDeal](Model/ProductBaseDeal.md) - [ProductField](Model/ProductField.md) - [ProductFieldAllOf](Model/ProductFieldAllOf.md) - [ProductFileItem](Model/ProductFileItem.md) - - [ProductListItem](Model/ProductListItem.md) - - [ProductRequest](Model/ProductRequest.md) - - [ProductResponse](Model/ProductResponse.md) - - [ProductSearchItem](Model/ProductSearchItem.md) - - [ProductSearchItemItem](Model/ProductSearchItemItem.md) - - [ProductSearchItemItemOwner](Model/ProductSearchItemItemOwner.md) - - [ProductSearchResponse](Model/ProductSearchResponse.md) - - [ProductSearchResponseAllOf](Model/ProductSearchResponseAllOf.md) - - [ProductSearchResponseAllOfData](Model/ProductSearchResponseAllOfData.md) - - [ProductWithArrayPrices](Model/ProductWithArrayPrices.md) - - [ProductsResponse](Model/ProductsResponse.md) - [ProjectBoardObject](Model/ProjectBoardObject.md) - [ProjectGroupsObject](Model/ProjectGroupsObject.md) - [ProjectId](Model/ProjectId.md) @@ -1207,21 +983,17 @@ Class | Method | HTTP request | Description - [RecentsUser](Model/RecentsUser.md) - [RelatedDealData](Model/RelatedDealData.md) - [RelatedDealDataDEALID](Model/RelatedDealDataDEALID.md) - - [RelatedFollowerData](Model/RelatedFollowerData.md) - [RelatedOrganizationData](Model/RelatedOrganizationData.md) - [RelatedOrganizationDataWithActiveFlag](Model/RelatedOrganizationDataWithActiveFlag.md) - [RelatedOrganizationName](Model/RelatedOrganizationName.md) - - [RelatedPersonData](Model/RelatedPersonData.md) - [RelatedPersonDataWithActiveFlag](Model/RelatedPersonDataWithActiveFlag.md) - [RelatedPictureData](Model/RelatedPictureData.md) - [RelatedUserData](Model/RelatedUserData.md) - [RelationshipOrganizationInfoItem](Model/RelationshipOrganizationInfoItem.md) - [RelationshipOrganizationInfoItemAllOf](Model/RelationshipOrganizationInfoItemAllOf.md) - [RelationshipOrganizationInfoItemWithActiveFlag](Model/RelationshipOrganizationInfoItemWithActiveFlag.md) - - [RelationshipOrganizationInfoItemWithActiveFlagAllOf](Model/RelationshipOrganizationInfoItemWithActiveFlagAllOf.md) - [RequiredPostProjectParameters](Model/RequiredPostProjectParameters.md) - [RequiredPostTaskParameters](Model/RequiredPostTaskParameters.md) - - [RequiredTitleParameter](Model/RequiredTitleParameter.md) - [ResponseCallLogObject](Model/ResponseCallLogObject.md) - [ResponseCallLogObjectAllOf](Model/ResponseCallLogObjectAllOf.md) - [RoleAssignment](Model/RoleAssignment.md) @@ -1231,11 +1003,7 @@ Class | Method | HTTP request | Description - [RolesAdditionalDataPagination](Model/RolesAdditionalDataPagination.md) - [SinglePermissionSetsItem](Model/SinglePermissionSetsItem.md) - [SinglePermissionSetsItemAllOf](Model/SinglePermissionSetsItemAllOf.md) - - [Stage](Model/Stage.md) - [StageConversions](Model/StageConversions.md) - - [StageDetails](Model/StageDetails.md) - - [StageWithPipelineInfo](Model/StageWithPipelineInfo.md) - - [StageWithPipelineInfo1](Model/StageWithPipelineInfo1.md) - [SubRole](Model/SubRole.md) - [SubRoleAllOf](Model/SubRoleAllOf.md) - [SubscriptionAddonsResponse](Model/SubscriptionAddonsResponse.md) @@ -1256,26 +1024,13 @@ Class | Method | HTTP request | Description - [TemplateResponseObject](Model/TemplateResponseObject.md) - [Unauthorized](Model/Unauthorized.md) - [UpdateActivityPlanItemResponse](Model/UpdateActivityPlanItemResponse.md) - - [UpdateActivityResponse](Model/UpdateActivityResponse.md) - - [UpdateDealParameters](Model/UpdateDealParameters.md) - - [UpdateDealProduct](Model/UpdateDealProduct.md) - - [UpdateDealRequest](Model/UpdateDealRequest.md) - [UpdateFile](Model/UpdateFile.md) - [UpdateFilterRequest](Model/UpdateFilterRequest.md) - [UpdateLeadLabelRequest](Model/UpdateLeadLabelRequest.md) - [UpdateLeadRequest](Model/UpdateLeadRequest.md) - - [UpdateOrganization](Model/UpdateOrganization.md) - - [UpdateOrganizationAllOf](Model/UpdateOrganizationAllOf.md) - - [UpdatePerson](Model/UpdatePerson.md) - - [UpdatePersonAllOf](Model/UpdatePersonAllOf.md) - - [UpdatePersonResponse](Model/UpdatePersonResponse.md) - [UpdateProductField](Model/UpdateProductField.md) - - [UpdateProductRequestBody](Model/UpdateProductRequestBody.md) - - [UpdateProductResponse](Model/UpdateProductResponse.md) - [UpdateProjectResponse](Model/UpdateProjectResponse.md) - [UpdateRoleResponseData](Model/UpdateRoleResponseData.md) - - [UpdateStageRequest](Model/UpdateStageRequest.md) - - [UpdateStageRequestAllOf](Model/UpdateStageRequestAllOf.md) - [UpdateTaskPlanItemResponse](Model/UpdateTaskPlanItemResponse.md) - [UpdateTaskResponse](Model/UpdateTaskResponse.md) - [UpdateTeam](Model/UpdateTeam.md) diff --git a/docs/versions/v2/Model/DealItem.md b/docs/versions/v2/Model/DealItem.md index 7af7ca02..ea025fc0 100644 --- a/docs/versions/v2/Model/DealItem.md +++ b/docs/versions/v2/Model/DealItem.md @@ -31,6 +31,7 @@ Name | Type | Description | Notes **origin_id** | **string** | The optional ID to further distinguish the origin of the deal - e.g. Which API integration created this Deal. | [optional] **channel** | **int** | The ID of your Marketing channel this Deal was created from. Recognized Marketing channels can be configured in your <a href=\"https://app.pipedrive.com/settings/fields\" target=\"_blank\" rel=\"noopener noreferrer\">Company settings</a>. | [optional] **channel_id** | **string** | The optional ID to further distinguish the Marketing channel. | [optional] +**source_lead_id** | **string** | The ID of the lead if the deal was converted from a lead. Only included when requested via include_fields parameter. | [optional] **arr** | **float** | Only available in Growth and above plans The Annual Recurring Revenue of the deal Null if there are no products attached to the deal | [optional] **mrr** | **float** | Only available in Growth and above plans The Monthly Recurring Revenue of the deal Null if there are no products attached to the deal | [optional] **acv** | **float** | Only available in Growth and above plans The Annual Contract Value of the deal Null if there are no products attached to the deal | [optional] diff --git a/lib/versions/v1/Api/DealsApi.php b/lib/versions/v1/Api/DealsApi.php index e18e66a2..346980f1 100644 --- a/lib/versions/v1/Api/DealsApi.php +++ b/lib/versions/v1/Api/DealsApi.php @@ -123,38 +123,38 @@ public function getConfig(): Configuration } /** - * Operation addDeal + * Operation addDealFollower * - * Add a deal + * Add a follower to a deal * - * @param \Pipedrive\versions\v1\Model\NewDeal|null $new_deal new_deal (optional) + * @param int $id The ID of the deal (required) + * @param \Pipedrive\versions\v1\Model\AddDealFollowerRequest|null $add_deal_follower_request add_deal_follower_request (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\GetAddedDeal - * @deprecated + * @return \Pipedrive\versions\v1\Model\AddedDealFollower */ - public function addDeal($new_deal = null) + public function addDealFollower($id, $add_deal_follower_request = null) { - list($response) = $this->addDealWithHttpInfo($new_deal); + list($response) = $this->addDealFollowerWithHttpInfo($id, $add_deal_follower_request); return $response; } /** - * Operation addDealWithHttpInfo + * Operation addDealFollowerWithHttpInfo * - * Add a deal + * Add a follower to a deal * - * @param \Pipedrive\versions\v1\Model\NewDeal|null $new_deal (optional) + * @param int $id The ID of the deal (required) + * @param \Pipedrive\versions\v1\Model\AddDealFollowerRequest|null $add_deal_follower_request (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\GetAddedDeal, HTTP status code, HTTP response headers (array of strings) - * @deprecated + * @return array of \Pipedrive\versions\v1\Model\AddedDealFollower, HTTP status code, HTTP response headers (array of strings) */ - public function addDealWithHttpInfo($new_deal = null) + public function addDealFollowerWithHttpInfo($id, $add_deal_follower_request = null) { - $request = $this->addDealRequest($new_deal); + $request = $this->addDealFollowerRequest($id, $add_deal_follower_request); try { $options = $this->createHttpClientOption(); @@ -163,7 +163,7 @@ public function addDealWithHttpInfo($new_deal = null) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->addDealRequest($new_deal); + $request = $this->addDealFollowerRequest($id, $add_deal_follower_request); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -186,16 +186,16 @@ public function addDealWithHttpInfo($new_deal = null) switch($statusCode) { - case 201: + case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetAddedDeal' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\AddedDealFollower' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetAddedDeal', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\AddedDealFollower', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -215,24 +215,24 @@ public function addDealWithHttpInfo($new_deal = null) } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetAddedDeal' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\AddedDealFollower' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetAddedDeal', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\AddedDealFollower', []), $response->getStatusCode(), $response->getHeaders() ]; } catch (ApiException $e) { switch ($e->getCode()) { - case 201: + case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\GetAddedDeal', + '\Pipedrive\versions\v1\Model\AddedDealFollower', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -243,19 +243,19 @@ public function addDealWithHttpInfo($new_deal = null) } /** - * Operation addDealAsync + * Operation addDealFollowerAsync * - * Add a deal + * Add a follower to a deal * - * @param \Pipedrive\versions\v1\Model\NewDeal|null $new_deal (optional) + * @param int $id The ID of the deal (required) + * @param \Pipedrive\versions\v1\Model\AddDealFollowerRequest|null $add_deal_follower_request (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function addDealAsync($new_deal = null): PromiseInterface + public function addDealFollowerAsync($id, $add_deal_follower_request = null): PromiseInterface { - return $this->addDealAsyncWithHttpInfo($new_deal) + return $this->addDealFollowerAsyncWithHttpInfo($id, $add_deal_follower_request) ->then( function ($response) { return $response[0]; @@ -264,20 +264,20 @@ function ($response) { } /** - * Operation addDealAsyncWithHttpInfo + * Operation addDealFollowerAsyncWithHttpInfo * - * Add a deal + * Add a follower to a deal * - * @param \Pipedrive\versions\v1\Model\NewDeal|null $new_deal (optional) + * @param int $id The ID of the deal (required) + * @param \Pipedrive\versions\v1\Model\AddDealFollowerRequest|null $add_deal_follower_request (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function addDealAsyncWithHttpInfo($new_deal = null): PromiseInterface + public function addDealFollowerAsyncWithHttpInfo($id, $add_deal_follower_request = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\GetAddedDeal'; - $request = $this->addDealRequest($new_deal); + $returnType = '\Pipedrive\versions\v1\Model\AddedDealFollower'; + $request = $this->addDealFollowerRequest($id, $add_deal_follower_request); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -314,18 +314,25 @@ function ($exception) { } /** - * Create request for operation 'addDeal' + * Create request for operation 'addDealFollower' * - * @param \Pipedrive\versions\v1\Model\NewDeal|null $new_deal (optional) + * @param int $id The ID of the deal (required) + * @param \Pipedrive\versions\v1\Model\AddDealFollowerRequest|null $add_deal_follower_request (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request - * @deprecated */ - public function addDealRequest($new_deal = null): Request + public function addDealFollowerRequest($id, $add_deal_follower_request = null): Request { + // verify the required parameter 'id' is set + /* @phpstan-ignore-next-line */ + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling addDealFollower' + ); + } - $resourcePath = '/deals'; + $resourcePath = '/deals/{id}/followers'; $formParams = []; $queryParams = []; $headerParams = []; @@ -334,6 +341,14 @@ public function addDealRequest($new_deal = null): Request + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } /* @phpstan-ignore-next-line */ @@ -349,11 +364,11 @@ public function addDealRequest($new_deal = null): Request } // for model (json/xml) - if (isset($new_deal)) { + if (isset($add_deal_follower_request)) { if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($new_deal)); + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($add_deal_follower_request)); } else { - $httpBody = $new_deal; + $httpBody = $add_deal_follower_request; } } elseif (count($formParams) > 0) { /* @phpstan-ignore-next-line */ @@ -415,38 +430,38 @@ public function addDealRequest($new_deal = null): Request } /** - * Operation addDealFollower + * Operation addDealParticipant * - * Add a follower to a deal + * Add a participant to a deal * * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v1\Model\AddDealFollowerRequest|null $add_deal_follower_request add_deal_follower_request (optional) + * @param \Pipedrive\versions\v1\Model\AddDealParticipantRequest|null $add_deal_participant_request add_deal_participant_request (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\AddedDealFollower + * @return \Pipedrive\versions\v1\Model\PostDealParticipants */ - public function addDealFollower($id, $add_deal_follower_request = null) + public function addDealParticipant($id, $add_deal_participant_request = null) { - list($response) = $this->addDealFollowerWithHttpInfo($id, $add_deal_follower_request); + list($response) = $this->addDealParticipantWithHttpInfo($id, $add_deal_participant_request); return $response; } /** - * Operation addDealFollowerWithHttpInfo + * Operation addDealParticipantWithHttpInfo * - * Add a follower to a deal + * Add a participant to a deal * * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v1\Model\AddDealFollowerRequest|null $add_deal_follower_request (optional) + * @param \Pipedrive\versions\v1\Model\AddDealParticipantRequest|null $add_deal_participant_request (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\AddedDealFollower, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v1\Model\PostDealParticipants, HTTP status code, HTTP response headers (array of strings) */ - public function addDealFollowerWithHttpInfo($id, $add_deal_follower_request = null) + public function addDealParticipantWithHttpInfo($id, $add_deal_participant_request = null) { - $request = $this->addDealFollowerRequest($id, $add_deal_follower_request); + $request = $this->addDealParticipantRequest($id, $add_deal_participant_request); try { $options = $this->createHttpClientOption(); @@ -455,7 +470,7 @@ public function addDealFollowerWithHttpInfo($id, $add_deal_follower_request = nu } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->addDealFollowerRequest($id, $add_deal_follower_request); + $request = $this->addDealParticipantRequest($id, $add_deal_participant_request); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -480,14 +495,14 @@ public function addDealFollowerWithHttpInfo($id, $add_deal_follower_request = nu switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\AddedDealFollower' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\PostDealParticipants' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\AddedDealFollower', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\PostDealParticipants', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -507,14 +522,14 @@ public function addDealFollowerWithHttpInfo($id, $add_deal_follower_request = nu } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\AddedDealFollower' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\PostDealParticipants' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\AddedDealFollower', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\PostDealParticipants', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -524,7 +539,7 @@ public function addDealFollowerWithHttpInfo($id, $add_deal_follower_request = nu case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\AddedDealFollower', + '\Pipedrive\versions\v1\Model\PostDealParticipants', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -535,19 +550,19 @@ public function addDealFollowerWithHttpInfo($id, $add_deal_follower_request = nu } /** - * Operation addDealFollowerAsync + * Operation addDealParticipantAsync * - * Add a follower to a deal + * Add a participant to a deal * * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v1\Model\AddDealFollowerRequest|null $add_deal_follower_request (optional) + * @param \Pipedrive\versions\v1\Model\AddDealParticipantRequest|null $add_deal_participant_request (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function addDealFollowerAsync($id, $add_deal_follower_request = null): PromiseInterface + public function addDealParticipantAsync($id, $add_deal_participant_request = null): PromiseInterface { - return $this->addDealFollowerAsyncWithHttpInfo($id, $add_deal_follower_request) + return $this->addDealParticipantAsyncWithHttpInfo($id, $add_deal_participant_request) ->then( function ($response) { return $response[0]; @@ -556,20 +571,20 @@ function ($response) { } /** - * Operation addDealFollowerAsyncWithHttpInfo + * Operation addDealParticipantAsyncWithHttpInfo * - * Add a follower to a deal + * Add a participant to a deal * * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v1\Model\AddDealFollowerRequest|null $add_deal_follower_request (optional) + * @param \Pipedrive\versions\v1\Model\AddDealParticipantRequest|null $add_deal_participant_request (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function addDealFollowerAsyncWithHttpInfo($id, $add_deal_follower_request = null): PromiseInterface + public function addDealParticipantAsyncWithHttpInfo($id, $add_deal_participant_request = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\AddedDealFollower'; - $request = $this->addDealFollowerRequest($id, $add_deal_follower_request); + $returnType = '\Pipedrive\versions\v1\Model\PostDealParticipants'; + $request = $this->addDealParticipantRequest($id, $add_deal_participant_request); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -606,25 +621,25 @@ function ($exception) { } /** - * Create request for operation 'addDealFollower' + * Create request for operation 'addDealParticipant' * * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v1\Model\AddDealFollowerRequest|null $add_deal_follower_request (optional) + * @param \Pipedrive\versions\v1\Model\AddDealParticipantRequest|null $add_deal_participant_request (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function addDealFollowerRequest($id, $add_deal_follower_request = null): Request + public function addDealParticipantRequest($id, $add_deal_participant_request = null): Request { // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling addDealFollower' + 'Missing the required parameter $id when calling addDealParticipant' ); } - $resourcePath = '/deals/{id}/followers'; + $resourcePath = '/deals/{id}/participants'; $formParams = []; $queryParams = []; $headerParams = []; @@ -656,11 +671,11 @@ public function addDealFollowerRequest($id, $add_deal_follower_request = null): } // for model (json/xml) - if (isset($add_deal_follower_request)) { + if (isset($add_deal_participant_request)) { if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($add_deal_follower_request)); + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($add_deal_participant_request)); } else { - $httpBody = $add_deal_follower_request; + $httpBody = $add_deal_participant_request; } } elseif (count($formParams) > 0) { /* @phpstan-ignore-next-line */ @@ -722,38 +737,38 @@ public function addDealFollowerRequest($id, $add_deal_follower_request = null): } /** - * Operation addDealParticipant + * Operation deleteDealFollower * - * Add a participant to a deal + * Delete a follower from a deal * * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v1\Model\AddDealParticipantRequest|null $add_deal_participant_request add_deal_participant_request (optional) + * @param int $follower_id The ID of the relationship between the follower and the deal (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\PostDealParticipants + * @return \Pipedrive\versions\v1\Model\DeleteDealFollower */ - public function addDealParticipant($id, $add_deal_participant_request = null) + public function deleteDealFollower($id, $follower_id) { - list($response) = $this->addDealParticipantWithHttpInfo($id, $add_deal_participant_request); + list($response) = $this->deleteDealFollowerWithHttpInfo($id, $follower_id); return $response; } /** - * Operation addDealParticipantWithHttpInfo + * Operation deleteDealFollowerWithHttpInfo * - * Add a participant to a deal + * Delete a follower from a deal * * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v1\Model\AddDealParticipantRequest|null $add_deal_participant_request (optional) + * @param int $follower_id The ID of the relationship between the follower and the deal (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\PostDealParticipants, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v1\Model\DeleteDealFollower, HTTP status code, HTTP response headers (array of strings) */ - public function addDealParticipantWithHttpInfo($id, $add_deal_participant_request = null) + public function deleteDealFollowerWithHttpInfo($id, $follower_id) { - $request = $this->addDealParticipantRequest($id, $add_deal_participant_request); + $request = $this->deleteDealFollowerRequest($id, $follower_id); try { $options = $this->createHttpClientOption(); @@ -762,7 +777,7 @@ public function addDealParticipantWithHttpInfo($id, $add_deal_participant_reques } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->addDealParticipantRequest($id, $add_deal_participant_request); + $request = $this->deleteDealFollowerRequest($id, $follower_id); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -787,14 +802,14 @@ public function addDealParticipantWithHttpInfo($id, $add_deal_participant_reques switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\PostDealParticipants' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\DeleteDealFollower' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\PostDealParticipants', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DeleteDealFollower', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -814,14 +829,14 @@ public function addDealParticipantWithHttpInfo($id, $add_deal_participant_reques } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\PostDealParticipants' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\DeleteDealFollower' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\PostDealParticipants', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DeleteDealFollower', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -831,7 +846,7 @@ public function addDealParticipantWithHttpInfo($id, $add_deal_participant_reques case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\PostDealParticipants', + '\Pipedrive\versions\v1\Model\DeleteDealFollower', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -842,19 +857,19 @@ public function addDealParticipantWithHttpInfo($id, $add_deal_participant_reques } /** - * Operation addDealParticipantAsync + * Operation deleteDealFollowerAsync * - * Add a participant to a deal + * Delete a follower from a deal * * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v1\Model\AddDealParticipantRequest|null $add_deal_participant_request (optional) + * @param int $follower_id The ID of the relationship between the follower and the deal (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function addDealParticipantAsync($id, $add_deal_participant_request = null): PromiseInterface + public function deleteDealFollowerAsync($id, $follower_id): PromiseInterface { - return $this->addDealParticipantAsyncWithHttpInfo($id, $add_deal_participant_request) + return $this->deleteDealFollowerAsyncWithHttpInfo($id, $follower_id) ->then( function ($response) { return $response[0]; @@ -863,20 +878,20 @@ function ($response) { } /** - * Operation addDealParticipantAsyncWithHttpInfo + * Operation deleteDealFollowerAsyncWithHttpInfo * - * Add a participant to a deal + * Delete a follower from a deal * * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v1\Model\AddDealParticipantRequest|null $add_deal_participant_request (optional) + * @param int $follower_id The ID of the relationship between the follower and the deal (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function addDealParticipantAsyncWithHttpInfo($id, $add_deal_participant_request = null): PromiseInterface + public function deleteDealFollowerAsyncWithHttpInfo($id, $follower_id): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\PostDealParticipants'; - $request = $this->addDealParticipantRequest($id, $add_deal_participant_request); + $returnType = '\Pipedrive\versions\v1\Model\DeleteDealFollower'; + $request = $this->deleteDealFollowerRequest($id, $follower_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -913,25 +928,32 @@ function ($exception) { } /** - * Create request for operation 'addDealParticipant' + * Create request for operation 'deleteDealFollower' * * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v1\Model\AddDealParticipantRequest|null $add_deal_participant_request (optional) + * @param int $follower_id The ID of the relationship between the follower and the deal (required) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function addDealParticipantRequest($id, $add_deal_participant_request = null): Request + public function deleteDealFollowerRequest($id, $follower_id): Request { // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling addDealParticipant' + 'Missing the required parameter $id when calling deleteDealFollower' + ); + } + // verify the required parameter 'follower_id' is set + /* @phpstan-ignore-next-line */ + if ($follower_id === null || (is_array($follower_id) && count($follower_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $follower_id when calling deleteDealFollower' ); } - $resourcePath = '/deals/{id}/participants'; + $resourcePath = '/deals/{id}/followers/{follower_id}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -948,6 +970,14 @@ public function addDealParticipantRequest($id, $add_deal_participant_request = n $resourcePath ); } + // path params + if ($follower_id !== null) { + $resourcePath = str_replace( + '{' . 'follower_id' . '}', + ObjectSerializer::toPathValue($follower_id), + $resourcePath + ); + } /* @phpstan-ignore-next-line */ @@ -958,18 +988,12 @@ public function addDealParticipantRequest($id, $add_deal_participant_request = n } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - ['application/json'] + [] ); } // for model (json/xml) - if (isset($add_deal_participant_request)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($add_deal_participant_request)); - } else { - $httpBody = $add_deal_participant_request; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { /* @phpstan-ignore-next-line */ if ($multipart) { $multipartContents = []; @@ -1021,7 +1045,7 @@ public function addDealParticipantRequest($id, $add_deal_participant_request = n $query = Query::build($queryParams); return new Request( - 'POST', + 'DELETE', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -1029,40 +1053,38 @@ public function addDealParticipantRequest($id, $add_deal_participant_request = n } /** - * Operation addDealProduct + * Operation deleteDealParticipant * - * Add a product to a deal + * Delete a participant from a deal * * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v1\Model\NewDealProduct|null $new_deal_product new_deal_product (optional) + * @param int $deal_participant_id The ID of the participant of the deal (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\GetAddProductAttachmentDetails - * @deprecated + * @return \Pipedrive\versions\v1\Model\DeleteDealParticipant */ - public function addDealProduct($id, $new_deal_product = null) + public function deleteDealParticipant($id, $deal_participant_id) { - list($response) = $this->addDealProductWithHttpInfo($id, $new_deal_product); + list($response) = $this->deleteDealParticipantWithHttpInfo($id, $deal_participant_id); return $response; } /** - * Operation addDealProductWithHttpInfo + * Operation deleteDealParticipantWithHttpInfo * - * Add a product to a deal + * Delete a participant from a deal * * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v1\Model\NewDealProduct|null $new_deal_product (optional) + * @param int $deal_participant_id The ID of the participant of the deal (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\GetAddProductAttachmentDetails, HTTP status code, HTTP response headers (array of strings) - * @deprecated + * @return array of \Pipedrive\versions\v1\Model\DeleteDealParticipant, HTTP status code, HTTP response headers (array of strings) */ - public function addDealProductWithHttpInfo($id, $new_deal_product = null) + public function deleteDealParticipantWithHttpInfo($id, $deal_participant_id) { - $request = $this->addDealProductRequest($id, $new_deal_product); + $request = $this->deleteDealParticipantRequest($id, $deal_participant_id); try { $options = $this->createHttpClientOption(); @@ -1071,7 +1093,7 @@ public function addDealProductWithHttpInfo($id, $new_deal_product = null) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->addDealProductRequest($id, $new_deal_product); + $request = $this->deleteDealParticipantRequest($id, $deal_participant_id); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -1096,14 +1118,14 @@ public function addDealProductWithHttpInfo($id, $new_deal_product = null) switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetAddProductAttachmentDetails' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\DeleteDealParticipant' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetAddProductAttachmentDetails', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DeleteDealParticipant', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -1123,14 +1145,14 @@ public function addDealProductWithHttpInfo($id, $new_deal_product = null) } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetAddProductAttachmentDetails' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\DeleteDealParticipant' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetAddProductAttachmentDetails', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DeleteDealParticipant', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -1140,7 +1162,7 @@ public function addDealProductWithHttpInfo($id, $new_deal_product = null) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\GetAddProductAttachmentDetails', + '\Pipedrive\versions\v1\Model\DeleteDealParticipant', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1151,20 +1173,19 @@ public function addDealProductWithHttpInfo($id, $new_deal_product = null) } /** - * Operation addDealProductAsync + * Operation deleteDealParticipantAsync * - * Add a product to a deal + * Delete a participant from a deal * * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v1\Model\NewDealProduct|null $new_deal_product (optional) + * @param int $deal_participant_id The ID of the participant of the deal (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function addDealProductAsync($id, $new_deal_product = null): PromiseInterface + public function deleteDealParticipantAsync($id, $deal_participant_id): PromiseInterface { - return $this->addDealProductAsyncWithHttpInfo($id, $new_deal_product) + return $this->deleteDealParticipantAsyncWithHttpInfo($id, $deal_participant_id) ->then( function ($response) { return $response[0]; @@ -1173,21 +1194,20 @@ function ($response) { } /** - * Operation addDealProductAsyncWithHttpInfo + * Operation deleteDealParticipantAsyncWithHttpInfo * - * Add a product to a deal + * Delete a participant from a deal * * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v1\Model\NewDealProduct|null $new_deal_product (optional) + * @param int $deal_participant_id The ID of the participant of the deal (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function addDealProductAsyncWithHttpInfo($id, $new_deal_product = null): PromiseInterface + public function deleteDealParticipantAsyncWithHttpInfo($id, $deal_participant_id): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\GetAddProductAttachmentDetails'; - $request = $this->addDealProductRequest($id, $new_deal_product); + $returnType = '\Pipedrive\versions\v1\Model\DeleteDealParticipant'; + $request = $this->deleteDealParticipantRequest($id, $deal_participant_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1224,26 +1244,32 @@ function ($exception) { } /** - * Create request for operation 'addDealProduct' + * Create request for operation 'deleteDealParticipant' * * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v1\Model\NewDealProduct|null $new_deal_product (optional) + * @param int $deal_participant_id The ID of the participant of the deal (required) * * @throws InvalidArgumentException|OAuthProviderException * @return Request - * @deprecated */ - public function addDealProductRequest($id, $new_deal_product = null): Request + public function deleteDealParticipantRequest($id, $deal_participant_id): Request { // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling addDealProduct' + 'Missing the required parameter $id when calling deleteDealParticipant' + ); + } + // verify the required parameter 'deal_participant_id' is set + /* @phpstan-ignore-next-line */ + if ($deal_participant_id === null || (is_array($deal_participant_id) && count($deal_participant_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $deal_participant_id when calling deleteDealParticipant' ); } - $resourcePath = '/deals/{id}/products'; + $resourcePath = '/deals/{id}/participants/{deal_participant_id}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -1260,6 +1286,14 @@ public function addDealProductRequest($id, $new_deal_product = null): Request $resourcePath ); } + // path params + if ($deal_participant_id !== null) { + $resourcePath = str_replace( + '{' . 'deal_participant_id' . '}', + ObjectSerializer::toPathValue($deal_participant_id), + $resourcePath + ); + } /* @phpstan-ignore-next-line */ @@ -1270,18 +1304,12 @@ public function addDealProductRequest($id, $new_deal_product = null): Request } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - ['application/json'] + [] ); } // for model (json/xml) - if (isset($new_deal_product)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($new_deal_product)); - } else { - $httpBody = $new_deal_product; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { /* @phpstan-ignore-next-line */ if ($multipart) { $multipartContents = []; @@ -1333,7 +1361,7 @@ public function addDealProductRequest($id, $new_deal_product = null): Request $query = Query::build($queryParams); return new Request( - 'POST', + 'DELETE', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -1341,38 +1369,36 @@ public function addDealProductRequest($id, $new_deal_product = null): Request } /** - * Operation deleteDeal + * Operation duplicateDeal * - * Delete a deal + * Duplicate deal * * @param int $id The ID of the deal (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\DeleteDeal - * @deprecated + * @return \Pipedrive\versions\v1\Model\GetDuplicatedDeal */ - public function deleteDeal($id) + public function duplicateDeal($id) { - list($response) = $this->deleteDealWithHttpInfo($id); + list($response) = $this->duplicateDealWithHttpInfo($id); return $response; } /** - * Operation deleteDealWithHttpInfo + * Operation duplicateDealWithHttpInfo * - * Delete a deal + * Duplicate deal * * @param int $id The ID of the deal (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\DeleteDeal, HTTP status code, HTTP response headers (array of strings) - * @deprecated + * @return array of \Pipedrive\versions\v1\Model\GetDuplicatedDeal, HTTP status code, HTTP response headers (array of strings) */ - public function deleteDealWithHttpInfo($id) + public function duplicateDealWithHttpInfo($id) { - $request = $this->deleteDealRequest($id); + $request = $this->duplicateDealRequest($id); try { $options = $this->createHttpClientOption(); @@ -1381,7 +1407,7 @@ public function deleteDealWithHttpInfo($id) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->deleteDealRequest($id); + $request = $this->duplicateDealRequest($id); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -1406,14 +1432,14 @@ public function deleteDealWithHttpInfo($id) switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\DeleteDeal' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\GetDuplicatedDeal' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DeleteDeal', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDuplicatedDeal', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -1433,14 +1459,14 @@ public function deleteDealWithHttpInfo($id) } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\DeleteDeal' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\GetDuplicatedDeal' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DeleteDeal', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDuplicatedDeal', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -1450,7 +1476,7 @@ public function deleteDealWithHttpInfo($id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\DeleteDeal', + '\Pipedrive\versions\v1\Model\GetDuplicatedDeal', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1461,19 +1487,18 @@ public function deleteDealWithHttpInfo($id) } /** - * Operation deleteDealAsync + * Operation duplicateDealAsync * - * Delete a deal + * Duplicate deal * * @param int $id The ID of the deal (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function deleteDealAsync($id): PromiseInterface + public function duplicateDealAsync($id): PromiseInterface { - return $this->deleteDealAsyncWithHttpInfo($id) + return $this->duplicateDealAsyncWithHttpInfo($id) ->then( function ($response) { return $response[0]; @@ -1482,20 +1507,19 @@ function ($response) { } /** - * Operation deleteDealAsyncWithHttpInfo + * Operation duplicateDealAsyncWithHttpInfo * - * Delete a deal + * Duplicate deal * * @param int $id The ID of the deal (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function deleteDealAsyncWithHttpInfo($id): PromiseInterface + public function duplicateDealAsyncWithHttpInfo($id): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\DeleteDeal'; - $request = $this->deleteDealRequest($id); + $returnType = '\Pipedrive\versions\v1\Model\GetDuplicatedDeal'; + $request = $this->duplicateDealRequest($id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1532,25 +1556,24 @@ function ($exception) { } /** - * Create request for operation 'deleteDeal' + * Create request for operation 'duplicateDeal' * * @param int $id The ID of the deal (required) * * @throws InvalidArgumentException|OAuthProviderException * @return Request - * @deprecated */ - public function deleteDealRequest($id): Request + public function duplicateDealRequest($id): Request { // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling deleteDeal' + 'Missing the required parameter $id when calling duplicateDeal' ); } - $resourcePath = '/deals/{id}'; + $resourcePath = '/deals/{id}/duplicate'; $formParams = []; $queryParams = []; $headerParams = []; @@ -1634,7 +1657,7 @@ public function deleteDealRequest($id): Request $query = Query::build($queryParams); return new Request( - 'DELETE', + 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -1642,38 +1665,60 @@ public function deleteDealRequest($id): Request } /** - * Operation deleteDealFollower + * Operation getArchivedDeals * - * Delete a follower from a deal + * Get all archived deals * - * @param int $id The ID of the deal (required) - * @param int $follower_id The ID of the relationship between the follower and the deal (required) + * @param int|null $user_id If supplied, only deals matching the given user will be returned. However, `filter_id` and `owned_by_you` takes precedence over `user_id` when supplied. (optional) + * @param int|null $filter_id The ID of the filter to use (optional) + * @param int|null $person_id If supplied, only deals linked to the specified person are returned. If filter_id is provided, this is ignored. (optional) + * @param int|null $org_id If supplied, only deals linked to the specified organization are returned. If filter_id is provided, this is ignored. (optional) + * @param int|null $product_id If supplied, only deals linked to the specified product are returned. If filter_id is provided, this is ignored. (optional) + * @param int|null $pipeline_id If supplied, only deals in the specified pipeline are returned. If filter_id is provided, this is ignored. (optional) + * @param int|null $stage_id If supplied, only deals in the specified stage are returned. If filter_id is provided, this is ignored. (optional) + * @param string|'all_not_deleted' $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional, default to 'all_not_deleted') + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) + * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $owned_by_you When supplied, only deals owned by you are returned. However, `filter_id` takes precedence over `owned_by_you` when both are supplied. (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\DeleteDealFollower + * @return \Pipedrive\versions\v1\Model\GetDeals + * @deprecated */ - public function deleteDealFollower($id, $follower_id) + public function getArchivedDeals($user_id = null, $filter_id = null, $person_id = null, $org_id = null, $product_id = null, $pipeline_id = null, $stage_id = null, $status = 'all_not_deleted', $start = 0, $limit = null, $sort = null, $owned_by_you = null) { - list($response) = $this->deleteDealFollowerWithHttpInfo($id, $follower_id); + list($response) = $this->getArchivedDealsWithHttpInfo($user_id, $filter_id, $person_id, $org_id, $product_id, $pipeline_id, $stage_id, $status, $start, $limit, $sort, $owned_by_you); return $response; } /** - * Operation deleteDealFollowerWithHttpInfo + * Operation getArchivedDealsWithHttpInfo * - * Delete a follower from a deal + * Get all archived deals * - * @param int $id The ID of the deal (required) - * @param int $follower_id The ID of the relationship between the follower and the deal (required) + * @param int|null $user_id If supplied, only deals matching the given user will be returned. However, `filter_id` and `owned_by_you` takes precedence over `user_id` when supplied. (optional) + * @param int|null $filter_id The ID of the filter to use (optional) + * @param int|null $person_id If supplied, only deals linked to the specified person are returned. If filter_id is provided, this is ignored. (optional) + * @param int|null $org_id If supplied, only deals linked to the specified organization are returned. If filter_id is provided, this is ignored. (optional) + * @param int|null $product_id If supplied, only deals linked to the specified product are returned. If filter_id is provided, this is ignored. (optional) + * @param int|null $pipeline_id If supplied, only deals in the specified pipeline are returned. If filter_id is provided, this is ignored. (optional) + * @param int|null $stage_id If supplied, only deals in the specified stage are returned. If filter_id is provided, this is ignored. (optional) + * @param string|'all_not_deleted' $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional, default to 'all_not_deleted') + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) + * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $owned_by_you When supplied, only deals owned by you are returned. However, `filter_id` takes precedence over `owned_by_you` when both are supplied. (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\DeleteDealFollower, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v1\Model\GetDeals, HTTP status code, HTTP response headers (array of strings) + * @deprecated */ - public function deleteDealFollowerWithHttpInfo($id, $follower_id) + public function getArchivedDealsWithHttpInfo($user_id = null, $filter_id = null, $person_id = null, $org_id = null, $product_id = null, $pipeline_id = null, $stage_id = null, $status = 'all_not_deleted', $start = 0, $limit = null, $sort = null, $owned_by_you = null) { - $request = $this->deleteDealFollowerRequest($id, $follower_id); + $request = $this->getArchivedDealsRequest($user_id, $filter_id, $person_id, $org_id, $product_id, $pipeline_id, $stage_id, $status, $start, $limit, $sort, $owned_by_you); try { $options = $this->createHttpClientOption(); @@ -1682,7 +1727,7 @@ public function deleteDealFollowerWithHttpInfo($id, $follower_id) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->deleteDealFollowerRequest($id, $follower_id); + $request = $this->getArchivedDealsRequest($user_id, $filter_id, $person_id, $org_id, $product_id, $pipeline_id, $stage_id, $status, $start, $limit, $sort, $owned_by_you); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -1707,14 +1752,14 @@ public function deleteDealFollowerWithHttpInfo($id, $follower_id) switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\DeleteDealFollower' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\GetDeals' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DeleteDealFollower', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDeals', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -1734,14 +1779,14 @@ public function deleteDealFollowerWithHttpInfo($id, $follower_id) } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\DeleteDealFollower' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\GetDeals' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DeleteDealFollower', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDeals', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -1751,7 +1796,7 @@ public function deleteDealFollowerWithHttpInfo($id, $follower_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\DeleteDealFollower', + '\Pipedrive\versions\v1\Model\GetDeals', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1762,19 +1807,30 @@ public function deleteDealFollowerWithHttpInfo($id, $follower_id) } /** - * Operation deleteDealFollowerAsync + * Operation getArchivedDealsAsync * - * Delete a follower from a deal + * Get all archived deals * - * @param int $id The ID of the deal (required) - * @param int $follower_id The ID of the relationship between the follower and the deal (required) + * @param int|null $user_id If supplied, only deals matching the given user will be returned. However, `filter_id` and `owned_by_you` takes precedence over `user_id` when supplied. (optional) + * @param int|null $filter_id The ID of the filter to use (optional) + * @param int|null $person_id If supplied, only deals linked to the specified person are returned. If filter_id is provided, this is ignored. (optional) + * @param int|null $org_id If supplied, only deals linked to the specified organization are returned. If filter_id is provided, this is ignored. (optional) + * @param int|null $product_id If supplied, only deals linked to the specified product are returned. If filter_id is provided, this is ignored. (optional) + * @param int|null $pipeline_id If supplied, only deals in the specified pipeline are returned. If filter_id is provided, this is ignored. (optional) + * @param int|null $stage_id If supplied, only deals in the specified stage are returned. If filter_id is provided, this is ignored. (optional) + * @param string|'all_not_deleted' $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional, default to 'all_not_deleted') + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) + * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $owned_by_you When supplied, only deals owned by you are returned. However, `filter_id` takes precedence over `owned_by_you` when both are supplied. (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface + * @deprecated */ - public function deleteDealFollowerAsync($id, $follower_id): PromiseInterface + public function getArchivedDealsAsync($user_id = null, $filter_id = null, $person_id = null, $org_id = null, $product_id = null, $pipeline_id = null, $stage_id = null, $status = 'all_not_deleted', $start = 0, $limit = null, $sort = null, $owned_by_you = null): PromiseInterface { - return $this->deleteDealFollowerAsyncWithHttpInfo($id, $follower_id) + return $this->getArchivedDealsAsyncWithHttpInfo($user_id, $filter_id, $person_id, $org_id, $product_id, $pipeline_id, $stage_id, $status, $start, $limit, $sort, $owned_by_you) ->then( function ($response) { return $response[0]; @@ -1783,20 +1839,31 @@ function ($response) { } /** - * Operation deleteDealFollowerAsyncWithHttpInfo + * Operation getArchivedDealsAsyncWithHttpInfo * - * Delete a follower from a deal + * Get all archived deals * - * @param int $id The ID of the deal (required) - * @param int $follower_id The ID of the relationship between the follower and the deal (required) + * @param int|null $user_id If supplied, only deals matching the given user will be returned. However, `filter_id` and `owned_by_you` takes precedence over `user_id` when supplied. (optional) + * @param int|null $filter_id The ID of the filter to use (optional) + * @param int|null $person_id If supplied, only deals linked to the specified person are returned. If filter_id is provided, this is ignored. (optional) + * @param int|null $org_id If supplied, only deals linked to the specified organization are returned. If filter_id is provided, this is ignored. (optional) + * @param int|null $product_id If supplied, only deals linked to the specified product are returned. If filter_id is provided, this is ignored. (optional) + * @param int|null $pipeline_id If supplied, only deals in the specified pipeline are returned. If filter_id is provided, this is ignored. (optional) + * @param int|null $stage_id If supplied, only deals in the specified stage are returned. If filter_id is provided, this is ignored. (optional) + * @param string|'all_not_deleted' $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional, default to 'all_not_deleted') + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) + * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $owned_by_you When supplied, only deals owned by you are returned. However, `filter_id` takes precedence over `owned_by_you` when both are supplied. (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface + * @deprecated */ - public function deleteDealFollowerAsyncWithHttpInfo($id, $follower_id): PromiseInterface + public function getArchivedDealsAsyncWithHttpInfo($user_id = null, $filter_id = null, $person_id = null, $org_id = null, $product_id = null, $pipeline_id = null, $stage_id = null, $status = 'all_not_deleted', $start = 0, $limit = null, $sort = null, $owned_by_you = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\DeleteDealFollower'; - $request = $this->deleteDealFollowerRequest($id, $follower_id); + $returnType = '\Pipedrive\versions\v1\Model\GetDeals'; + $request = $this->getArchivedDealsRequest($user_id, $filter_id, $person_id, $org_id, $product_id, $pipeline_id, $stage_id, $status, $start, $limit, $sort, $owned_by_you); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1833,4427 +1900,99 @@ function ($exception) { } /** - * Create request for operation 'deleteDealFollower' + * Create request for operation 'getArchivedDeals' * - * @param int $id The ID of the deal (required) - * @param int $follower_id The ID of the relationship between the follower and the deal (required) + * @param int|null $user_id If supplied, only deals matching the given user will be returned. However, `filter_id` and `owned_by_you` takes precedence over `user_id` when supplied. (optional) + * @param int|null $filter_id The ID of the filter to use (optional) + * @param int|null $person_id If supplied, only deals linked to the specified person are returned. If filter_id is provided, this is ignored. (optional) + * @param int|null $org_id If supplied, only deals linked to the specified organization are returned. If filter_id is provided, this is ignored. (optional) + * @param int|null $product_id If supplied, only deals linked to the specified product are returned. If filter_id is provided, this is ignored. (optional) + * @param int|null $pipeline_id If supplied, only deals in the specified pipeline are returned. If filter_id is provided, this is ignored. (optional) + * @param int|null $stage_id If supplied, only deals in the specified stage are returned. If filter_id is provided, this is ignored. (optional) + * @param string|'all_not_deleted' $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional, default to 'all_not_deleted') + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) + * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $owned_by_you When supplied, only deals owned by you are returned. However, `filter_id` takes precedence over `owned_by_you` when both are supplied. (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request + * @deprecated */ - public function deleteDealFollowerRequest($id, $follower_id): Request + public function getArchivedDealsRequest($user_id = null, $filter_id = null, $person_id = null, $org_id = null, $product_id = null, $pipeline_id = null, $stage_id = null, $status = 'all_not_deleted', $start = 0, $limit = null, $sort = null, $owned_by_you = null): Request { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling deleteDealFollower' - ); - } - // verify the required parameter 'follower_id' is set - /* @phpstan-ignore-next-line */ - if ($follower_id === null || (is_array($follower_id) && count($follower_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $follower_id when calling deleteDealFollower' - ); - } - $resourcePath = '/deals/{id}/followers/{follower_id}'; + $resourcePath = '/deals/archived'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); + // query params + /* @phpstan-ignore-next-line */ + if (is_array($user_id)) { + $user_id = ObjectSerializer::serializeCollection($user_id, '', true); } - // path params - if ($follower_id !== null) { - $resourcePath = str_replace( - '{' . 'follower_id' . '}', - ObjectSerializer::toPathValue($follower_id), - $resourcePath - ); + if ($user_id !== null) { + $queryParams['user_id'] = $user_id; } - - + // query params /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); + if (is_array($filter_id)) { + $filter_id = ObjectSerializer::serializeCollection($filter_id, '', true); } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation deleteDealParticipant - * - * Delete a participant from a deal - * - * @param int $id The ID of the deal (required) - * @param int $deal_participant_id The ID of the participant of the deal (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\DeleteDealParticipant - */ - public function deleteDealParticipant($id, $deal_participant_id) - { - list($response) = $this->deleteDealParticipantWithHttpInfo($id, $deal_participant_id); - return $response; - } - - /** - * Operation deleteDealParticipantWithHttpInfo - * - * Delete a participant from a deal - * - * @param int $id The ID of the deal (required) - * @param int $deal_participant_id The ID of the participant of the deal (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\DeleteDealParticipant, HTTP status code, HTTP response headers (array of strings) - */ - public function deleteDealParticipantWithHttpInfo($id, $deal_participant_id) - { - $request = $this->deleteDealParticipantRequest($id, $deal_participant_id); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->deleteDealParticipantRequest($id, $deal_participant_id); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\DeleteDealParticipant' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DeleteDealParticipant', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\DeleteDealParticipant' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DeleteDealParticipant', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\DeleteDealParticipant', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation deleteDealParticipantAsync - * - * Delete a participant from a deal - * - * @param int $id The ID of the deal (required) - * @param int $deal_participant_id The ID of the participant of the deal (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function deleteDealParticipantAsync($id, $deal_participant_id): PromiseInterface - { - return $this->deleteDealParticipantAsyncWithHttpInfo($id, $deal_participant_id) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation deleteDealParticipantAsyncWithHttpInfo - * - * Delete a participant from a deal - * - * @param int $id The ID of the deal (required) - * @param int $deal_participant_id The ID of the participant of the deal (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function deleteDealParticipantAsyncWithHttpInfo($id, $deal_participant_id): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\DeleteDealParticipant'; - $request = $this->deleteDealParticipantRequest($id, $deal_participant_id); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'deleteDealParticipant' - * - * @param int $id The ID of the deal (required) - * @param int $deal_participant_id The ID of the participant of the deal (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - */ - public function deleteDealParticipantRequest($id, $deal_participant_id): Request - { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling deleteDealParticipant' - ); - } - // verify the required parameter 'deal_participant_id' is set - /* @phpstan-ignore-next-line */ - if ($deal_participant_id === null || (is_array($deal_participant_id) && count($deal_participant_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $deal_participant_id when calling deleteDealParticipant' - ); - } - - $resourcePath = '/deals/{id}/participants/{deal_participant_id}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - // path params - if ($deal_participant_id !== null) { - $resourcePath = str_replace( - '{' . 'deal_participant_id' . '}', - ObjectSerializer::toPathValue($deal_participant_id), - $resourcePath - ); - } - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation deleteDealProduct - * - * Delete an attached product from a deal - * - * @param int $id The ID of the deal (required) - * @param int $product_attachment_id The product attachment ID (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\DeleteDealProduct - * @deprecated - */ - public function deleteDealProduct($id, $product_attachment_id) - { - list($response) = $this->deleteDealProductWithHttpInfo($id, $product_attachment_id); - return $response; - } - - /** - * Operation deleteDealProductWithHttpInfo - * - * Delete an attached product from a deal - * - * @param int $id The ID of the deal (required) - * @param int $product_attachment_id The product attachment ID (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\DeleteDealProduct, HTTP status code, HTTP response headers (array of strings) - * @deprecated - */ - public function deleteDealProductWithHttpInfo($id, $product_attachment_id) - { - $request = $this->deleteDealProductRequest($id, $product_attachment_id); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->deleteDealProductRequest($id, $product_attachment_id); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\DeleteDealProduct' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DeleteDealProduct', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\DeleteDealProduct' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DeleteDealProduct', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\DeleteDealProduct', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation deleteDealProductAsync - * - * Delete an attached product from a deal - * - * @param int $id The ID of the deal (required) - * @param int $product_attachment_id The product attachment ID (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function deleteDealProductAsync($id, $product_attachment_id): PromiseInterface - { - return $this->deleteDealProductAsyncWithHttpInfo($id, $product_attachment_id) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation deleteDealProductAsyncWithHttpInfo - * - * Delete an attached product from a deal - * - * @param int $id The ID of the deal (required) - * @param int $product_attachment_id The product attachment ID (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function deleteDealProductAsyncWithHttpInfo($id, $product_attachment_id): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\DeleteDealProduct'; - $request = $this->deleteDealProductRequest($id, $product_attachment_id); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'deleteDealProduct' - * - * @param int $id The ID of the deal (required) - * @param int $product_attachment_id The product attachment ID (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - * @deprecated - */ - public function deleteDealProductRequest($id, $product_attachment_id): Request - { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling deleteDealProduct' - ); - } - // verify the required parameter 'product_attachment_id' is set - /* @phpstan-ignore-next-line */ - if ($product_attachment_id === null || (is_array($product_attachment_id) && count($product_attachment_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $product_attachment_id when calling deleteDealProduct' - ); - } - - $resourcePath = '/deals/{id}/products/{product_attachment_id}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - // path params - if ($product_attachment_id !== null) { - $resourcePath = str_replace( - '{' . 'product_attachment_id' . '}', - ObjectSerializer::toPathValue($product_attachment_id), - $resourcePath - ); - } - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation duplicateDeal - * - * Duplicate deal - * - * @param int $id The ID of the deal (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\GetDuplicatedDeal - */ - public function duplicateDeal($id) - { - list($response) = $this->duplicateDealWithHttpInfo($id); - return $response; - } - - /** - * Operation duplicateDealWithHttpInfo - * - * Duplicate deal - * - * @param int $id The ID of the deal (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\GetDuplicatedDeal, HTTP status code, HTTP response headers (array of strings) - */ - public function duplicateDealWithHttpInfo($id) - { - $request = $this->duplicateDealRequest($id); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->duplicateDealRequest($id); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetDuplicatedDeal' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDuplicatedDeal', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetDuplicatedDeal' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDuplicatedDeal', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\GetDuplicatedDeal', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation duplicateDealAsync - * - * Duplicate deal - * - * @param int $id The ID of the deal (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function duplicateDealAsync($id): PromiseInterface - { - return $this->duplicateDealAsyncWithHttpInfo($id) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation duplicateDealAsyncWithHttpInfo - * - * Duplicate deal - * - * @param int $id The ID of the deal (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function duplicateDealAsyncWithHttpInfo($id): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\GetDuplicatedDeal'; - $request = $this->duplicateDealRequest($id); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'duplicateDeal' - * - * @param int $id The ID of the deal (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - */ - public function duplicateDealRequest($id): Request - { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling duplicateDeal' - ); - } - - $resourcePath = '/deals/{id}/duplicate'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getArchivedDeals - * - * Get all archived deals - * - * @param int|null $user_id If supplied, only deals matching the given user will be returned. However, `filter_id` and `owned_by_you` takes precedence over `user_id` when supplied. (optional) - * @param int|null $filter_id The ID of the filter to use (optional) - * @param int|null $person_id If supplied, only deals linked to the specified person are returned. If filter_id is provided, this is ignored. (optional) - * @param int|null $org_id If supplied, only deals linked to the specified organization are returned. If filter_id is provided, this is ignored. (optional) - * @param int|null $product_id If supplied, only deals linked to the specified product are returned. If filter_id is provided, this is ignored. (optional) - * @param int|null $pipeline_id If supplied, only deals in the specified pipeline are returned. If filter_id is provided, this is ignored. (optional) - * @param int|null $stage_id If supplied, only deals in the specified stage are returned. If filter_id is provided, this is ignored. (optional) - * @param string|'all_not_deleted' $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional, default to 'all_not_deleted') - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $owned_by_you When supplied, only deals owned by you are returned. However, `filter_id` takes precedence over `owned_by_you` when both are supplied. (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\GetDeals - * @deprecated - */ - public function getArchivedDeals($user_id = null, $filter_id = null, $person_id = null, $org_id = null, $product_id = null, $pipeline_id = null, $stage_id = null, $status = 'all_not_deleted', $start = 0, $limit = null, $sort = null, $owned_by_you = null) - { - list($response) = $this->getArchivedDealsWithHttpInfo($user_id, $filter_id, $person_id, $org_id, $product_id, $pipeline_id, $stage_id, $status, $start, $limit, $sort, $owned_by_you); - return $response; - } - - /** - * Operation getArchivedDealsWithHttpInfo - * - * Get all archived deals - * - * @param int|null $user_id If supplied, only deals matching the given user will be returned. However, `filter_id` and `owned_by_you` takes precedence over `user_id` when supplied. (optional) - * @param int|null $filter_id The ID of the filter to use (optional) - * @param int|null $person_id If supplied, only deals linked to the specified person are returned. If filter_id is provided, this is ignored. (optional) - * @param int|null $org_id If supplied, only deals linked to the specified organization are returned. If filter_id is provided, this is ignored. (optional) - * @param int|null $product_id If supplied, only deals linked to the specified product are returned. If filter_id is provided, this is ignored. (optional) - * @param int|null $pipeline_id If supplied, only deals in the specified pipeline are returned. If filter_id is provided, this is ignored. (optional) - * @param int|null $stage_id If supplied, only deals in the specified stage are returned. If filter_id is provided, this is ignored. (optional) - * @param string|'all_not_deleted' $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional, default to 'all_not_deleted') - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $owned_by_you When supplied, only deals owned by you are returned. However, `filter_id` takes precedence over `owned_by_you` when both are supplied. (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\GetDeals, HTTP status code, HTTP response headers (array of strings) - * @deprecated - */ - public function getArchivedDealsWithHttpInfo($user_id = null, $filter_id = null, $person_id = null, $org_id = null, $product_id = null, $pipeline_id = null, $stage_id = null, $status = 'all_not_deleted', $start = 0, $limit = null, $sort = null, $owned_by_you = null) - { - $request = $this->getArchivedDealsRequest($user_id, $filter_id, $person_id, $org_id, $product_id, $pipeline_id, $stage_id, $status, $start, $limit, $sort, $owned_by_you); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->getArchivedDealsRequest($user_id, $filter_id, $person_id, $org_id, $product_id, $pipeline_id, $stage_id, $status, $start, $limit, $sort, $owned_by_you); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetDeals' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDeals', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetDeals' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDeals', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\GetDeals', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getArchivedDealsAsync - * - * Get all archived deals - * - * @param int|null $user_id If supplied, only deals matching the given user will be returned. However, `filter_id` and `owned_by_you` takes precedence over `user_id` when supplied. (optional) - * @param int|null $filter_id The ID of the filter to use (optional) - * @param int|null $person_id If supplied, only deals linked to the specified person are returned. If filter_id is provided, this is ignored. (optional) - * @param int|null $org_id If supplied, only deals linked to the specified organization are returned. If filter_id is provided, this is ignored. (optional) - * @param int|null $product_id If supplied, only deals linked to the specified product are returned. If filter_id is provided, this is ignored. (optional) - * @param int|null $pipeline_id If supplied, only deals in the specified pipeline are returned. If filter_id is provided, this is ignored. (optional) - * @param int|null $stage_id If supplied, only deals in the specified stage are returned. If filter_id is provided, this is ignored. (optional) - * @param string|'all_not_deleted' $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional, default to 'all_not_deleted') - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $owned_by_you When supplied, only deals owned by you are returned. However, `filter_id` takes precedence over `owned_by_you` when both are supplied. (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function getArchivedDealsAsync($user_id = null, $filter_id = null, $person_id = null, $org_id = null, $product_id = null, $pipeline_id = null, $stage_id = null, $status = 'all_not_deleted', $start = 0, $limit = null, $sort = null, $owned_by_you = null): PromiseInterface - { - return $this->getArchivedDealsAsyncWithHttpInfo($user_id, $filter_id, $person_id, $org_id, $product_id, $pipeline_id, $stage_id, $status, $start, $limit, $sort, $owned_by_you) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getArchivedDealsAsyncWithHttpInfo - * - * Get all archived deals - * - * @param int|null $user_id If supplied, only deals matching the given user will be returned. However, `filter_id` and `owned_by_you` takes precedence over `user_id` when supplied. (optional) - * @param int|null $filter_id The ID of the filter to use (optional) - * @param int|null $person_id If supplied, only deals linked to the specified person are returned. If filter_id is provided, this is ignored. (optional) - * @param int|null $org_id If supplied, only deals linked to the specified organization are returned. If filter_id is provided, this is ignored. (optional) - * @param int|null $product_id If supplied, only deals linked to the specified product are returned. If filter_id is provided, this is ignored. (optional) - * @param int|null $pipeline_id If supplied, only deals in the specified pipeline are returned. If filter_id is provided, this is ignored. (optional) - * @param int|null $stage_id If supplied, only deals in the specified stage are returned. If filter_id is provided, this is ignored. (optional) - * @param string|'all_not_deleted' $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional, default to 'all_not_deleted') - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $owned_by_you When supplied, only deals owned by you are returned. However, `filter_id` takes precedence over `owned_by_you` when both are supplied. (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function getArchivedDealsAsyncWithHttpInfo($user_id = null, $filter_id = null, $person_id = null, $org_id = null, $product_id = null, $pipeline_id = null, $stage_id = null, $status = 'all_not_deleted', $start = 0, $limit = null, $sort = null, $owned_by_you = null): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\GetDeals'; - $request = $this->getArchivedDealsRequest($user_id, $filter_id, $person_id, $org_id, $product_id, $pipeline_id, $stage_id, $status, $start, $limit, $sort, $owned_by_you); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getArchivedDeals' - * - * @param int|null $user_id If supplied, only deals matching the given user will be returned. However, `filter_id` and `owned_by_you` takes precedence over `user_id` when supplied. (optional) - * @param int|null $filter_id The ID of the filter to use (optional) - * @param int|null $person_id If supplied, only deals linked to the specified person are returned. If filter_id is provided, this is ignored. (optional) - * @param int|null $org_id If supplied, only deals linked to the specified organization are returned. If filter_id is provided, this is ignored. (optional) - * @param int|null $product_id If supplied, only deals linked to the specified product are returned. If filter_id is provided, this is ignored. (optional) - * @param int|null $pipeline_id If supplied, only deals in the specified pipeline are returned. If filter_id is provided, this is ignored. (optional) - * @param int|null $stage_id If supplied, only deals in the specified stage are returned. If filter_id is provided, this is ignored. (optional) - * @param string|'all_not_deleted' $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional, default to 'all_not_deleted') - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $owned_by_you When supplied, only deals owned by you are returned. However, `filter_id` takes precedence over `owned_by_you` when both are supplied. (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - * @deprecated - */ - public function getArchivedDealsRequest($user_id = null, $filter_id = null, $person_id = null, $org_id = null, $product_id = null, $pipeline_id = null, $stage_id = null, $status = 'all_not_deleted', $start = 0, $limit = null, $sort = null, $owned_by_you = null): Request - { - - $resourcePath = '/deals/archived'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - /* @phpstan-ignore-next-line */ - if (is_array($user_id)) { - $user_id = ObjectSerializer::serializeCollection($user_id, '', true); - } - if ($user_id !== null) { - $queryParams['user_id'] = $user_id; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($filter_id)) { - $filter_id = ObjectSerializer::serializeCollection($filter_id, '', true); - } - if ($filter_id !== null) { - $queryParams['filter_id'] = $filter_id; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($person_id)) { - $person_id = ObjectSerializer::serializeCollection($person_id, '', true); - } - if ($person_id !== null) { - $queryParams['person_id'] = $person_id; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($org_id)) { - $org_id = ObjectSerializer::serializeCollection($org_id, '', true); - } - if ($org_id !== null) { - $queryParams['org_id'] = $org_id; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($product_id)) { - $product_id = ObjectSerializer::serializeCollection($product_id, '', true); - } - if ($product_id !== null) { - $queryParams['product_id'] = $product_id; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($pipeline_id)) { - $pipeline_id = ObjectSerializer::serializeCollection($pipeline_id, '', true); - } - if ($pipeline_id !== null) { - $queryParams['pipeline_id'] = $pipeline_id; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($stage_id)) { - $stage_id = ObjectSerializer::serializeCollection($stage_id, '', true); - } - if ($stage_id !== null) { - $queryParams['stage_id'] = $stage_id; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($status)) { - $status = ObjectSerializer::serializeCollection($status, '', true); - } - if ($status !== null) { - $queryParams['status'] = $status; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($start)) { - $start = ObjectSerializer::serializeCollection($start, '', true); - } - if ($start !== null) { - $queryParams['start'] = $start; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($limit)) { - $limit = ObjectSerializer::serializeCollection($limit, '', true); - } - if ($limit !== null) { - $queryParams['limit'] = $limit; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($sort)) { - $sort = ObjectSerializer::serializeCollection($sort, '', true); - } - if ($sort !== null) { - $queryParams['sort'] = $sort; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($owned_by_you)) { - $owned_by_you = ObjectSerializer::serializeCollection($owned_by_you, '', true); - } - if ($owned_by_you !== null) { - $queryParams['owned_by_you'] = $owned_by_you; - } - - - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getArchivedDealsSummary - * - * Get archived deals summary - * - * @param string|null $status Only fetch deals with a specific status. open = Open, won = Won, lost = Lost. (optional) - * @param int|null $filter_id <code>user_id</code> will not be considered. Only deals matching the given filter will be returned. (optional) - * @param int|null $user_id Only deals matching the given user will be returned. `user_id` will not be considered if you use `filter_id`. (optional) - * @param int|null $pipeline_id Only deals within the given pipeline will be returned (optional) - * @param int|null $stage_id Only deals within the given stage will be returned (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\GetDealsSummary - * @deprecated - */ - public function getArchivedDealsSummary($status = null, $filter_id = null, $user_id = null, $pipeline_id = null, $stage_id = null) - { - list($response) = $this->getArchivedDealsSummaryWithHttpInfo($status, $filter_id, $user_id, $pipeline_id, $stage_id); - return $response; - } - - /** - * Operation getArchivedDealsSummaryWithHttpInfo - * - * Get archived deals summary - * - * @param string|null $status Only fetch deals with a specific status. open = Open, won = Won, lost = Lost. (optional) - * @param int|null $filter_id <code>user_id</code> will not be considered. Only deals matching the given filter will be returned. (optional) - * @param int|null $user_id Only deals matching the given user will be returned. `user_id` will not be considered if you use `filter_id`. (optional) - * @param int|null $pipeline_id Only deals within the given pipeline will be returned (optional) - * @param int|null $stage_id Only deals within the given stage will be returned (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\GetDealsSummary, HTTP status code, HTTP response headers (array of strings) - * @deprecated - */ - public function getArchivedDealsSummaryWithHttpInfo($status = null, $filter_id = null, $user_id = null, $pipeline_id = null, $stage_id = null) - { - $request = $this->getArchivedDealsSummaryRequest($status, $filter_id, $user_id, $pipeline_id, $stage_id); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->getArchivedDealsSummaryRequest($status, $filter_id, $user_id, $pipeline_id, $stage_id); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetDealsSummary' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDealsSummary', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetDealsSummary' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDealsSummary', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\GetDealsSummary', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getArchivedDealsSummaryAsync - * - * Get archived deals summary - * - * @param string|null $status Only fetch deals with a specific status. open = Open, won = Won, lost = Lost. (optional) - * @param int|null $filter_id <code>user_id</code> will not be considered. Only deals matching the given filter will be returned. (optional) - * @param int|null $user_id Only deals matching the given user will be returned. `user_id` will not be considered if you use `filter_id`. (optional) - * @param int|null $pipeline_id Only deals within the given pipeline will be returned (optional) - * @param int|null $stage_id Only deals within the given stage will be returned (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function getArchivedDealsSummaryAsync($status = null, $filter_id = null, $user_id = null, $pipeline_id = null, $stage_id = null): PromiseInterface - { - return $this->getArchivedDealsSummaryAsyncWithHttpInfo($status, $filter_id, $user_id, $pipeline_id, $stage_id) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getArchivedDealsSummaryAsyncWithHttpInfo - * - * Get archived deals summary - * - * @param string|null $status Only fetch deals with a specific status. open = Open, won = Won, lost = Lost. (optional) - * @param int|null $filter_id <code>user_id</code> will not be considered. Only deals matching the given filter will be returned. (optional) - * @param int|null $user_id Only deals matching the given user will be returned. `user_id` will not be considered if you use `filter_id`. (optional) - * @param int|null $pipeline_id Only deals within the given pipeline will be returned (optional) - * @param int|null $stage_id Only deals within the given stage will be returned (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function getArchivedDealsSummaryAsyncWithHttpInfo($status = null, $filter_id = null, $user_id = null, $pipeline_id = null, $stage_id = null): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\GetDealsSummary'; - $request = $this->getArchivedDealsSummaryRequest($status, $filter_id, $user_id, $pipeline_id, $stage_id); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getArchivedDealsSummary' - * - * @param string|null $status Only fetch deals with a specific status. open = Open, won = Won, lost = Lost. (optional) - * @param int|null $filter_id <code>user_id</code> will not be considered. Only deals matching the given filter will be returned. (optional) - * @param int|null $user_id Only deals matching the given user will be returned. `user_id` will not be considered if you use `filter_id`. (optional) - * @param int|null $pipeline_id Only deals within the given pipeline will be returned (optional) - * @param int|null $stage_id Only deals within the given stage will be returned (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - * @deprecated - */ - public function getArchivedDealsSummaryRequest($status = null, $filter_id = null, $user_id = null, $pipeline_id = null, $stage_id = null): Request - { - - $resourcePath = '/deals/summary/archived'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - /* @phpstan-ignore-next-line */ - if (is_array($status)) { - $status = ObjectSerializer::serializeCollection($status, '', true); - } - if ($status !== null) { - $queryParams['status'] = $status; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($filter_id)) { - $filter_id = ObjectSerializer::serializeCollection($filter_id, '', true); - } - if ($filter_id !== null) { - $queryParams['filter_id'] = $filter_id; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($user_id)) { - $user_id = ObjectSerializer::serializeCollection($user_id, '', true); - } - if ($user_id !== null) { - $queryParams['user_id'] = $user_id; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($pipeline_id)) { - $pipeline_id = ObjectSerializer::serializeCollection($pipeline_id, '', true); - } - if ($pipeline_id !== null) { - $queryParams['pipeline_id'] = $pipeline_id; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($stage_id)) { - $stage_id = ObjectSerializer::serializeCollection($stage_id, '', true); - } - if ($stage_id !== null) { - $queryParams['stage_id'] = $stage_id; - } - - - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getArchivedDealsTimeline - * - * Get archived deals timeline - * - * @param \DateTime $start_date The date when the first interval starts. Format: YYYY-MM-DD. (required) - * @param string $interval The type of the interval<table><tr><th>Value</th><th>Description</th></tr><tr><td>`day`</td><td>Day</td></tr><tr><td>`week`</td><td>A full week (7 days) starting from `start_date`</td></tr><tr><td>`month`</td><td>A full month (depending on the number of days in given month) starting from `start_date`</td></tr><tr><td>`quarter`</td><td>A full quarter (3 months) starting from `start_date`</td></tr></table> (required) - * @param int $amount The number of given intervals, starting from `start_date`, to fetch. E.g. 3 (months). (required) - * @param string $field_key The date field key which deals will be retrieved from (required) - * @param int|null $user_id If supplied, only deals matching the given user will be returned (optional) - * @param int|null $pipeline_id If supplied, only deals matching the given pipeline will be returned (optional) - * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $exclude_deals Whether to exclude deals list (1) or not (0). Note that when deals are excluded, the timeline summary (counts and values) is still returned. (optional) - * @param string|null $totals_convert_currency The 3-letter currency code of any of the supported currencies. When supplied, `totals_converted` is returned per each interval which contains the currency-converted total amounts in the given currency. You may also set this parameter to `default_currency` in which case the user's default currency is used. (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\GetDealsTimeline - * @deprecated - */ - public function getArchivedDealsTimeline($start_date, $interval, $amount, $field_key, $user_id = null, $pipeline_id = null, $filter_id = null, $exclude_deals = null, $totals_convert_currency = null) - { - list($response) = $this->getArchivedDealsTimelineWithHttpInfo($start_date, $interval, $amount, $field_key, $user_id, $pipeline_id, $filter_id, $exclude_deals, $totals_convert_currency); - return $response; - } - - /** - * Operation getArchivedDealsTimelineWithHttpInfo - * - * Get archived deals timeline - * - * @param \DateTime $start_date The date when the first interval starts. Format: YYYY-MM-DD. (required) - * @param string $interval The type of the interval<table><tr><th>Value</th><th>Description</th></tr><tr><td>`day`</td><td>Day</td></tr><tr><td>`week`</td><td>A full week (7 days) starting from `start_date`</td></tr><tr><td>`month`</td><td>A full month (depending on the number of days in given month) starting from `start_date`</td></tr><tr><td>`quarter`</td><td>A full quarter (3 months) starting from `start_date`</td></tr></table> (required) - * @param int $amount The number of given intervals, starting from `start_date`, to fetch. E.g. 3 (months). (required) - * @param string $field_key The date field key which deals will be retrieved from (required) - * @param int|null $user_id If supplied, only deals matching the given user will be returned (optional) - * @param int|null $pipeline_id If supplied, only deals matching the given pipeline will be returned (optional) - * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $exclude_deals Whether to exclude deals list (1) or not (0). Note that when deals are excluded, the timeline summary (counts and values) is still returned. (optional) - * @param string|null $totals_convert_currency The 3-letter currency code of any of the supported currencies. When supplied, `totals_converted` is returned per each interval which contains the currency-converted total amounts in the given currency. You may also set this parameter to `default_currency` in which case the user's default currency is used. (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\GetDealsTimeline, HTTP status code, HTTP response headers (array of strings) - * @deprecated - */ - public function getArchivedDealsTimelineWithHttpInfo($start_date, $interval, $amount, $field_key, $user_id = null, $pipeline_id = null, $filter_id = null, $exclude_deals = null, $totals_convert_currency = null) - { - $request = $this->getArchivedDealsTimelineRequest($start_date, $interval, $amount, $field_key, $user_id, $pipeline_id, $filter_id, $exclude_deals, $totals_convert_currency); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->getArchivedDealsTimelineRequest($start_date, $interval, $amount, $field_key, $user_id, $pipeline_id, $filter_id, $exclude_deals, $totals_convert_currency); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetDealsTimeline' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDealsTimeline', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetDealsTimeline' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDealsTimeline', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\GetDealsTimeline', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getArchivedDealsTimelineAsync - * - * Get archived deals timeline - * - * @param \DateTime $start_date The date when the first interval starts. Format: YYYY-MM-DD. (required) - * @param string $interval The type of the interval<table><tr><th>Value</th><th>Description</th></tr><tr><td>`day`</td><td>Day</td></tr><tr><td>`week`</td><td>A full week (7 days) starting from `start_date`</td></tr><tr><td>`month`</td><td>A full month (depending on the number of days in given month) starting from `start_date`</td></tr><tr><td>`quarter`</td><td>A full quarter (3 months) starting from `start_date`</td></tr></table> (required) - * @param int $amount The number of given intervals, starting from `start_date`, to fetch. E.g. 3 (months). (required) - * @param string $field_key The date field key which deals will be retrieved from (required) - * @param int|null $user_id If supplied, only deals matching the given user will be returned (optional) - * @param int|null $pipeline_id If supplied, only deals matching the given pipeline will be returned (optional) - * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $exclude_deals Whether to exclude deals list (1) or not (0). Note that when deals are excluded, the timeline summary (counts and values) is still returned. (optional) - * @param string|null $totals_convert_currency The 3-letter currency code of any of the supported currencies. When supplied, `totals_converted` is returned per each interval which contains the currency-converted total amounts in the given currency. You may also set this parameter to `default_currency` in which case the user's default currency is used. (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function getArchivedDealsTimelineAsync($start_date, $interval, $amount, $field_key, $user_id = null, $pipeline_id = null, $filter_id = null, $exclude_deals = null, $totals_convert_currency = null): PromiseInterface - { - return $this->getArchivedDealsTimelineAsyncWithHttpInfo($start_date, $interval, $amount, $field_key, $user_id, $pipeline_id, $filter_id, $exclude_deals, $totals_convert_currency) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getArchivedDealsTimelineAsyncWithHttpInfo - * - * Get archived deals timeline - * - * @param \DateTime $start_date The date when the first interval starts. Format: YYYY-MM-DD. (required) - * @param string $interval The type of the interval<table><tr><th>Value</th><th>Description</th></tr><tr><td>`day`</td><td>Day</td></tr><tr><td>`week`</td><td>A full week (7 days) starting from `start_date`</td></tr><tr><td>`month`</td><td>A full month (depending on the number of days in given month) starting from `start_date`</td></tr><tr><td>`quarter`</td><td>A full quarter (3 months) starting from `start_date`</td></tr></table> (required) - * @param int $amount The number of given intervals, starting from `start_date`, to fetch. E.g. 3 (months). (required) - * @param string $field_key The date field key which deals will be retrieved from (required) - * @param int|null $user_id If supplied, only deals matching the given user will be returned (optional) - * @param int|null $pipeline_id If supplied, only deals matching the given pipeline will be returned (optional) - * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $exclude_deals Whether to exclude deals list (1) or not (0). Note that when deals are excluded, the timeline summary (counts and values) is still returned. (optional) - * @param string|null $totals_convert_currency The 3-letter currency code of any of the supported currencies. When supplied, `totals_converted` is returned per each interval which contains the currency-converted total amounts in the given currency. You may also set this parameter to `default_currency` in which case the user's default currency is used. (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function getArchivedDealsTimelineAsyncWithHttpInfo($start_date, $interval, $amount, $field_key, $user_id = null, $pipeline_id = null, $filter_id = null, $exclude_deals = null, $totals_convert_currency = null): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\GetDealsTimeline'; - $request = $this->getArchivedDealsTimelineRequest($start_date, $interval, $amount, $field_key, $user_id, $pipeline_id, $filter_id, $exclude_deals, $totals_convert_currency); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getArchivedDealsTimeline' - * - * @param \DateTime $start_date The date when the first interval starts. Format: YYYY-MM-DD. (required) - * @param string $interval The type of the interval<table><tr><th>Value</th><th>Description</th></tr><tr><td>`day`</td><td>Day</td></tr><tr><td>`week`</td><td>A full week (7 days) starting from `start_date`</td></tr><tr><td>`month`</td><td>A full month (depending on the number of days in given month) starting from `start_date`</td></tr><tr><td>`quarter`</td><td>A full quarter (3 months) starting from `start_date`</td></tr></table> (required) - * @param int $amount The number of given intervals, starting from `start_date`, to fetch. E.g. 3 (months). (required) - * @param string $field_key The date field key which deals will be retrieved from (required) - * @param int|null $user_id If supplied, only deals matching the given user will be returned (optional) - * @param int|null $pipeline_id If supplied, only deals matching the given pipeline will be returned (optional) - * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $exclude_deals Whether to exclude deals list (1) or not (0). Note that when deals are excluded, the timeline summary (counts and values) is still returned. (optional) - * @param string|null $totals_convert_currency The 3-letter currency code of any of the supported currencies. When supplied, `totals_converted` is returned per each interval which contains the currency-converted total amounts in the given currency. You may also set this parameter to `default_currency` in which case the user's default currency is used. (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - * @deprecated - */ - public function getArchivedDealsTimelineRequest($start_date, $interval, $amount, $field_key, $user_id = null, $pipeline_id = null, $filter_id = null, $exclude_deals = null, $totals_convert_currency = null): Request - { - // verify the required parameter 'start_date' is set - /* @phpstan-ignore-next-line */ - if ($start_date === null || (is_array($start_date) && count($start_date) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $start_date when calling getArchivedDealsTimeline' - ); - } - // verify the required parameter 'interval' is set - /* @phpstan-ignore-next-line */ - if ($interval === null || (is_array($interval) && count($interval) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $interval when calling getArchivedDealsTimeline' - ); - } - // verify the required parameter 'amount' is set - /* @phpstan-ignore-next-line */ - if ($amount === null || (is_array($amount) && count($amount) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $amount when calling getArchivedDealsTimeline' - ); - } - // verify the required parameter 'field_key' is set - /* @phpstan-ignore-next-line */ - if ($field_key === null || (is_array($field_key) && count($field_key) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $field_key when calling getArchivedDealsTimeline' - ); - } - - $resourcePath = '/deals/timeline/archived'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - /* @phpstan-ignore-next-line */ - if (is_array($start_date)) { - $start_date = ObjectSerializer::serializeCollection($start_date, '', true); - } - if ($start_date !== null) { - $queryParams['start_date'] = $start_date; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($interval)) { - $interval = ObjectSerializer::serializeCollection($interval, '', true); - } - if ($interval !== null) { - $queryParams['interval'] = $interval; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($amount)) { - $amount = ObjectSerializer::serializeCollection($amount, '', true); - } - if ($amount !== null) { - $queryParams['amount'] = $amount; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($field_key)) { - $field_key = ObjectSerializer::serializeCollection($field_key, '', true); - } - if ($field_key !== null) { - $queryParams['field_key'] = $field_key; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($user_id)) { - $user_id = ObjectSerializer::serializeCollection($user_id, '', true); - } - if ($user_id !== null) { - $queryParams['user_id'] = $user_id; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($pipeline_id)) { - $pipeline_id = ObjectSerializer::serializeCollection($pipeline_id, '', true); - } - if ($pipeline_id !== null) { - $queryParams['pipeline_id'] = $pipeline_id; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($filter_id)) { - $filter_id = ObjectSerializer::serializeCollection($filter_id, '', true); - } - if ($filter_id !== null) { - $queryParams['filter_id'] = $filter_id; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($exclude_deals)) { - $exclude_deals = ObjectSerializer::serializeCollection($exclude_deals, '', true); - } - if ($exclude_deals !== null) { - $queryParams['exclude_deals'] = $exclude_deals; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($totals_convert_currency)) { - $totals_convert_currency = ObjectSerializer::serializeCollection($totals_convert_currency, '', true); - } - if ($totals_convert_currency !== null) { - $queryParams['totals_convert_currency'] = $totals_convert_currency; - } - - - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getDeal - * - * Get details of a deal - * - * @param int $id The ID of the deal (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\GetDeal - * @deprecated - */ - public function getDeal($id) - { - list($response) = $this->getDealWithHttpInfo($id); - return $response; - } - - /** - * Operation getDealWithHttpInfo - * - * Get details of a deal - * - * @param int $id The ID of the deal (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\GetDeal, HTTP status code, HTTP response headers (array of strings) - * @deprecated - */ - public function getDealWithHttpInfo($id) - { - $request = $this->getDealRequest($id); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->getDealRequest($id); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetDeal' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDeal', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetDeal' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDeal', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\GetDeal', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getDealAsync - * - * Get details of a deal - * - * @param int $id The ID of the deal (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function getDealAsync($id): PromiseInterface - { - return $this->getDealAsyncWithHttpInfo($id) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getDealAsyncWithHttpInfo - * - * Get details of a deal - * - * @param int $id The ID of the deal (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function getDealAsyncWithHttpInfo($id): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\GetDeal'; - $request = $this->getDealRequest($id); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getDeal' - * - * @param int $id The ID of the deal (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - * @deprecated - */ - public function getDealRequest($id): Request - { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getDeal' - ); - } - - $resourcePath = '/deals/{id}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getDealActivities - * - * List activities associated with a deal - * - * @param int $id The ID of the deal (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $done Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted, returns both Done and Not done activities. (optional) - * @param string|null $exclude A comma-separated string of activity IDs to exclude from result (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\DealListActivitiesResponse - * @deprecated - */ - public function getDealActivities($id, $start = 0, $limit = null, $done = null, $exclude = null) - { - list($response) = $this->getDealActivitiesWithHttpInfo($id, $start, $limit, $done, $exclude); - return $response; - } - - /** - * Operation getDealActivitiesWithHttpInfo - * - * List activities associated with a deal - * - * @param int $id The ID of the deal (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $done Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted, returns both Done and Not done activities. (optional) - * @param string|null $exclude A comma-separated string of activity IDs to exclude from result (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\DealListActivitiesResponse, HTTP status code, HTTP response headers (array of strings) - * @deprecated - */ - public function getDealActivitiesWithHttpInfo($id, $start = 0, $limit = null, $done = null, $exclude = null) - { - $request = $this->getDealActivitiesRequest($id, $start, $limit, $done, $exclude); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->getDealActivitiesRequest($id, $start, $limit, $done, $exclude); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\DealListActivitiesResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DealListActivitiesResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\DealListActivitiesResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DealListActivitiesResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\DealListActivitiesResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getDealActivitiesAsync - * - * List activities associated with a deal - * - * @param int $id The ID of the deal (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $done Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted, returns both Done and Not done activities. (optional) - * @param string|null $exclude A comma-separated string of activity IDs to exclude from result (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function getDealActivitiesAsync($id, $start = 0, $limit = null, $done = null, $exclude = null): PromiseInterface - { - return $this->getDealActivitiesAsyncWithHttpInfo($id, $start, $limit, $done, $exclude) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getDealActivitiesAsyncWithHttpInfo - * - * List activities associated with a deal - * - * @param int $id The ID of the deal (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $done Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted, returns both Done and Not done activities. (optional) - * @param string|null $exclude A comma-separated string of activity IDs to exclude from result (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function getDealActivitiesAsyncWithHttpInfo($id, $start = 0, $limit = null, $done = null, $exclude = null): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\DealListActivitiesResponse'; - $request = $this->getDealActivitiesRequest($id, $start, $limit, $done, $exclude); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getDealActivities' - * - * @param int $id The ID of the deal (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $done Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted, returns both Done and Not done activities. (optional) - * @param string|null $exclude A comma-separated string of activity IDs to exclude from result (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - * @deprecated - */ - public function getDealActivitiesRequest($id, $start = 0, $limit = null, $done = null, $exclude = null): Request - { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getDealActivities' - ); - } - - $resourcePath = '/deals/{id}/activities'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - /* @phpstan-ignore-next-line */ - if (is_array($start)) { - $start = ObjectSerializer::serializeCollection($start, '', true); - } - if ($start !== null) { - $queryParams['start'] = $start; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($limit)) { - $limit = ObjectSerializer::serializeCollection($limit, '', true); - } - if ($limit !== null) { - $queryParams['limit'] = $limit; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($done)) { - $done = ObjectSerializer::serializeCollection($done, '', true); - } - if ($done !== null) { - $queryParams['done'] = $done; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($exclude)) { - $exclude = ObjectSerializer::serializeCollection($exclude, '', true); - } - if ($exclude !== null) { - $queryParams['exclude'] = $exclude; - } - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getDealChangelog - * - * List updates about deal field values - * - * @param int $id The ID of the deal (required) - * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) - * @param int|null $limit Items shown per page (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\ChangelogResponse - */ - public function getDealChangelog($id, $cursor = null, $limit = null) - { - list($response) = $this->getDealChangelogWithHttpInfo($id, $cursor, $limit); - return $response; - } - - /** - * Operation getDealChangelogWithHttpInfo - * - * List updates about deal field values - * - * @param int $id The ID of the deal (required) - * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) - * @param int|null $limit Items shown per page (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\ChangelogResponse, HTTP status code, HTTP response headers (array of strings) - */ - public function getDealChangelogWithHttpInfo($id, $cursor = null, $limit = null) - { - $request = $this->getDealChangelogRequest($id, $cursor, $limit); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->getDealChangelogRequest($id, $cursor, $limit); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ChangelogResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ChangelogResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ChangelogResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ChangelogResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\ChangelogResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getDealChangelogAsync - * - * List updates about deal field values - * - * @param int $id The ID of the deal (required) - * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) - * @param int|null $limit Items shown per page (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getDealChangelogAsync($id, $cursor = null, $limit = null): PromiseInterface - { - return $this->getDealChangelogAsyncWithHttpInfo($id, $cursor, $limit) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getDealChangelogAsyncWithHttpInfo - * - * List updates about deal field values - * - * @param int $id The ID of the deal (required) - * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) - * @param int|null $limit Items shown per page (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getDealChangelogAsyncWithHttpInfo($id, $cursor = null, $limit = null): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\ChangelogResponse'; - $request = $this->getDealChangelogRequest($id, $cursor, $limit); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getDealChangelog' - * - * @param int $id The ID of the deal (required) - * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) - * @param int|null $limit Items shown per page (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - */ - public function getDealChangelogRequest($id, $cursor = null, $limit = null): Request - { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getDealChangelog' - ); - } - - $resourcePath = '/deals/{id}/changelog'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - /* @phpstan-ignore-next-line */ - if (is_array($cursor)) { - $cursor = ObjectSerializer::serializeCollection($cursor, '', true); - } - if ($cursor !== null) { - $queryParams['cursor'] = $cursor; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($limit)) { - $limit = ObjectSerializer::serializeCollection($limit, '', true); - } - if ($limit !== null) { - $queryParams['limit'] = $limit; - } - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getDealFiles - * - * List files attached to a deal - * - * @param int $id The ID of the deal (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) - * @param string|null $sort Supported fields: `id`, `update_time` (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\ListFilesResponse - */ - public function getDealFiles($id, $start = 0, $limit = null, $sort = null) - { - list($response) = $this->getDealFilesWithHttpInfo($id, $start, $limit, $sort); - return $response; - } - - /** - * Operation getDealFilesWithHttpInfo - * - * List files attached to a deal - * - * @param int $id The ID of the deal (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) - * @param string|null $sort Supported fields: `id`, `update_time` (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\ListFilesResponse, HTTP status code, HTTP response headers (array of strings) - */ - public function getDealFilesWithHttpInfo($id, $start = 0, $limit = null, $sort = null) - { - $request = $this->getDealFilesRequest($id, $start, $limit, $sort); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->getDealFilesRequest($id, $start, $limit, $sort); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListFilesResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListFilesResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListFilesResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListFilesResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\ListFilesResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getDealFilesAsync - * - * List files attached to a deal - * - * @param int $id The ID of the deal (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) - * @param string|null $sort Supported fields: `id`, `update_time` (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getDealFilesAsync($id, $start = 0, $limit = null, $sort = null): PromiseInterface - { - return $this->getDealFilesAsyncWithHttpInfo($id, $start, $limit, $sort) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getDealFilesAsyncWithHttpInfo - * - * List files attached to a deal - * - * @param int $id The ID of the deal (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) - * @param string|null $sort Supported fields: `id`, `update_time` (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getDealFilesAsyncWithHttpInfo($id, $start = 0, $limit = null, $sort = null): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\ListFilesResponse'; - $request = $this->getDealFilesRequest($id, $start, $limit, $sort); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getDealFiles' - * - * @param int $id The ID of the deal (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) - * @param string|null $sort Supported fields: `id`, `update_time` (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - */ - public function getDealFilesRequest($id, $start = 0, $limit = null, $sort = null): Request - { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getDealFiles' - ); - } - if ($limit !== null && $limit > 100) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling DealsApi.getDealFiles, must be smaller than or equal to 100.'); - } - - - $resourcePath = '/deals/{id}/files'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - /* @phpstan-ignore-next-line */ - if (is_array($start)) { - $start = ObjectSerializer::serializeCollection($start, '', true); - } - if ($start !== null) { - $queryParams['start'] = $start; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($limit)) { - $limit = ObjectSerializer::serializeCollection($limit, '', true); - } - if ($limit !== null) { - $queryParams['limit'] = $limit; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($sort)) { - $sort = ObjectSerializer::serializeCollection($sort, '', true); - } - if ($sort !== null) { - $queryParams['sort'] = $sort; - } - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getDealFollowers - * - * List followers of a deal - * - * @param int $id The ID of the deal (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\ListFollowersResponse - */ - public function getDealFollowers($id) - { - list($response) = $this->getDealFollowersWithHttpInfo($id); - return $response; - } - - /** - * Operation getDealFollowersWithHttpInfo - * - * List followers of a deal - * - * @param int $id The ID of the deal (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\ListFollowersResponse, HTTP status code, HTTP response headers (array of strings) - */ - public function getDealFollowersWithHttpInfo($id) - { - $request = $this->getDealFollowersRequest($id); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->getDealFollowersRequest($id); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListFollowersResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListFollowersResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListFollowersResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListFollowersResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\ListFollowersResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getDealFollowersAsync - * - * List followers of a deal - * - * @param int $id The ID of the deal (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getDealFollowersAsync($id): PromiseInterface - { - return $this->getDealFollowersAsyncWithHttpInfo($id) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getDealFollowersAsyncWithHttpInfo - * - * List followers of a deal - * - * @param int $id The ID of the deal (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getDealFollowersAsyncWithHttpInfo($id): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\ListFollowersResponse'; - $request = $this->getDealFollowersRequest($id); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getDealFollowers' - * - * @param int $id The ID of the deal (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - */ - public function getDealFollowersRequest($id): Request - { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getDealFollowers' - ); - } - - $resourcePath = '/deals/{id}/followers'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getDealMailMessages - * - * List mail messages associated with a deal - * - * @param int $id The ID of the deal (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\ListMailMessagesResponse - */ - public function getDealMailMessages($id, $start = 0, $limit = null) - { - list($response) = $this->getDealMailMessagesWithHttpInfo($id, $start, $limit); - return $response; - } - - /** - * Operation getDealMailMessagesWithHttpInfo - * - * List mail messages associated with a deal - * - * @param int $id The ID of the deal (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\ListMailMessagesResponse, HTTP status code, HTTP response headers (array of strings) - */ - public function getDealMailMessagesWithHttpInfo($id, $start = 0, $limit = null) - { - $request = $this->getDealMailMessagesRequest($id, $start, $limit); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->getDealMailMessagesRequest($id, $start, $limit); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListMailMessagesResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListMailMessagesResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListMailMessagesResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListMailMessagesResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\ListMailMessagesResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getDealMailMessagesAsync - * - * List mail messages associated with a deal - * - * @param int $id The ID of the deal (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getDealMailMessagesAsync($id, $start = 0, $limit = null): PromiseInterface - { - return $this->getDealMailMessagesAsyncWithHttpInfo($id, $start, $limit) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getDealMailMessagesAsyncWithHttpInfo - * - * List mail messages associated with a deal - * - * @param int $id The ID of the deal (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getDealMailMessagesAsyncWithHttpInfo($id, $start = 0, $limit = null): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\ListMailMessagesResponse'; - $request = $this->getDealMailMessagesRequest($id, $start, $limit); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getDealMailMessages' - * - * @param int $id The ID of the deal (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - */ - public function getDealMailMessagesRequest($id, $start = 0, $limit = null): Request - { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getDealMailMessages' - ); - } - - $resourcePath = '/deals/{id}/mailMessages'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - /* @phpstan-ignore-next-line */ - if (is_array($start)) { - $start = ObjectSerializer::serializeCollection($start, '', true); - } - if ($start !== null) { - $queryParams['start'] = $start; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($limit)) { - $limit = ObjectSerializer::serializeCollection($limit, '', true); - } - if ($limit !== null) { - $queryParams['limit'] = $limit; - } - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getDealParticipants - * - * List participants of a deal - * - * @param int $id The ID of the deal (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\DealParticipants - */ - public function getDealParticipants($id, $start = 0, $limit = null) - { - list($response) = $this->getDealParticipantsWithHttpInfo($id, $start, $limit); - return $response; - } - - /** - * Operation getDealParticipantsWithHttpInfo - * - * List participants of a deal - * - * @param int $id The ID of the deal (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\DealParticipants, HTTP status code, HTTP response headers (array of strings) - */ - public function getDealParticipantsWithHttpInfo($id, $start = 0, $limit = null) - { - $request = $this->getDealParticipantsRequest($id, $start, $limit); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->getDealParticipantsRequest($id, $start, $limit); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\DealParticipants' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DealParticipants', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\DealParticipants' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DealParticipants', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\DealParticipants', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getDealParticipantsAsync - * - * List participants of a deal - * - * @param int $id The ID of the deal (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getDealParticipantsAsync($id, $start = 0, $limit = null): PromiseInterface - { - return $this->getDealParticipantsAsyncWithHttpInfo($id, $start, $limit) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getDealParticipantsAsyncWithHttpInfo - * - * List participants of a deal - * - * @param int $id The ID of the deal (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getDealParticipantsAsyncWithHttpInfo($id, $start = 0, $limit = null): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\DealParticipants'; - $request = $this->getDealParticipantsRequest($id, $start, $limit); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getDealParticipants' - * - * @param int $id The ID of the deal (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - */ - public function getDealParticipantsRequest($id, $start = 0, $limit = null): Request - { - // verify the required parameter 'id' is set + if ($filter_id !== null) { + $queryParams['filter_id'] = $filter_id; + } + // query params /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getDealParticipants' - ); + if (is_array($person_id)) { + $person_id = ObjectSerializer::serializeCollection($person_id, '', true); + } + if ($person_id !== null) { + $queryParams['person_id'] = $person_id; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($org_id)) { + $org_id = ObjectSerializer::serializeCollection($org_id, '', true); + } + if ($org_id !== null) { + $queryParams['org_id'] = $org_id; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($product_id)) { + $product_id = ObjectSerializer::serializeCollection($product_id, '', true); + } + if ($product_id !== null) { + $queryParams['product_id'] = $product_id; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($pipeline_id)) { + $pipeline_id = ObjectSerializer::serializeCollection($pipeline_id, '', true); + } + if ($pipeline_id !== null) { + $queryParams['pipeline_id'] = $pipeline_id; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($stage_id)) { + $stage_id = ObjectSerializer::serializeCollection($stage_id, '', true); + } + if ($stage_id !== null) { + $queryParams['stage_id'] = $stage_id; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($status)) { + $status = ObjectSerializer::serializeCollection($status, '', true); + } + if ($status !== null) { + $queryParams['status'] = $status; } - - $resourcePath = '/deals/{id}/participants'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - // query params /* @phpstan-ignore-next-line */ if (is_array($start)) { @@ -6270,16 +2009,24 @@ public function getDealParticipantsRequest($id, $start = 0, $limit = null): Requ if ($limit !== null) { $queryParams['limit'] = $limit; } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($sort)) { + $sort = ObjectSerializer::serializeCollection($sort, '', true); + } + if ($sort !== null) { + $queryParams['sort'] = $sort; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($owned_by_you)) { + $owned_by_you = ObjectSerializer::serializeCollection($owned_by_you, '', true); + } + if ($owned_by_you !== null) { + $queryParams['owned_by_you'] = $owned_by_you; + } - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } /* @phpstan-ignore-next-line */ @@ -6355,40 +2102,46 @@ public function getDealParticipantsRequest($id, $start = 0, $limit = null): Requ } /** - * Operation getDealParticipantsChangelog + * Operation getArchivedDealsSummary * - * List updates about participants of a deal + * Get archived deals summary * - * @param int $id The ID of the deal (required) - * @param int|null $limit Items shown per page (optional) - * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) + * @param string|null $status Only fetch deals with a specific status. open = Open, won = Won, lost = Lost. (optional) + * @param int|null $filter_id <code>user_id</code> will not be considered. Only deals matching the given filter will be returned. (optional) + * @param int|null $user_id Only deals matching the given user will be returned. `user_id` will not be considered if you use `filter_id`. (optional) + * @param int|null $pipeline_id Only deals within the given pipeline will be returned (optional) + * @param int|null $stage_id Only deals within the given stage will be returned (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\ParticipantsChangelog + * @return \Pipedrive\versions\v1\Model\GetDealsSummary + * @deprecated */ - public function getDealParticipantsChangelog($id, $limit = null, $cursor = null) + public function getArchivedDealsSummary($status = null, $filter_id = null, $user_id = null, $pipeline_id = null, $stage_id = null) { - list($response) = $this->getDealParticipantsChangelogWithHttpInfo($id, $limit, $cursor); + list($response) = $this->getArchivedDealsSummaryWithHttpInfo($status, $filter_id, $user_id, $pipeline_id, $stage_id); return $response; } /** - * Operation getDealParticipantsChangelogWithHttpInfo + * Operation getArchivedDealsSummaryWithHttpInfo * - * List updates about participants of a deal + * Get archived deals summary * - * @param int $id The ID of the deal (required) - * @param int|null $limit Items shown per page (optional) - * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) + * @param string|null $status Only fetch deals with a specific status. open = Open, won = Won, lost = Lost. (optional) + * @param int|null $filter_id <code>user_id</code> will not be considered. Only deals matching the given filter will be returned. (optional) + * @param int|null $user_id Only deals matching the given user will be returned. `user_id` will not be considered if you use `filter_id`. (optional) + * @param int|null $pipeline_id Only deals within the given pipeline will be returned (optional) + * @param int|null $stage_id Only deals within the given stage will be returned (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\ParticipantsChangelog, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v1\Model\GetDealsSummary, HTTP status code, HTTP response headers (array of strings) + * @deprecated */ - public function getDealParticipantsChangelogWithHttpInfo($id, $limit = null, $cursor = null) + public function getArchivedDealsSummaryWithHttpInfo($status = null, $filter_id = null, $user_id = null, $pipeline_id = null, $stage_id = null) { - $request = $this->getDealParticipantsChangelogRequest($id, $limit, $cursor); + $request = $this->getArchivedDealsSummaryRequest($status, $filter_id, $user_id, $pipeline_id, $stage_id); try { $options = $this->createHttpClientOption(); @@ -6397,7 +2150,7 @@ public function getDealParticipantsChangelogWithHttpInfo($id, $limit = null, $cu } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getDealParticipantsChangelogRequest($id, $limit, $cursor); + $request = $this->getArchivedDealsSummaryRequest($status, $filter_id, $user_id, $pipeline_id, $stage_id); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -6422,14 +2175,14 @@ public function getDealParticipantsChangelogWithHttpInfo($id, $limit = null, $cu switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ParticipantsChangelog' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\GetDealsSummary' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ParticipantsChangelog', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDealsSummary', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -6449,14 +2202,14 @@ public function getDealParticipantsChangelogWithHttpInfo($id, $limit = null, $cu } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ParticipantsChangelog' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\GetDealsSummary' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ParticipantsChangelog', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDealsSummary', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -6466,7 +2219,7 @@ public function getDealParticipantsChangelogWithHttpInfo($id, $limit = null, $cu case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\ParticipantsChangelog', + '\Pipedrive\versions\v1\Model\GetDealsSummary', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6477,20 +2230,23 @@ public function getDealParticipantsChangelogWithHttpInfo($id, $limit = null, $cu } /** - * Operation getDealParticipantsChangelogAsync + * Operation getArchivedDealsSummaryAsync * - * List updates about participants of a deal + * Get archived deals summary * - * @param int $id The ID of the deal (required) - * @param int|null $limit Items shown per page (optional) - * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) + * @param string|null $status Only fetch deals with a specific status. open = Open, won = Won, lost = Lost. (optional) + * @param int|null $filter_id <code>user_id</code> will not be considered. Only deals matching the given filter will be returned. (optional) + * @param int|null $user_id Only deals matching the given user will be returned. `user_id` will not be considered if you use `filter_id`. (optional) + * @param int|null $pipeline_id Only deals within the given pipeline will be returned (optional) + * @param int|null $stage_id Only deals within the given stage will be returned (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface + * @deprecated */ - public function getDealParticipantsChangelogAsync($id, $limit = null, $cursor = null): PromiseInterface + public function getArchivedDealsSummaryAsync($status = null, $filter_id = null, $user_id = null, $pipeline_id = null, $stage_id = null): PromiseInterface { - return $this->getDealParticipantsChangelogAsyncWithHttpInfo($id, $limit, $cursor) + return $this->getArchivedDealsSummaryAsyncWithHttpInfo($status, $filter_id, $user_id, $pipeline_id, $stage_id) ->then( function ($response) { return $response[0]; @@ -6499,21 +2255,24 @@ function ($response) { } /** - * Operation getDealParticipantsChangelogAsyncWithHttpInfo + * Operation getArchivedDealsSummaryAsyncWithHttpInfo * - * List updates about participants of a deal + * Get archived deals summary * - * @param int $id The ID of the deal (required) - * @param int|null $limit Items shown per page (optional) - * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) + * @param string|null $status Only fetch deals with a specific status. open = Open, won = Won, lost = Lost. (optional) + * @param int|null $filter_id <code>user_id</code> will not be considered. Only deals matching the given filter will be returned. (optional) + * @param int|null $user_id Only deals matching the given user will be returned. `user_id` will not be considered if you use `filter_id`. (optional) + * @param int|null $pipeline_id Only deals within the given pipeline will be returned (optional) + * @param int|null $stage_id Only deals within the given stage will be returned (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface + * @deprecated */ - public function getDealParticipantsChangelogAsyncWithHttpInfo($id, $limit = null, $cursor = null): PromiseInterface + public function getArchivedDealsSummaryAsyncWithHttpInfo($status = null, $filter_id = null, $user_id = null, $pipeline_id = null, $stage_id = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\ParticipantsChangelog'; - $request = $this->getDealParticipantsChangelogRequest($id, $limit, $cursor); + $returnType = '\Pipedrive\versions\v1\Model\GetDealsSummary'; + $request = $this->getArchivedDealsSummaryRequest($status, $filter_id, $user_id, $pipeline_id, $stage_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -6550,26 +2309,22 @@ function ($exception) { } /** - * Create request for operation 'getDealParticipantsChangelog' + * Create request for operation 'getArchivedDealsSummary' * - * @param int $id The ID of the deal (required) - * @param int|null $limit Items shown per page (optional) - * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) + * @param string|null $status Only fetch deals with a specific status. open = Open, won = Won, lost = Lost. (optional) + * @param int|null $filter_id <code>user_id</code> will not be considered. Only deals matching the given filter will be returned. (optional) + * @param int|null $user_id Only deals matching the given user will be returned. `user_id` will not be considered if you use `filter_id`. (optional) + * @param int|null $pipeline_id Only deals within the given pipeline will be returned (optional) + * @param int|null $stage_id Only deals within the given stage will be returned (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request + * @deprecated */ - public function getDealParticipantsChangelogRequest($id, $limit = null, $cursor = null): Request + public function getArchivedDealsSummaryRequest($status = null, $filter_id = null, $user_id = null, $pipeline_id = null, $stage_id = null): Request { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getDealParticipantsChangelog' - ); - } - $resourcePath = '/deals/{id}/participantsChangelog'; + $resourcePath = '/deals/summary/archived'; $formParams = []; $queryParams = []; $headerParams = []; @@ -6578,30 +2333,46 @@ public function getDealParticipantsChangelogRequest($id, $limit = null, $cursor // query params /* @phpstan-ignore-next-line */ - if (is_array($limit)) { - $limit = ObjectSerializer::serializeCollection($limit, '', true); + if (is_array($status)) { + $status = ObjectSerializer::serializeCollection($status, '', true); } - if ($limit !== null) { - $queryParams['limit'] = $limit; + if ($status !== null) { + $queryParams['status'] = $status; } // query params /* @phpstan-ignore-next-line */ - if (is_array($cursor)) { - $cursor = ObjectSerializer::serializeCollection($cursor, '', true); + if (is_array($filter_id)) { + $filter_id = ObjectSerializer::serializeCollection($filter_id, '', true); } - if ($cursor !== null) { - $queryParams['cursor'] = $cursor; + if ($filter_id !== null) { + $queryParams['filter_id'] = $filter_id; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($user_id)) { + $user_id = ObjectSerializer::serializeCollection($user_id, '', true); + } + if ($user_id !== null) { + $queryParams['user_id'] = $user_id; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($pipeline_id)) { + $pipeline_id = ObjectSerializer::serializeCollection($pipeline_id, '', true); + } + if ($pipeline_id !== null) { + $queryParams['pipeline_id'] = $pipeline_id; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($stage_id)) { + $stage_id = ObjectSerializer::serializeCollection($stage_id, '', true); + } + if ($stage_id !== null) { + $queryParams['stage_id'] = $stage_id; } - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } /* @phpstan-ignore-next-line */ @@ -6677,42 +2448,54 @@ public function getDealParticipantsChangelogRequest($id, $limit = null, $cursor } /** - * Operation getDealPersons + * Operation getArchivedDealsTimeline * - * List all persons associated with a deal + * Get archived deals timeline * - * @param int $id The ID of the deal (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) + * @param \DateTime $start_date The date when the first interval starts. Format: YYYY-MM-DD. (required) + * @param string $interval The type of the interval<table><tr><th>Value</th><th>Description</th></tr><tr><td>`day`</td><td>Day</td></tr><tr><td>`week`</td><td>A full week (7 days) starting from `start_date`</td></tr><tr><td>`month`</td><td>A full month (depending on the number of days in given month) starting from `start_date`</td></tr><tr><td>`quarter`</td><td>A full quarter (3 months) starting from `start_date`</td></tr></table> (required) + * @param int $amount The number of given intervals, starting from `start_date`, to fetch. E.g. 3 (months). (required) + * @param string $field_key The date field key which deals will be retrieved from (required) + * @param int|null $user_id If supplied, only deals matching the given user will be returned (optional) + * @param int|null $pipeline_id If supplied, only deals matching the given pipeline will be returned (optional) + * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $exclude_deals Whether to exclude deals list (1) or not (0). Note that when deals are excluded, the timeline summary (counts and values) is still returned. (optional) + * @param string|null $totals_convert_currency The 3-letter currency code of any of the supported currencies. When supplied, `totals_converted` is returned per each interval which contains the currency-converted total amounts in the given currency. You may also set this parameter to `default_currency` in which case the user's default currency is used. (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\ListPersonsResponse + * @return \Pipedrive\versions\v1\Model\GetDealsTimeline * @deprecated */ - public function getDealPersons($id, $start = 0, $limit = null) + public function getArchivedDealsTimeline($start_date, $interval, $amount, $field_key, $user_id = null, $pipeline_id = null, $filter_id = null, $exclude_deals = null, $totals_convert_currency = null) { - list($response) = $this->getDealPersonsWithHttpInfo($id, $start, $limit); + list($response) = $this->getArchivedDealsTimelineWithHttpInfo($start_date, $interval, $amount, $field_key, $user_id, $pipeline_id, $filter_id, $exclude_deals, $totals_convert_currency); return $response; } /** - * Operation getDealPersonsWithHttpInfo + * Operation getArchivedDealsTimelineWithHttpInfo * - * List all persons associated with a deal + * Get archived deals timeline * - * @param int $id The ID of the deal (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) + * @param \DateTime $start_date The date when the first interval starts. Format: YYYY-MM-DD. (required) + * @param string $interval The type of the interval<table><tr><th>Value</th><th>Description</th></tr><tr><td>`day`</td><td>Day</td></tr><tr><td>`week`</td><td>A full week (7 days) starting from `start_date`</td></tr><tr><td>`month`</td><td>A full month (depending on the number of days in given month) starting from `start_date`</td></tr><tr><td>`quarter`</td><td>A full quarter (3 months) starting from `start_date`</td></tr></table> (required) + * @param int $amount The number of given intervals, starting from `start_date`, to fetch. E.g. 3 (months). (required) + * @param string $field_key The date field key which deals will be retrieved from (required) + * @param int|null $user_id If supplied, only deals matching the given user will be returned (optional) + * @param int|null $pipeline_id If supplied, only deals matching the given pipeline will be returned (optional) + * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $exclude_deals Whether to exclude deals list (1) or not (0). Note that when deals are excluded, the timeline summary (counts and values) is still returned. (optional) + * @param string|null $totals_convert_currency The 3-letter currency code of any of the supported currencies. When supplied, `totals_converted` is returned per each interval which contains the currency-converted total amounts in the given currency. You may also set this parameter to `default_currency` in which case the user's default currency is used. (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\ListPersonsResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v1\Model\GetDealsTimeline, HTTP status code, HTTP response headers (array of strings) * @deprecated */ - public function getDealPersonsWithHttpInfo($id, $start = 0, $limit = null) + public function getArchivedDealsTimelineWithHttpInfo($start_date, $interval, $amount, $field_key, $user_id = null, $pipeline_id = null, $filter_id = null, $exclude_deals = null, $totals_convert_currency = null) { - $request = $this->getDealPersonsRequest($id, $start, $limit); + $request = $this->getArchivedDealsTimelineRequest($start_date, $interval, $amount, $field_key, $user_id, $pipeline_id, $filter_id, $exclude_deals, $totals_convert_currency); try { $options = $this->createHttpClientOption(); @@ -6721,7 +2504,7 @@ public function getDealPersonsWithHttpInfo($id, $start = 0, $limit = null) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getDealPersonsRequest($id, $start, $limit); + $request = $this->getArchivedDealsTimelineRequest($start_date, $interval, $amount, $field_key, $user_id, $pipeline_id, $filter_id, $exclude_deals, $totals_convert_currency); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -6746,14 +2529,14 @@ public function getDealPersonsWithHttpInfo($id, $start = 0, $limit = null) switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListPersonsResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\GetDealsTimeline' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListPersonsResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDealsTimeline', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -6773,14 +2556,14 @@ public function getDealPersonsWithHttpInfo($id, $start = 0, $limit = null) } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListPersonsResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\GetDealsTimeline' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListPersonsResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDealsTimeline', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -6790,7 +2573,7 @@ public function getDealPersonsWithHttpInfo($id, $start = 0, $limit = null) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\ListPersonsResponse', + '\Pipedrive\versions\v1\Model\GetDealsTimeline', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6801,21 +2584,27 @@ public function getDealPersonsWithHttpInfo($id, $start = 0, $limit = null) } /** - * Operation getDealPersonsAsync + * Operation getArchivedDealsTimelineAsync * - * List all persons associated with a deal + * Get archived deals timeline * - * @param int $id The ID of the deal (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) + * @param \DateTime $start_date The date when the first interval starts. Format: YYYY-MM-DD. (required) + * @param string $interval The type of the interval<table><tr><th>Value</th><th>Description</th></tr><tr><td>`day`</td><td>Day</td></tr><tr><td>`week`</td><td>A full week (7 days) starting from `start_date`</td></tr><tr><td>`month`</td><td>A full month (depending on the number of days in given month) starting from `start_date`</td></tr><tr><td>`quarter`</td><td>A full quarter (3 months) starting from `start_date`</td></tr></table> (required) + * @param int $amount The number of given intervals, starting from `start_date`, to fetch. E.g. 3 (months). (required) + * @param string $field_key The date field key which deals will be retrieved from (required) + * @param int|null $user_id If supplied, only deals matching the given user will be returned (optional) + * @param int|null $pipeline_id If supplied, only deals matching the given pipeline will be returned (optional) + * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $exclude_deals Whether to exclude deals list (1) or not (0). Note that when deals are excluded, the timeline summary (counts and values) is still returned. (optional) + * @param string|null $totals_convert_currency The 3-letter currency code of any of the supported currencies. When supplied, `totals_converted` is returned per each interval which contains the currency-converted total amounts in the given currency. You may also set this parameter to `default_currency` in which case the user's default currency is used. (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface * @deprecated */ - public function getDealPersonsAsync($id, $start = 0, $limit = null): PromiseInterface + public function getArchivedDealsTimelineAsync($start_date, $interval, $amount, $field_key, $user_id = null, $pipeline_id = null, $filter_id = null, $exclude_deals = null, $totals_convert_currency = null): PromiseInterface { - return $this->getDealPersonsAsyncWithHttpInfo($id, $start, $limit) + return $this->getArchivedDealsTimelineAsyncWithHttpInfo($start_date, $interval, $amount, $field_key, $user_id, $pipeline_id, $filter_id, $exclude_deals, $totals_convert_currency) ->then( function ($response) { return $response[0]; @@ -6824,22 +2613,28 @@ function ($response) { } /** - * Operation getDealPersonsAsyncWithHttpInfo + * Operation getArchivedDealsTimelineAsyncWithHttpInfo * - * List all persons associated with a deal + * Get archived deals timeline * - * @param int $id The ID of the deal (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) + * @param \DateTime $start_date The date when the first interval starts. Format: YYYY-MM-DD. (required) + * @param string $interval The type of the interval<table><tr><th>Value</th><th>Description</th></tr><tr><td>`day`</td><td>Day</td></tr><tr><td>`week`</td><td>A full week (7 days) starting from `start_date`</td></tr><tr><td>`month`</td><td>A full month (depending on the number of days in given month) starting from `start_date`</td></tr><tr><td>`quarter`</td><td>A full quarter (3 months) starting from `start_date`</td></tr></table> (required) + * @param int $amount The number of given intervals, starting from `start_date`, to fetch. E.g. 3 (months). (required) + * @param string $field_key The date field key which deals will be retrieved from (required) + * @param int|null $user_id If supplied, only deals matching the given user will be returned (optional) + * @param int|null $pipeline_id If supplied, only deals matching the given pipeline will be returned (optional) + * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $exclude_deals Whether to exclude deals list (1) or not (0). Note that when deals are excluded, the timeline summary (counts and values) is still returned. (optional) + * @param string|null $totals_convert_currency The 3-letter currency code of any of the supported currencies. When supplied, `totals_converted` is returned per each interval which contains the currency-converted total amounts in the given currency. You may also set this parameter to `default_currency` in which case the user's default currency is used. (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface * @deprecated */ - public function getDealPersonsAsyncWithHttpInfo($id, $start = 0, $limit = null): PromiseInterface + public function getArchivedDealsTimelineAsyncWithHttpInfo($start_date, $interval, $amount, $field_key, $user_id = null, $pipeline_id = null, $filter_id = null, $exclude_deals = null, $totals_convert_currency = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\ListPersonsResponse'; - $request = $this->getDealPersonsRequest($id, $start, $limit); + $returnType = '\Pipedrive\versions\v1\Model\GetDealsTimeline'; + $request = $this->getArchivedDealsTimelineRequest($start_date, $interval, $amount, $field_key, $user_id, $pipeline_id, $filter_id, $exclude_deals, $totals_convert_currency); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -6876,27 +2671,54 @@ function ($exception) { } /** - * Create request for operation 'getDealPersons' + * Create request for operation 'getArchivedDealsTimeline' * - * @param int $id The ID of the deal (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) + * @param \DateTime $start_date The date when the first interval starts. Format: YYYY-MM-DD. (required) + * @param string $interval The type of the interval<table><tr><th>Value</th><th>Description</th></tr><tr><td>`day`</td><td>Day</td></tr><tr><td>`week`</td><td>A full week (7 days) starting from `start_date`</td></tr><tr><td>`month`</td><td>A full month (depending on the number of days in given month) starting from `start_date`</td></tr><tr><td>`quarter`</td><td>A full quarter (3 months) starting from `start_date`</td></tr></table> (required) + * @param int $amount The number of given intervals, starting from `start_date`, to fetch. E.g. 3 (months). (required) + * @param string $field_key The date field key which deals will be retrieved from (required) + * @param int|null $user_id If supplied, only deals matching the given user will be returned (optional) + * @param int|null $pipeline_id If supplied, only deals matching the given pipeline will be returned (optional) + * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $exclude_deals Whether to exclude deals list (1) or not (0). Note that when deals are excluded, the timeline summary (counts and values) is still returned. (optional) + * @param string|null $totals_convert_currency The 3-letter currency code of any of the supported currencies. When supplied, `totals_converted` is returned per each interval which contains the currency-converted total amounts in the given currency. You may also set this parameter to `default_currency` in which case the user's default currency is used. (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request * @deprecated */ - public function getDealPersonsRequest($id, $start = 0, $limit = null): Request + public function getArchivedDealsTimelineRequest($start_date, $interval, $amount, $field_key, $user_id = null, $pipeline_id = null, $filter_id = null, $exclude_deals = null, $totals_convert_currency = null): Request { - // verify the required parameter 'id' is set + // verify the required parameter 'start_date' is set /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { + if ($start_date === null || (is_array($start_date) && count($start_date) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $start_date when calling getArchivedDealsTimeline' + ); + } + // verify the required parameter 'interval' is set + /* @phpstan-ignore-next-line */ + if ($interval === null || (is_array($interval) && count($interval) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $interval when calling getArchivedDealsTimeline' + ); + } + // verify the required parameter 'amount' is set + /* @phpstan-ignore-next-line */ + if ($amount === null || (is_array($amount) && count($amount) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $amount when calling getArchivedDealsTimeline' + ); + } + // verify the required parameter 'field_key' is set + /* @phpstan-ignore-next-line */ + if ($field_key === null || (is_array($field_key) && count($field_key) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getDealPersons' + 'Missing the required parameter $field_key when calling getArchivedDealsTimeline' ); } - $resourcePath = '/deals/{id}/persons'; + $resourcePath = '/deals/timeline/archived'; $formParams = []; $queryParams = []; $headerParams = []; @@ -6905,30 +2727,78 @@ public function getDealPersonsRequest($id, $start = 0, $limit = null): Request // query params /* @phpstan-ignore-next-line */ - if (is_array($start)) { - $start = ObjectSerializer::serializeCollection($start, '', true); + if (is_array($start_date)) { + $start_date = ObjectSerializer::serializeCollection($start_date, '', true); } - if ($start !== null) { - $queryParams['start'] = $start; + if ($start_date !== null) { + $queryParams['start_date'] = $start_date; } // query params /* @phpstan-ignore-next-line */ - if (is_array($limit)) { - $limit = ObjectSerializer::serializeCollection($limit, '', true); + if (is_array($interval)) { + $interval = ObjectSerializer::serializeCollection($interval, '', true); } - if ($limit !== null) { - $queryParams['limit'] = $limit; + if ($interval !== null) { + $queryParams['interval'] = $interval; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($amount)) { + $amount = ObjectSerializer::serializeCollection($amount, '', true); + } + if ($amount !== null) { + $queryParams['amount'] = $amount; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($field_key)) { + $field_key = ObjectSerializer::serializeCollection($field_key, '', true); + } + if ($field_key !== null) { + $queryParams['field_key'] = $field_key; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($user_id)) { + $user_id = ObjectSerializer::serializeCollection($user_id, '', true); + } + if ($user_id !== null) { + $queryParams['user_id'] = $user_id; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($pipeline_id)) { + $pipeline_id = ObjectSerializer::serializeCollection($pipeline_id, '', true); + } + if ($pipeline_id !== null) { + $queryParams['pipeline_id'] = $pipeline_id; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($filter_id)) { + $filter_id = ObjectSerializer::serializeCollection($filter_id, '', true); + } + if ($filter_id !== null) { + $queryParams['filter_id'] = $filter_id; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($exclude_deals)) { + $exclude_deals = ObjectSerializer::serializeCollection($exclude_deals, '', true); + } + if ($exclude_deals !== null) { + $queryParams['exclude_deals'] = $exclude_deals; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($totals_convert_currency)) { + $totals_convert_currency = ObjectSerializer::serializeCollection($totals_convert_currency, '', true); + } + if ($totals_convert_currency !== null) { + $queryParams['totals_convert_currency'] = $totals_convert_currency; } - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } /* @phpstan-ignore-next-line */ @@ -7004,44 +2874,40 @@ public function getDealPersonsRequest($id, $start = 0, $limit = null): Request } /** - * Operation getDealProducts + * Operation getDealChangelog * - * List products attached to a deal + * List updates about deal field values * * @param int $id The ID of the deal (required) - * @param int|0 $start Pagination start (optional, default to 0) + * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) * @param int|null $limit Items shown per page (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $include_product_data Whether to fetch product data along with each attached product (1) or not (0, default) (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\ListProductsResponse - * @deprecated + * @return \Pipedrive\versions\v1\Model\ChangelogResponse */ - public function getDealProducts($id, $start = 0, $limit = null, $include_product_data = null) + public function getDealChangelog($id, $cursor = null, $limit = null) { - list($response) = $this->getDealProductsWithHttpInfo($id, $start, $limit, $include_product_data); + list($response) = $this->getDealChangelogWithHttpInfo($id, $cursor, $limit); return $response; } /** - * Operation getDealProductsWithHttpInfo + * Operation getDealChangelogWithHttpInfo * - * List products attached to a deal + * List updates about deal field values * * @param int $id The ID of the deal (required) - * @param int|0 $start Pagination start (optional, default to 0) + * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) * @param int|null $limit Items shown per page (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $include_product_data Whether to fetch product data along with each attached product (1) or not (0, default) (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\ListProductsResponse, HTTP status code, HTTP response headers (array of strings) - * @deprecated + * @return array of \Pipedrive\versions\v1\Model\ChangelogResponse, HTTP status code, HTTP response headers (array of strings) */ - public function getDealProductsWithHttpInfo($id, $start = 0, $limit = null, $include_product_data = null) + public function getDealChangelogWithHttpInfo($id, $cursor = null, $limit = null) { - $request = $this->getDealProductsRequest($id, $start, $limit, $include_product_data); + $request = $this->getDealChangelogRequest($id, $cursor, $limit); try { $options = $this->createHttpClientOption(); @@ -7050,7 +2916,7 @@ public function getDealProductsWithHttpInfo($id, $start = 0, $limit = null, $inc } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getDealProductsRequest($id, $start, $limit, $include_product_data); + $request = $this->getDealChangelogRequest($id, $cursor, $limit); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -7075,14 +2941,14 @@ public function getDealProductsWithHttpInfo($id, $start = 0, $limit = null, $inc switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListProductsResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ChangelogResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListProductsResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ChangelogResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -7102,14 +2968,14 @@ public function getDealProductsWithHttpInfo($id, $start = 0, $limit = null, $inc } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListProductsResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ChangelogResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListProductsResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ChangelogResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -7119,7 +2985,7 @@ public function getDealProductsWithHttpInfo($id, $start = 0, $limit = null, $inc case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\ListProductsResponse', + '\Pipedrive\versions\v1\Model\ChangelogResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -7130,22 +2996,20 @@ public function getDealProductsWithHttpInfo($id, $start = 0, $limit = null, $inc } /** - * Operation getDealProductsAsync + * Operation getDealChangelogAsync * - * List products attached to a deal + * List updates about deal field values * * @param int $id The ID of the deal (required) - * @param int|0 $start Pagination start (optional, default to 0) + * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) * @param int|null $limit Items shown per page (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $include_product_data Whether to fetch product data along with each attached product (1) or not (0, default) (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function getDealProductsAsync($id, $start = 0, $limit = null, $include_product_data = null): PromiseInterface + public function getDealChangelogAsync($id, $cursor = null, $limit = null): PromiseInterface { - return $this->getDealProductsAsyncWithHttpInfo($id, $start, $limit, $include_product_data) + return $this->getDealChangelogAsyncWithHttpInfo($id, $cursor, $limit) ->then( function ($response) { return $response[0]; @@ -7154,23 +3018,21 @@ function ($response) { } /** - * Operation getDealProductsAsyncWithHttpInfo + * Operation getDealChangelogAsyncWithHttpInfo * - * List products attached to a deal + * List updates about deal field values * * @param int $id The ID of the deal (required) - * @param int|0 $start Pagination start (optional, default to 0) + * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) * @param int|null $limit Items shown per page (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $include_product_data Whether to fetch product data along with each attached product (1) or not (0, default) (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function getDealProductsAsyncWithHttpInfo($id, $start = 0, $limit = null, $include_product_data = null): PromiseInterface + public function getDealChangelogAsyncWithHttpInfo($id, $cursor = null, $limit = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\ListProductsResponse'; - $request = $this->getDealProductsRequest($id, $start, $limit, $include_product_data); + $returnType = '\Pipedrive\versions\v1\Model\ChangelogResponse'; + $request = $this->getDealChangelogRequest($id, $cursor, $limit); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -7207,28 +3069,26 @@ function ($exception) { } /** - * Create request for operation 'getDealProducts' + * Create request for operation 'getDealChangelog' * * @param int $id The ID of the deal (required) - * @param int|0 $start Pagination start (optional, default to 0) + * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) * @param int|null $limit Items shown per page (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $include_product_data Whether to fetch product data along with each attached product (1) or not (0, default) (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request - * @deprecated */ - public function getDealProductsRequest($id, $start = 0, $limit = null, $include_product_data = null): Request + public function getDealChangelogRequest($id, $cursor = null, $limit = null): Request { // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getDealProducts' + 'Missing the required parameter $id when calling getDealChangelog' ); } - $resourcePath = '/deals/{id}/products'; + $resourcePath = '/deals/{id}/changelog'; $formParams = []; $queryParams = []; $headerParams = []; @@ -7237,11 +3097,11 @@ public function getDealProductsRequest($id, $start = 0, $limit = null, $include_ // query params /* @phpstan-ignore-next-line */ - if (is_array($start)) { - $start = ObjectSerializer::serializeCollection($start, '', true); + if (is_array($cursor)) { + $cursor = ObjectSerializer::serializeCollection($cursor, '', true); } - if ($start !== null) { - $queryParams['start'] = $start; + if ($cursor !== null) { + $queryParams['cursor'] = $cursor; } // query params /* @phpstan-ignore-next-line */ @@ -7251,14 +3111,6 @@ public function getDealProductsRequest($id, $start = 0, $limit = null, $include_ if ($limit !== null) { $queryParams['limit'] = $limit; } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($include_product_data)) { - $include_product_data = ObjectSerializer::serializeCollection($include_product_data, '', true); - } - if ($include_product_data !== null) { - $queryParams['include_product_data'] = $include_product_data; - } // path params @@ -7344,44 +3196,42 @@ public function getDealProductsRequest($id, $start = 0, $limit = null, $include_ } /** - * Operation getDealUpdates + * Operation getDealFiles * - * List updates about a deal + * List files attached to a deal * * @param int $id The ID of the deal (required) * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|null $all_changes Whether to show custom field updates or not. 1 = Include custom field changes. If omitted returns changes without custom field updates. (optional) - * @param string|null $items A comma-separated string for filtering out item specific updates. (Possible values - call, activity, plannedActivity, change, note, deal, file, dealChange, personChange, organizationChange, follower, dealFollower, personFollower, organizationFollower, participant, comment, mailMessage, mailMessageWithAttachment, invoice, document, marketing_campaign_stat, marketing_status_change). (optional) + * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) + * @param string|null $sort Supported fields: `id`, `update_time` (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\DealFlowResponse + * @return \Pipedrive\versions\v1\Model\ListFilesResponse */ - public function getDealUpdates($id, $start = 0, $limit = null, $all_changes = null, $items = null) + public function getDealFiles($id, $start = 0, $limit = null, $sort = null) { - list($response) = $this->getDealUpdatesWithHttpInfo($id, $start, $limit, $all_changes, $items); + list($response) = $this->getDealFilesWithHttpInfo($id, $start, $limit, $sort); return $response; } /** - * Operation getDealUpdatesWithHttpInfo + * Operation getDealFilesWithHttpInfo * - * List updates about a deal + * List files attached to a deal * * @param int $id The ID of the deal (required) * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|null $all_changes Whether to show custom field updates or not. 1 = Include custom field changes. If omitted returns changes without custom field updates. (optional) - * @param string|null $items A comma-separated string for filtering out item specific updates. (Possible values - call, activity, plannedActivity, change, note, deal, file, dealChange, personChange, organizationChange, follower, dealFollower, personFollower, organizationFollower, participant, comment, mailMessage, mailMessageWithAttachment, invoice, document, marketing_campaign_stat, marketing_status_change). (optional) + * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) + * @param string|null $sort Supported fields: `id`, `update_time` (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\DealFlowResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v1\Model\ListFilesResponse, HTTP status code, HTTP response headers (array of strings) */ - public function getDealUpdatesWithHttpInfo($id, $start = 0, $limit = null, $all_changes = null, $items = null) + public function getDealFilesWithHttpInfo($id, $start = 0, $limit = null, $sort = null) { - $request = $this->getDealUpdatesRequest($id, $start, $limit, $all_changes, $items); + $request = $this->getDealFilesRequest($id, $start, $limit, $sort); try { $options = $this->createHttpClientOption(); @@ -7390,7 +3240,7 @@ public function getDealUpdatesWithHttpInfo($id, $start = 0, $limit = null, $all_ } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getDealUpdatesRequest($id, $start, $limit, $all_changes, $items); + $request = $this->getDealFilesRequest($id, $start, $limit, $sort); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -7415,14 +3265,14 @@ public function getDealUpdatesWithHttpInfo($id, $start = 0, $limit = null, $all_ switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\DealFlowResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ListFilesResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DealFlowResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListFilesResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -7442,14 +3292,14 @@ public function getDealUpdatesWithHttpInfo($id, $start = 0, $limit = null, $all_ } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\DealFlowResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ListFilesResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DealFlowResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListFilesResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -7459,7 +3309,7 @@ public function getDealUpdatesWithHttpInfo($id, $start = 0, $limit = null, $all_ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\DealFlowResponse', + '\Pipedrive\versions\v1\Model\ListFilesResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -7470,22 +3320,21 @@ public function getDealUpdatesWithHttpInfo($id, $start = 0, $limit = null, $all_ } /** - * Operation getDealUpdatesAsync + * Operation getDealFilesAsync * - * List updates about a deal + * List files attached to a deal * * @param int $id The ID of the deal (required) * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|null $all_changes Whether to show custom field updates or not. 1 = Include custom field changes. If omitted returns changes without custom field updates. (optional) - * @param string|null $items A comma-separated string for filtering out item specific updates. (Possible values - call, activity, plannedActivity, change, note, deal, file, dealChange, personChange, organizationChange, follower, dealFollower, personFollower, organizationFollower, participant, comment, mailMessage, mailMessageWithAttachment, invoice, document, marketing_campaign_stat, marketing_status_change). (optional) + * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) + * @param string|null $sort Supported fields: `id`, `update_time` (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getDealUpdatesAsync($id, $start = 0, $limit = null, $all_changes = null, $items = null): PromiseInterface + public function getDealFilesAsync($id, $start = 0, $limit = null, $sort = null): PromiseInterface { - return $this->getDealUpdatesAsyncWithHttpInfo($id, $start, $limit, $all_changes, $items) + return $this->getDealFilesAsyncWithHttpInfo($id, $start, $limit, $sort) ->then( function ($response) { return $response[0]; @@ -7494,23 +3343,22 @@ function ($response) { } /** - * Operation getDealUpdatesAsyncWithHttpInfo + * Operation getDealFilesAsyncWithHttpInfo * - * List updates about a deal + * List files attached to a deal * * @param int $id The ID of the deal (required) * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|null $all_changes Whether to show custom field updates or not. 1 = Include custom field changes. If omitted returns changes without custom field updates. (optional) - * @param string|null $items A comma-separated string for filtering out item specific updates. (Possible values - call, activity, plannedActivity, change, note, deal, file, dealChange, personChange, organizationChange, follower, dealFollower, personFollower, organizationFollower, participant, comment, mailMessage, mailMessageWithAttachment, invoice, document, marketing_campaign_stat, marketing_status_change). (optional) + * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) + * @param string|null $sort Supported fields: `id`, `update_time` (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getDealUpdatesAsyncWithHttpInfo($id, $start = 0, $limit = null, $all_changes = null, $items = null): PromiseInterface + public function getDealFilesAsyncWithHttpInfo($id, $start = 0, $limit = null, $sort = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\DealFlowResponse'; - $request = $this->getDealUpdatesRequest($id, $start, $limit, $all_changes, $items); + $returnType = '\Pipedrive\versions\v1\Model\ListFilesResponse'; + $request = $this->getDealFilesRequest($id, $start, $limit, $sort); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -7547,28 +3395,31 @@ function ($exception) { } /** - * Create request for operation 'getDealUpdates' + * Create request for operation 'getDealFiles' * * @param int $id The ID of the deal (required) * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|null $all_changes Whether to show custom field updates or not. 1 = Include custom field changes. If omitted returns changes without custom field updates. (optional) - * @param string|null $items A comma-separated string for filtering out item specific updates. (Possible values - call, activity, plannedActivity, change, note, deal, file, dealChange, personChange, organizationChange, follower, dealFollower, personFollower, organizationFollower, participant, comment, mailMessage, mailMessageWithAttachment, invoice, document, marketing_campaign_stat, marketing_status_change). (optional) + * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) + * @param string|null $sort Supported fields: `id`, `update_time` (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function getDealUpdatesRequest($id, $start = 0, $limit = null, $all_changes = null, $items = null): Request + public function getDealFilesRequest($id, $start = 0, $limit = null, $sort = null): Request { // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getDealUpdates' + 'Missing the required parameter $id when calling getDealFiles' ); } + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling DealsApi.getDealFiles, must be smaller than or equal to 100.'); + } - $resourcePath = '/deals/{id}/flow'; + + $resourcePath = '/deals/{id}/files'; $formParams = []; $queryParams = []; $headerParams = []; @@ -7593,19 +3444,11 @@ public function getDealUpdatesRequest($id, $start = 0, $limit = null, $all_chang } // query params /* @phpstan-ignore-next-line */ - if (is_array($all_changes)) { - $all_changes = ObjectSerializer::serializeCollection($all_changes, '', true); - } - if ($all_changes !== null) { - $queryParams['all_changes'] = $all_changes; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($items)) { - $items = ObjectSerializer::serializeCollection($items, '', true); + if (is_array($sort)) { + $sort = ObjectSerializer::serializeCollection($sort, '', true); } - if ($items !== null) { - $queryParams['items'] = $items; + if ($sort !== null) { + $queryParams['sort'] = $sort; } @@ -7692,36 +3535,36 @@ public function getDealUpdatesRequest($id, $start = 0, $limit = null, $all_chang } /** - * Operation getDealUsers + * Operation getDealFollowers * - * List permitted users + * List followers of a deal * * @param int $id The ID of the deal (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\ListPermittedUsersResponse + * @return \Pipedrive\versions\v1\Model\ListFollowersResponse */ - public function getDealUsers($id) + public function getDealFollowers($id) { - list($response) = $this->getDealUsersWithHttpInfo($id); + list($response) = $this->getDealFollowersWithHttpInfo($id); return $response; } /** - * Operation getDealUsersWithHttpInfo + * Operation getDealFollowersWithHttpInfo * - * List permitted users + * List followers of a deal * * @param int $id The ID of the deal (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\ListPermittedUsersResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v1\Model\ListFollowersResponse, HTTP status code, HTTP response headers (array of strings) */ - public function getDealUsersWithHttpInfo($id) + public function getDealFollowersWithHttpInfo($id) { - $request = $this->getDealUsersRequest($id); + $request = $this->getDealFollowersRequest($id); try { $options = $this->createHttpClientOption(); @@ -7730,7 +3573,7 @@ public function getDealUsersWithHttpInfo($id) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getDealUsersRequest($id); + $request = $this->getDealFollowersRequest($id); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -7755,14 +3598,14 @@ public function getDealUsersWithHttpInfo($id) switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListPermittedUsersResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ListFollowersResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListPermittedUsersResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListFollowersResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -7782,14 +3625,14 @@ public function getDealUsersWithHttpInfo($id) } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListPermittedUsersResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ListFollowersResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListPermittedUsersResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListFollowersResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -7799,7 +3642,7 @@ public function getDealUsersWithHttpInfo($id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\ListPermittedUsersResponse', + '\Pipedrive\versions\v1\Model\ListFollowersResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -7810,18 +3653,18 @@ public function getDealUsersWithHttpInfo($id) } /** - * Operation getDealUsersAsync + * Operation getDealFollowersAsync * - * List permitted users + * List followers of a deal * * @param int $id The ID of the deal (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getDealUsersAsync($id): PromiseInterface + public function getDealFollowersAsync($id): PromiseInterface { - return $this->getDealUsersAsyncWithHttpInfo($id) + return $this->getDealFollowersAsyncWithHttpInfo($id) ->then( function ($response) { return $response[0]; @@ -7830,19 +3673,19 @@ function ($response) { } /** - * Operation getDealUsersAsyncWithHttpInfo + * Operation getDealFollowersAsyncWithHttpInfo * - * List permitted users + * List followers of a deal * * @param int $id The ID of the deal (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getDealUsersAsyncWithHttpInfo($id): PromiseInterface + public function getDealFollowersAsyncWithHttpInfo($id): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\ListPermittedUsersResponse'; - $request = $this->getDealUsersRequest($id); + $returnType = '\Pipedrive\versions\v1\Model\ListFollowersResponse'; + $request = $this->getDealFollowersRequest($id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -7879,24 +3722,24 @@ function ($exception) { } /** - * Create request for operation 'getDealUsers' + * Create request for operation 'getDealFollowers' * * @param int $id The ID of the deal (required) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function getDealUsersRequest($id): Request + public function getDealFollowersRequest($id): Request { // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getDealUsers' + 'Missing the required parameter $id when calling getDealFollowers' ); } - $resourcePath = '/deals/{id}/permittedUsers'; + $resourcePath = '/deals/{id}/followers'; $formParams = []; $queryParams = []; $headerParams = []; @@ -7988,52 +3831,40 @@ public function getDealUsersRequest($id): Request } /** - * Operation getDeals + * Operation getDealMailMessages * - * Get all deals + * List mail messages associated with a deal * - * @param int|null $user_id If supplied, only deals matching the given user will be returned. However, `filter_id` and `owned_by_you` takes precedence over `user_id` when supplied. (optional) - * @param int|null $filter_id The ID of the filter to use (optional) - * @param int|null $stage_id If supplied, only deals within the given stage will be returned (optional) - * @param string|'all_not_deleted' $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional, default to 'all_not_deleted') + * @param int $id The ID of the deal (required) * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) - * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $owned_by_you When supplied, only deals owned by you are returned. However, `filter_id` takes precedence over `owned_by_you` when both are supplied. (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\GetDeals - * @deprecated + * @return \Pipedrive\versions\v1\Model\ListMailMessagesResponse */ - public function getDeals($user_id = null, $filter_id = null, $stage_id = null, $status = 'all_not_deleted', $start = 0, $limit = null, $sort = null, $owned_by_you = null) + public function getDealMailMessages($id, $start = 0, $limit = null) { - list($response) = $this->getDealsWithHttpInfo($user_id, $filter_id, $stage_id, $status, $start, $limit, $sort, $owned_by_you); + list($response) = $this->getDealMailMessagesWithHttpInfo($id, $start, $limit); return $response; } /** - * Operation getDealsWithHttpInfo + * Operation getDealMailMessagesWithHttpInfo * - * Get all deals + * List mail messages associated with a deal * - * @param int|null $user_id If supplied, only deals matching the given user will be returned. However, `filter_id` and `owned_by_you` takes precedence over `user_id` when supplied. (optional) - * @param int|null $filter_id The ID of the filter to use (optional) - * @param int|null $stage_id If supplied, only deals within the given stage will be returned (optional) - * @param string|'all_not_deleted' $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional, default to 'all_not_deleted') + * @param int $id The ID of the deal (required) * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) - * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $owned_by_you When supplied, only deals owned by you are returned. However, `filter_id` takes precedence over `owned_by_you` when both are supplied. (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\GetDeals, HTTP status code, HTTP response headers (array of strings) - * @deprecated + * @return array of \Pipedrive\versions\v1\Model\ListMailMessagesResponse, HTTP status code, HTTP response headers (array of strings) */ - public function getDealsWithHttpInfo($user_id = null, $filter_id = null, $stage_id = null, $status = 'all_not_deleted', $start = 0, $limit = null, $sort = null, $owned_by_you = null) + public function getDealMailMessagesWithHttpInfo($id, $start = 0, $limit = null) { - $request = $this->getDealsRequest($user_id, $filter_id, $stage_id, $status, $start, $limit, $sort, $owned_by_you); + $request = $this->getDealMailMessagesRequest($id, $start, $limit); try { $options = $this->createHttpClientOption(); @@ -8042,7 +3873,7 @@ public function getDealsWithHttpInfo($user_id = null, $filter_id = null, $stage_ } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getDealsRequest($user_id, $filter_id, $stage_id, $status, $start, $limit, $sort, $owned_by_you); + $request = $this->getDealMailMessagesRequest($id, $start, $limit); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -8067,14 +3898,14 @@ public function getDealsWithHttpInfo($user_id = null, $filter_id = null, $stage_ switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetDeals' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ListMailMessagesResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDeals', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListMailMessagesResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -8094,14 +3925,14 @@ public function getDealsWithHttpInfo($user_id = null, $filter_id = null, $stage_ } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetDeals' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ListMailMessagesResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDeals', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListMailMessagesResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -8111,7 +3942,7 @@ public function getDealsWithHttpInfo($user_id = null, $filter_id = null, $stage_ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\GetDeals', + '\Pipedrive\versions\v1\Model\ListMailMessagesResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -8122,26 +3953,20 @@ public function getDealsWithHttpInfo($user_id = null, $filter_id = null, $stage_ } /** - * Operation getDealsAsync + * Operation getDealMailMessagesAsync * - * Get all deals + * List mail messages associated with a deal * - * @param int|null $user_id If supplied, only deals matching the given user will be returned. However, `filter_id` and `owned_by_you` takes precedence over `user_id` when supplied. (optional) - * @param int|null $filter_id The ID of the filter to use (optional) - * @param int|null $stage_id If supplied, only deals within the given stage will be returned (optional) - * @param string|'all_not_deleted' $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional, default to 'all_not_deleted') + * @param int $id The ID of the deal (required) * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) - * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $owned_by_you When supplied, only deals owned by you are returned. However, `filter_id` takes precedence over `owned_by_you` when both are supplied. (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function getDealsAsync($user_id = null, $filter_id = null, $stage_id = null, $status = 'all_not_deleted', $start = 0, $limit = null, $sort = null, $owned_by_you = null): PromiseInterface + public function getDealMailMessagesAsync($id, $start = 0, $limit = null): PromiseInterface { - return $this->getDealsAsyncWithHttpInfo($user_id, $filter_id, $stage_id, $status, $start, $limit, $sort, $owned_by_you) + return $this->getDealMailMessagesAsyncWithHttpInfo($id, $start, $limit) ->then( function ($response) { return $response[0]; @@ -8150,27 +3975,21 @@ function ($response) { } /** - * Operation getDealsAsyncWithHttpInfo + * Operation getDealMailMessagesAsyncWithHttpInfo * - * Get all deals + * List mail messages associated with a deal * - * @param int|null $user_id If supplied, only deals matching the given user will be returned. However, `filter_id` and `owned_by_you` takes precedence over `user_id` when supplied. (optional) - * @param int|null $filter_id The ID of the filter to use (optional) - * @param int|null $stage_id If supplied, only deals within the given stage will be returned (optional) - * @param string|'all_not_deleted' $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional, default to 'all_not_deleted') + * @param int $id The ID of the deal (required) * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) - * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $owned_by_you When supplied, only deals owned by you are returned. However, `filter_id` takes precedence over `owned_by_you` when both are supplied. (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function getDealsAsyncWithHttpInfo($user_id = null, $filter_id = null, $stage_id = null, $status = 'all_not_deleted', $start = 0, $limit = null, $sort = null, $owned_by_you = null): PromiseInterface + public function getDealMailMessagesAsyncWithHttpInfo($id, $start = 0, $limit = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\GetDeals'; - $request = $this->getDealsRequest($user_id, $filter_id, $stage_id, $status, $start, $limit, $sort, $owned_by_you); + $returnType = '\Pipedrive\versions\v1\Model\ListMailMessagesResponse'; + $request = $this->getDealMailMessagesRequest($id, $start, $limit); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -8207,63 +4026,32 @@ function ($exception) { } /** - * Create request for operation 'getDeals' + * Create request for operation 'getDealMailMessages' * - * @param int|null $user_id If supplied, only deals matching the given user will be returned. However, `filter_id` and `owned_by_you` takes precedence over `user_id` when supplied. (optional) - * @param int|null $filter_id The ID of the filter to use (optional) - * @param int|null $stage_id If supplied, only deals within the given stage will be returned (optional) - * @param string|'all_not_deleted' $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional, default to 'all_not_deleted') + * @param int $id The ID of the deal (required) * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) - * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $owned_by_you When supplied, only deals owned by you are returned. However, `filter_id` takes precedence over `owned_by_you` when both are supplied. (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request - * @deprecated */ - public function getDealsRequest($user_id = null, $filter_id = null, $stage_id = null, $status = 'all_not_deleted', $start = 0, $limit = null, $sort = null, $owned_by_you = null): Request + public function getDealMailMessagesRequest($id, $start = 0, $limit = null): Request { - - $resourcePath = '/deals'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - /* @phpstan-ignore-next-line */ - if (is_array($user_id)) { - $user_id = ObjectSerializer::serializeCollection($user_id, '', true); - } - if ($user_id !== null) { - $queryParams['user_id'] = $user_id; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($filter_id)) { - $filter_id = ObjectSerializer::serializeCollection($filter_id, '', true); - } - if ($filter_id !== null) { - $queryParams['filter_id'] = $filter_id; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($stage_id)) { - $stage_id = ObjectSerializer::serializeCollection($stage_id, '', true); - } - if ($stage_id !== null) { - $queryParams['stage_id'] = $stage_id; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($status)) { - $status = ObjectSerializer::serializeCollection($status, '', true); - } - if ($status !== null) { - $queryParams['status'] = $status; + // verify the required parameter 'id' is set + /* @phpstan-ignore-next-line */ + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling getDealMailMessages' + ); } + + $resourcePath = '/deals/{id}/mailMessages'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + // query params /* @phpstan-ignore-next-line */ if (is_array($start)) { @@ -8280,24 +4068,16 @@ public function getDealsRequest($user_id = null, $filter_id = null, $stage_id = if ($limit !== null) { $queryParams['limit'] = $limit; } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($sort)) { - $sort = ObjectSerializer::serializeCollection($sort, '', true); - } - if ($sort !== null) { - $queryParams['sort'] = $sort; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($owned_by_you)) { - $owned_by_you = ObjectSerializer::serializeCollection($owned_by_you, '', true); - } - if ($owned_by_you !== null) { - $queryParams['owned_by_you'] = $owned_by_you; - } + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } /* @phpstan-ignore-next-line */ @@ -8373,50 +4153,40 @@ public function getDealsRequest($user_id = null, $filter_id = null, $stage_id = } /** - * Operation getDealsCollection + * Operation getDealParticipants * - * Get all deals collection + * List participants of a deal * - * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) - * @param int|null $limit For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. (optional) - * @param string|null $since The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) - * @param string|null $until The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) - * @param int|null $user_id If supplied, only deals matching the given user will be returned (optional) - * @param int|null $stage_id If supplied, only deals within the given stage will be returned (optional) - * @param string|null $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional) + * @param int $id The ID of the deal (required) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\GetDealsCollection|\Pipedrive\versions\v1\Model\FailResponse - * @deprecated + * @return \Pipedrive\versions\v1\Model\DealParticipants */ - public function getDealsCollection($cursor = null, $limit = null, $since = null, $until = null, $user_id = null, $stage_id = null, $status = null) + public function getDealParticipants($id, $start = 0, $limit = null) { - list($response) = $this->getDealsCollectionWithHttpInfo($cursor, $limit, $since, $until, $user_id, $stage_id, $status); + list($response) = $this->getDealParticipantsWithHttpInfo($id, $start, $limit); return $response; } /** - * Operation getDealsCollectionWithHttpInfo + * Operation getDealParticipantsWithHttpInfo * - * Get all deals collection + * List participants of a deal * - * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) - * @param int|null $limit For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. (optional) - * @param string|null $since The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) - * @param string|null $until The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) - * @param int|null $user_id If supplied, only deals matching the given user will be returned (optional) - * @param int|null $stage_id If supplied, only deals within the given stage will be returned (optional) - * @param string|null $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional) + * @param int $id The ID of the deal (required) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\GetDealsCollection|\Pipedrive\versions\v1\Model\FailResponse, HTTP status code, HTTP response headers (array of strings) - * @deprecated + * @return array of \Pipedrive\versions\v1\Model\DealParticipants, HTTP status code, HTTP response headers (array of strings) */ - public function getDealsCollectionWithHttpInfo($cursor = null, $limit = null, $since = null, $until = null, $user_id = null, $stage_id = null, $status = null) + public function getDealParticipantsWithHttpInfo($id, $start = 0, $limit = null) { - $request = $this->getDealsCollectionRequest($cursor, $limit, $since, $until, $user_id, $stage_id, $status); + $request = $this->getDealParticipantsRequest($id, $start, $limit); try { $options = $this->createHttpClientOption(); @@ -8425,7 +4195,7 @@ public function getDealsCollectionWithHttpInfo($cursor = null, $limit = null, $s } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getDealsCollectionRequest($cursor, $limit, $since, $until, $user_id, $stage_id, $status); + $request = $this->getDealParticipantsRequest($id, $start, $limit); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -8450,27 +4220,14 @@ public function getDealsCollectionWithHttpInfo($cursor = null, $limit = null, $s switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetDealsCollection' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDealsCollection', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 403: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\FailResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\DealParticipants' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\FailResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DealParticipants', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -8490,14 +4247,14 @@ public function getDealsCollectionWithHttpInfo($cursor = null, $limit = null, $s } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetDealsCollection' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\DealParticipants' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDealsCollection', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DealParticipants', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -8507,15 +4264,7 @@ public function getDealsCollectionWithHttpInfo($cursor = null, $limit = null, $s case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\GetDealsCollection', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\FailResponse', + '\Pipedrive\versions\v1\Model\DealParticipants', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -8526,25 +4275,20 @@ public function getDealsCollectionWithHttpInfo($cursor = null, $limit = null, $s } /** - * Operation getDealsCollectionAsync + * Operation getDealParticipantsAsync * - * Get all deals collection + * List participants of a deal * - * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) - * @param int|null $limit For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. (optional) - * @param string|null $since The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) - * @param string|null $until The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) - * @param int|null $user_id If supplied, only deals matching the given user will be returned (optional) - * @param int|null $stage_id If supplied, only deals within the given stage will be returned (optional) - * @param string|null $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional) + * @param int $id The ID of the deal (required) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function getDealsCollectionAsync($cursor = null, $limit = null, $since = null, $until = null, $user_id = null, $stage_id = null, $status = null): PromiseInterface + public function getDealParticipantsAsync($id, $start = 0, $limit = null): PromiseInterface { - return $this->getDealsCollectionAsyncWithHttpInfo($cursor, $limit, $since, $until, $user_id, $stage_id, $status) + return $this->getDealParticipantsAsyncWithHttpInfo($id, $start, $limit) ->then( function ($response) { return $response[0]; @@ -8553,26 +4297,21 @@ function ($response) { } /** - * Operation getDealsCollectionAsyncWithHttpInfo + * Operation getDealParticipantsAsyncWithHttpInfo * - * Get all deals collection + * List participants of a deal * - * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) - * @param int|null $limit For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. (optional) - * @param string|null $since The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) - * @param string|null $until The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) - * @param int|null $user_id If supplied, only deals matching the given user will be returned (optional) - * @param int|null $stage_id If supplied, only deals within the given stage will be returned (optional) - * @param string|null $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional) + * @param int $id The ID of the deal (required) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function getDealsCollectionAsyncWithHttpInfo($cursor = null, $limit = null, $since = null, $until = null, $user_id = null, $stage_id = null, $status = null): PromiseInterface + public function getDealParticipantsAsyncWithHttpInfo($id, $start = 0, $limit = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\GetDealsCollection'; - $request = $this->getDealsCollectionRequest($cursor, $limit, $since, $until, $user_id, $stage_id, $status); + $returnType = '\Pipedrive\versions\v1\Model\DealParticipants'; + $request = $this->getDealParticipantsRequest($id, $start, $limit); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -8609,24 +4348,26 @@ function ($exception) { } /** - * Create request for operation 'getDealsCollection' + * Create request for operation 'getDealParticipants' * - * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) - * @param int|null $limit For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. (optional) - * @param string|null $since The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) - * @param string|null $until The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) - * @param int|null $user_id If supplied, only deals matching the given user will be returned (optional) - * @param int|null $stage_id If supplied, only deals within the given stage will be returned (optional) - * @param string|null $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional) + * @param int $id The ID of the deal (required) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request - * @deprecated */ - public function getDealsCollectionRequest($cursor = null, $limit = null, $since = null, $until = null, $user_id = null, $stage_id = null, $status = null): Request + public function getDealParticipantsRequest($id, $start = 0, $limit = null): Request { + // verify the required parameter 'id' is set + /* @phpstan-ignore-next-line */ + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling getDealParticipants' + ); + } - $resourcePath = '/deals/collection'; + $resourcePath = '/deals/{id}/participants'; $formParams = []; $queryParams = []; $headerParams = []; @@ -8635,11 +4376,11 @@ public function getDealsCollectionRequest($cursor = null, $limit = null, $since // query params /* @phpstan-ignore-next-line */ - if (is_array($cursor)) { - $cursor = ObjectSerializer::serializeCollection($cursor, '', true); + if (is_array($start)) { + $start = ObjectSerializer::serializeCollection($start, '', true); } - if ($cursor !== null) { - $queryParams['cursor'] = $cursor; + if ($start !== null) { + $queryParams['start'] = $start; } // query params /* @phpstan-ignore-next-line */ @@ -8649,48 +4390,16 @@ public function getDealsCollectionRequest($cursor = null, $limit = null, $since if ($limit !== null) { $queryParams['limit'] = $limit; } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($since)) { - $since = ObjectSerializer::serializeCollection($since, '', true); - } - if ($since !== null) { - $queryParams['since'] = $since; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($until)) { - $until = ObjectSerializer::serializeCollection($until, '', true); - } - if ($until !== null) { - $queryParams['until'] = $until; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($user_id)) { - $user_id = ObjectSerializer::serializeCollection($user_id, '', true); - } - if ($user_id !== null) { - $queryParams['user_id'] = $user_id; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($stage_id)) { - $stage_id = ObjectSerializer::serializeCollection($stage_id, '', true); - } - if ($stage_id !== null) { - $queryParams['stage_id'] = $stage_id; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($status)) { - $status = ObjectSerializer::serializeCollection($status, '', true); - } - if ($status !== null) { - $queryParams['status'] = $status; - } + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } /* @phpstan-ignore-next-line */ @@ -8766,44 +4475,40 @@ public function getDealsCollectionRequest($cursor = null, $limit = null, $since } /** - * Operation getDealsSummary + * Operation getDealParticipantsChangelog * - * Get deals summary + * List updates about participants of a deal * - * @param string|null $status Only fetch deals with a specific status. open = Open, won = Won, lost = Lost. (optional) - * @param int|null $filter_id <code>user_id</code> will not be considered. Only deals matching the given filter will be returned. (optional) - * @param int|null $user_id Only deals matching the given user will be returned. `user_id` will not be considered if you use `filter_id`. (optional) - * @param int|null $pipeline_id Only deals within the given pipeline will be returned (optional) - * @param int|null $stage_id Only deals within the given stage will be returned (optional) + * @param int $id The ID of the deal (required) + * @param int|null $limit Items shown per page (optional) + * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\GetDealsSummary + * @return \Pipedrive\versions\v1\Model\ParticipantsChangelog */ - public function getDealsSummary($status = null, $filter_id = null, $user_id = null, $pipeline_id = null, $stage_id = null) + public function getDealParticipantsChangelog($id, $limit = null, $cursor = null) { - list($response) = $this->getDealsSummaryWithHttpInfo($status, $filter_id, $user_id, $pipeline_id, $stage_id); + list($response) = $this->getDealParticipantsChangelogWithHttpInfo($id, $limit, $cursor); return $response; } /** - * Operation getDealsSummaryWithHttpInfo + * Operation getDealParticipantsChangelogWithHttpInfo * - * Get deals summary + * List updates about participants of a deal * - * @param string|null $status Only fetch deals with a specific status. open = Open, won = Won, lost = Lost. (optional) - * @param int|null $filter_id <code>user_id</code> will not be considered. Only deals matching the given filter will be returned. (optional) - * @param int|null $user_id Only deals matching the given user will be returned. `user_id` will not be considered if you use `filter_id`. (optional) - * @param int|null $pipeline_id Only deals within the given pipeline will be returned (optional) - * @param int|null $stage_id Only deals within the given stage will be returned (optional) + * @param int $id The ID of the deal (required) + * @param int|null $limit Items shown per page (optional) + * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\GetDealsSummary, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v1\Model\ParticipantsChangelog, HTTP status code, HTTP response headers (array of strings) */ - public function getDealsSummaryWithHttpInfo($status = null, $filter_id = null, $user_id = null, $pipeline_id = null, $stage_id = null) + public function getDealParticipantsChangelogWithHttpInfo($id, $limit = null, $cursor = null) { - $request = $this->getDealsSummaryRequest($status, $filter_id, $user_id, $pipeline_id, $stage_id); + $request = $this->getDealParticipantsChangelogRequest($id, $limit, $cursor); try { $options = $this->createHttpClientOption(); @@ -8812,7 +4517,7 @@ public function getDealsSummaryWithHttpInfo($status = null, $filter_id = null, $ } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getDealsSummaryRequest($status, $filter_id, $user_id, $pipeline_id, $stage_id); + $request = $this->getDealParticipantsChangelogRequest($id, $limit, $cursor); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -8837,14 +4542,14 @@ public function getDealsSummaryWithHttpInfo($status = null, $filter_id = null, $ switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetDealsSummary' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ParticipantsChangelog' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDealsSummary', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ParticipantsChangelog', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -8864,14 +4569,14 @@ public function getDealsSummaryWithHttpInfo($status = null, $filter_id = null, $ } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetDealsSummary' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ParticipantsChangelog' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDealsSummary', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ParticipantsChangelog', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -8881,7 +4586,7 @@ public function getDealsSummaryWithHttpInfo($status = null, $filter_id = null, $ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\GetDealsSummary', + '\Pipedrive\versions\v1\Model\ParticipantsChangelog', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -8892,22 +4597,20 @@ public function getDealsSummaryWithHttpInfo($status = null, $filter_id = null, $ } /** - * Operation getDealsSummaryAsync + * Operation getDealParticipantsChangelogAsync * - * Get deals summary + * List updates about participants of a deal * - * @param string|null $status Only fetch deals with a specific status. open = Open, won = Won, lost = Lost. (optional) - * @param int|null $filter_id <code>user_id</code> will not be considered. Only deals matching the given filter will be returned. (optional) - * @param int|null $user_id Only deals matching the given user will be returned. `user_id` will not be considered if you use `filter_id`. (optional) - * @param int|null $pipeline_id Only deals within the given pipeline will be returned (optional) - * @param int|null $stage_id Only deals within the given stage will be returned (optional) + * @param int $id The ID of the deal (required) + * @param int|null $limit Items shown per page (optional) + * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getDealsSummaryAsync($status = null, $filter_id = null, $user_id = null, $pipeline_id = null, $stage_id = null): PromiseInterface + public function getDealParticipantsChangelogAsync($id, $limit = null, $cursor = null): PromiseInterface { - return $this->getDealsSummaryAsyncWithHttpInfo($status, $filter_id, $user_id, $pipeline_id, $stage_id) + return $this->getDealParticipantsChangelogAsyncWithHttpInfo($id, $limit, $cursor) ->then( function ($response) { return $response[0]; @@ -8916,23 +4619,21 @@ function ($response) { } /** - * Operation getDealsSummaryAsyncWithHttpInfo + * Operation getDealParticipantsChangelogAsyncWithHttpInfo * - * Get deals summary + * List updates about participants of a deal * - * @param string|null $status Only fetch deals with a specific status. open = Open, won = Won, lost = Lost. (optional) - * @param int|null $filter_id <code>user_id</code> will not be considered. Only deals matching the given filter will be returned. (optional) - * @param int|null $user_id Only deals matching the given user will be returned. `user_id` will not be considered if you use `filter_id`. (optional) - * @param int|null $pipeline_id Only deals within the given pipeline will be returned (optional) - * @param int|null $stage_id Only deals within the given stage will be returned (optional) + * @param int $id The ID of the deal (required) + * @param int|null $limit Items shown per page (optional) + * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getDealsSummaryAsyncWithHttpInfo($status = null, $filter_id = null, $user_id = null, $pipeline_id = null, $stage_id = null): PromiseInterface + public function getDealParticipantsChangelogAsyncWithHttpInfo($id, $limit = null, $cursor = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\GetDealsSummary'; - $request = $this->getDealsSummaryRequest($status, $filter_id, $user_id, $pipeline_id, $stage_id); + $returnType = '\Pipedrive\versions\v1\Model\ParticipantsChangelog'; + $request = $this->getDealParticipantsChangelogRequest($id, $limit, $cursor); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -8969,21 +4670,26 @@ function ($exception) { } /** - * Create request for operation 'getDealsSummary' - * - * @param string|null $status Only fetch deals with a specific status. open = Open, won = Won, lost = Lost. (optional) - * @param int|null $filter_id <code>user_id</code> will not be considered. Only deals matching the given filter will be returned. (optional) - * @param int|null $user_id Only deals matching the given user will be returned. `user_id` will not be considered if you use `filter_id`. (optional) - * @param int|null $pipeline_id Only deals within the given pipeline will be returned (optional) - * @param int|null $stage_id Only deals within the given stage will be returned (optional) + * Create request for operation 'getDealParticipantsChangelog' + * + * @param int $id The ID of the deal (required) + * @param int|null $limit Items shown per page (optional) + * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function getDealsSummaryRequest($status = null, $filter_id = null, $user_id = null, $pipeline_id = null, $stage_id = null): Request + public function getDealParticipantsChangelogRequest($id, $limit = null, $cursor = null): Request { + // verify the required parameter 'id' is set + /* @phpstan-ignore-next-line */ + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling getDealParticipantsChangelog' + ); + } - $resourcePath = '/deals/summary'; + $resourcePath = '/deals/{id}/participantsChangelog'; $formParams = []; $queryParams = []; $headerParams = []; @@ -8992,46 +4698,30 @@ public function getDealsSummaryRequest($status = null, $filter_id = null, $user_ // query params /* @phpstan-ignore-next-line */ - if (is_array($status)) { - $status = ObjectSerializer::serializeCollection($status, '', true); - } - if ($status !== null) { - $queryParams['status'] = $status; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($filter_id)) { - $filter_id = ObjectSerializer::serializeCollection($filter_id, '', true); - } - if ($filter_id !== null) { - $queryParams['filter_id'] = $filter_id; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($user_id)) { - $user_id = ObjectSerializer::serializeCollection($user_id, '', true); - } - if ($user_id !== null) { - $queryParams['user_id'] = $user_id; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($pipeline_id)) { - $pipeline_id = ObjectSerializer::serializeCollection($pipeline_id, '', true); + if (is_array($limit)) { + $limit = ObjectSerializer::serializeCollection($limit, '', true); } - if ($pipeline_id !== null) { - $queryParams['pipeline_id'] = $pipeline_id; + if ($limit !== null) { + $queryParams['limit'] = $limit; } // query params /* @phpstan-ignore-next-line */ - if (is_array($stage_id)) { - $stage_id = ObjectSerializer::serializeCollection($stage_id, '', true); + if (is_array($cursor)) { + $cursor = ObjectSerializer::serializeCollection($cursor, '', true); } - if ($stage_id !== null) { - $queryParams['stage_id'] = $stage_id; + if ($cursor !== null) { + $queryParams['cursor'] = $cursor; } + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } /* @phpstan-ignore-next-line */ @@ -9107,52 +4797,44 @@ public function getDealsSummaryRequest($status = null, $filter_id = null, $user_ } /** - * Operation getDealsTimeline + * Operation getDealUpdates * - * Get deals timeline + * List updates about a deal * - * @param \DateTime $start_date The date when the first interval starts. Format: YYYY-MM-DD. (required) - * @param string $interval The type of the interval<table><tr><th>Value</th><th>Description</th></tr><tr><td>`day`</td><td>Day</td></tr><tr><td>`week`</td><td>A full week (7 days) starting from `start_date`</td></tr><tr><td>`month`</td><td>A full month (depending on the number of days in given month) starting from `start_date`</td></tr><tr><td>`quarter`</td><td>A full quarter (3 months) starting from `start_date`</td></tr></table> (required) - * @param int $amount The number of given intervals, starting from `start_date`, to fetch. E.g. 3 (months). (required) - * @param string $field_key The date field key which deals will be retrieved from (required) - * @param int|null $user_id If supplied, only deals matching the given user will be returned (optional) - * @param int|null $pipeline_id If supplied, only deals matching the given pipeline will be returned (optional) - * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $exclude_deals Whether to exclude deals list (1) or not (0). Note that when deals are excluded, the timeline summary (counts and values) is still returned. (optional) - * @param string|null $totals_convert_currency The 3-letter currency code of any of the supported currencies. When supplied, `totals_converted` is returned per each interval which contains the currency-converted total amounts in the given currency. You may also set this parameter to `default_currency` in which case the user's default currency is used. (optional) + * @param int $id The ID of the deal (required) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) + * @param string|null $all_changes Whether to show custom field updates or not. 1 = Include custom field changes. If omitted returns changes without custom field updates. (optional) + * @param string|null $items A comma-separated string for filtering out item specific updates. (Possible values - call, activity, plannedActivity, change, note, deal, file, dealChange, personChange, organizationChange, follower, dealFollower, personFollower, organizationFollower, participant, comment, mailMessage, mailMessageWithAttachment, invoice, document, marketing_campaign_stat, marketing_status_change). (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\GetDealsTimeline + * @return \Pipedrive\versions\v1\Model\DealFlowResponse */ - public function getDealsTimeline($start_date, $interval, $amount, $field_key, $user_id = null, $pipeline_id = null, $filter_id = null, $exclude_deals = null, $totals_convert_currency = null) + public function getDealUpdates($id, $start = 0, $limit = null, $all_changes = null, $items = null) { - list($response) = $this->getDealsTimelineWithHttpInfo($start_date, $interval, $amount, $field_key, $user_id, $pipeline_id, $filter_id, $exclude_deals, $totals_convert_currency); + list($response) = $this->getDealUpdatesWithHttpInfo($id, $start, $limit, $all_changes, $items); return $response; } /** - * Operation getDealsTimelineWithHttpInfo + * Operation getDealUpdatesWithHttpInfo * - * Get deals timeline + * List updates about a deal * - * @param \DateTime $start_date The date when the first interval starts. Format: YYYY-MM-DD. (required) - * @param string $interval The type of the interval<table><tr><th>Value</th><th>Description</th></tr><tr><td>`day`</td><td>Day</td></tr><tr><td>`week`</td><td>A full week (7 days) starting from `start_date`</td></tr><tr><td>`month`</td><td>A full month (depending on the number of days in given month) starting from `start_date`</td></tr><tr><td>`quarter`</td><td>A full quarter (3 months) starting from `start_date`</td></tr></table> (required) - * @param int $amount The number of given intervals, starting from `start_date`, to fetch. E.g. 3 (months). (required) - * @param string $field_key The date field key which deals will be retrieved from (required) - * @param int|null $user_id If supplied, only deals matching the given user will be returned (optional) - * @param int|null $pipeline_id If supplied, only deals matching the given pipeline will be returned (optional) - * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $exclude_deals Whether to exclude deals list (1) or not (0). Note that when deals are excluded, the timeline summary (counts and values) is still returned. (optional) - * @param string|null $totals_convert_currency The 3-letter currency code of any of the supported currencies. When supplied, `totals_converted` is returned per each interval which contains the currency-converted total amounts in the given currency. You may also set this parameter to `default_currency` in which case the user's default currency is used. (optional) + * @param int $id The ID of the deal (required) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) + * @param string|null $all_changes Whether to show custom field updates or not. 1 = Include custom field changes. If omitted returns changes without custom field updates. (optional) + * @param string|null $items A comma-separated string for filtering out item specific updates. (Possible values - call, activity, plannedActivity, change, note, deal, file, dealChange, personChange, organizationChange, follower, dealFollower, personFollower, organizationFollower, participant, comment, mailMessage, mailMessageWithAttachment, invoice, document, marketing_campaign_stat, marketing_status_change). (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\GetDealsTimeline, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v1\Model\DealFlowResponse, HTTP status code, HTTP response headers (array of strings) */ - public function getDealsTimelineWithHttpInfo($start_date, $interval, $amount, $field_key, $user_id = null, $pipeline_id = null, $filter_id = null, $exclude_deals = null, $totals_convert_currency = null) + public function getDealUpdatesWithHttpInfo($id, $start = 0, $limit = null, $all_changes = null, $items = null) { - $request = $this->getDealsTimelineRequest($start_date, $interval, $amount, $field_key, $user_id, $pipeline_id, $filter_id, $exclude_deals, $totals_convert_currency); + $request = $this->getDealUpdatesRequest($id, $start, $limit, $all_changes, $items); try { $options = $this->createHttpClientOption(); @@ -9161,7 +4843,7 @@ public function getDealsTimelineWithHttpInfo($start_date, $interval, $amount, $f } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getDealsTimelineRequest($start_date, $interval, $amount, $field_key, $user_id, $pipeline_id, $filter_id, $exclude_deals, $totals_convert_currency); + $request = $this->getDealUpdatesRequest($id, $start, $limit, $all_changes, $items); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -9186,14 +4868,14 @@ public function getDealsTimelineWithHttpInfo($start_date, $interval, $amount, $f switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetDealsTimeline' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\DealFlowResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDealsTimeline', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DealFlowResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -9213,14 +4895,14 @@ public function getDealsTimelineWithHttpInfo($start_date, $interval, $amount, $f } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetDealsTimeline' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\DealFlowResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDealsTimeline', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DealFlowResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -9230,7 +4912,7 @@ public function getDealsTimelineWithHttpInfo($start_date, $interval, $amount, $f case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\GetDealsTimeline', + '\Pipedrive\versions\v1\Model\DealFlowResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -9241,26 +4923,22 @@ public function getDealsTimelineWithHttpInfo($start_date, $interval, $amount, $f } /** - * Operation getDealsTimelineAsync + * Operation getDealUpdatesAsync * - * Get deals timeline + * List updates about a deal * - * @param \DateTime $start_date The date when the first interval starts. Format: YYYY-MM-DD. (required) - * @param string $interval The type of the interval<table><tr><th>Value</th><th>Description</th></tr><tr><td>`day`</td><td>Day</td></tr><tr><td>`week`</td><td>A full week (7 days) starting from `start_date`</td></tr><tr><td>`month`</td><td>A full month (depending on the number of days in given month) starting from `start_date`</td></tr><tr><td>`quarter`</td><td>A full quarter (3 months) starting from `start_date`</td></tr></table> (required) - * @param int $amount The number of given intervals, starting from `start_date`, to fetch. E.g. 3 (months). (required) - * @param string $field_key The date field key which deals will be retrieved from (required) - * @param int|null $user_id If supplied, only deals matching the given user will be returned (optional) - * @param int|null $pipeline_id If supplied, only deals matching the given pipeline will be returned (optional) - * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $exclude_deals Whether to exclude deals list (1) or not (0). Note that when deals are excluded, the timeline summary (counts and values) is still returned. (optional) - * @param string|null $totals_convert_currency The 3-letter currency code of any of the supported currencies. When supplied, `totals_converted` is returned per each interval which contains the currency-converted total amounts in the given currency. You may also set this parameter to `default_currency` in which case the user's default currency is used. (optional) + * @param int $id The ID of the deal (required) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) + * @param string|null $all_changes Whether to show custom field updates or not. 1 = Include custom field changes. If omitted returns changes without custom field updates. (optional) + * @param string|null $items A comma-separated string for filtering out item specific updates. (Possible values - call, activity, plannedActivity, change, note, deal, file, dealChange, personChange, organizationChange, follower, dealFollower, personFollower, organizationFollower, participant, comment, mailMessage, mailMessageWithAttachment, invoice, document, marketing_campaign_stat, marketing_status_change). (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getDealsTimelineAsync($start_date, $interval, $amount, $field_key, $user_id = null, $pipeline_id = null, $filter_id = null, $exclude_deals = null, $totals_convert_currency = null): PromiseInterface + public function getDealUpdatesAsync($id, $start = 0, $limit = null, $all_changes = null, $items = null): PromiseInterface { - return $this->getDealsTimelineAsyncWithHttpInfo($start_date, $interval, $amount, $field_key, $user_id, $pipeline_id, $filter_id, $exclude_deals, $totals_convert_currency) + return $this->getDealUpdatesAsyncWithHttpInfo($id, $start, $limit, $all_changes, $items) ->then( function ($response) { return $response[0]; @@ -9269,27 +4947,23 @@ function ($response) { } /** - * Operation getDealsTimelineAsyncWithHttpInfo + * Operation getDealUpdatesAsyncWithHttpInfo * - * Get deals timeline + * List updates about a deal * - * @param \DateTime $start_date The date when the first interval starts. Format: YYYY-MM-DD. (required) - * @param string $interval The type of the interval<table><tr><th>Value</th><th>Description</th></tr><tr><td>`day`</td><td>Day</td></tr><tr><td>`week`</td><td>A full week (7 days) starting from `start_date`</td></tr><tr><td>`month`</td><td>A full month (depending on the number of days in given month) starting from `start_date`</td></tr><tr><td>`quarter`</td><td>A full quarter (3 months) starting from `start_date`</td></tr></table> (required) - * @param int $amount The number of given intervals, starting from `start_date`, to fetch. E.g. 3 (months). (required) - * @param string $field_key The date field key which deals will be retrieved from (required) - * @param int|null $user_id If supplied, only deals matching the given user will be returned (optional) - * @param int|null $pipeline_id If supplied, only deals matching the given pipeline will be returned (optional) - * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $exclude_deals Whether to exclude deals list (1) or not (0). Note that when deals are excluded, the timeline summary (counts and values) is still returned. (optional) - * @param string|null $totals_convert_currency The 3-letter currency code of any of the supported currencies. When supplied, `totals_converted` is returned per each interval which contains the currency-converted total amounts in the given currency. You may also set this parameter to `default_currency` in which case the user's default currency is used. (optional) + * @param int $id The ID of the deal (required) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) + * @param string|null $all_changes Whether to show custom field updates or not. 1 = Include custom field changes. If omitted returns changes without custom field updates. (optional) + * @param string|null $items A comma-separated string for filtering out item specific updates. (Possible values - call, activity, plannedActivity, change, note, deal, file, dealChange, personChange, organizationChange, follower, dealFollower, personFollower, organizationFollower, participant, comment, mailMessage, mailMessageWithAttachment, invoice, document, marketing_campaign_stat, marketing_status_change). (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getDealsTimelineAsyncWithHttpInfo($start_date, $interval, $amount, $field_key, $user_id = null, $pipeline_id = null, $filter_id = null, $exclude_deals = null, $totals_convert_currency = null): PromiseInterface + public function getDealUpdatesAsyncWithHttpInfo($id, $start = 0, $limit = null, $all_changes = null, $items = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\GetDealsTimeline'; - $request = $this->getDealsTimelineRequest($start_date, $interval, $amount, $field_key, $user_id, $pipeline_id, $filter_id, $exclude_deals, $totals_convert_currency); + $returnType = '\Pipedrive\versions\v1\Model\DealFlowResponse'; + $request = $this->getDealUpdatesRequest($id, $start, $limit, $all_changes, $items); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -9326,133 +5000,76 @@ function ($exception) { } /** - * Create request for operation 'getDealsTimeline' + * Create request for operation 'getDealUpdates' * - * @param \DateTime $start_date The date when the first interval starts. Format: YYYY-MM-DD. (required) - * @param string $interval The type of the interval<table><tr><th>Value</th><th>Description</th></tr><tr><td>`day`</td><td>Day</td></tr><tr><td>`week`</td><td>A full week (7 days) starting from `start_date`</td></tr><tr><td>`month`</td><td>A full month (depending on the number of days in given month) starting from `start_date`</td></tr><tr><td>`quarter`</td><td>A full quarter (3 months) starting from `start_date`</td></tr></table> (required) - * @param int $amount The number of given intervals, starting from `start_date`, to fetch. E.g. 3 (months). (required) - * @param string $field_key The date field key which deals will be retrieved from (required) - * @param int|null $user_id If supplied, only deals matching the given user will be returned (optional) - * @param int|null $pipeline_id If supplied, only deals matching the given pipeline will be returned (optional) - * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $exclude_deals Whether to exclude deals list (1) or not (0). Note that when deals are excluded, the timeline summary (counts and values) is still returned. (optional) - * @param string|null $totals_convert_currency The 3-letter currency code of any of the supported currencies. When supplied, `totals_converted` is returned per each interval which contains the currency-converted total amounts in the given currency. You may also set this parameter to `default_currency` in which case the user's default currency is used. (optional) + * @param int $id The ID of the deal (required) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) + * @param string|null $all_changes Whether to show custom field updates or not. 1 = Include custom field changes. If omitted returns changes without custom field updates. (optional) + * @param string|null $items A comma-separated string for filtering out item specific updates. (Possible values - call, activity, plannedActivity, change, note, deal, file, dealChange, personChange, organizationChange, follower, dealFollower, personFollower, organizationFollower, participant, comment, mailMessage, mailMessageWithAttachment, invoice, document, marketing_campaign_stat, marketing_status_change). (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function getDealsTimelineRequest($start_date, $interval, $amount, $field_key, $user_id = null, $pipeline_id = null, $filter_id = null, $exclude_deals = null, $totals_convert_currency = null): Request - { - // verify the required parameter 'start_date' is set - /* @phpstan-ignore-next-line */ - if ($start_date === null || (is_array($start_date) && count($start_date) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $start_date when calling getDealsTimeline' - ); - } - // verify the required parameter 'interval' is set - /* @phpstan-ignore-next-line */ - if ($interval === null || (is_array($interval) && count($interval) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $interval when calling getDealsTimeline' - ); - } - // verify the required parameter 'amount' is set - /* @phpstan-ignore-next-line */ - if ($amount === null || (is_array($amount) && count($amount) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $amount when calling getDealsTimeline' - ); - } - // verify the required parameter 'field_key' is set - /* @phpstan-ignore-next-line */ - if ($field_key === null || (is_array($field_key) && count($field_key) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $field_key when calling getDealsTimeline' - ); - } - - $resourcePath = '/deals/timeline'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - /* @phpstan-ignore-next-line */ - if (is_array($start_date)) { - $start_date = ObjectSerializer::serializeCollection($start_date, '', true); - } - if ($start_date !== null) { - $queryParams['start_date'] = $start_date; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($interval)) { - $interval = ObjectSerializer::serializeCollection($interval, '', true); - } - if ($interval !== null) { - $queryParams['interval'] = $interval; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($amount)) { - $amount = ObjectSerializer::serializeCollection($amount, '', true); - } - if ($amount !== null) { - $queryParams['amount'] = $amount; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($field_key)) { - $field_key = ObjectSerializer::serializeCollection($field_key, '', true); - } - if ($field_key !== null) { - $queryParams['field_key'] = $field_key; - } - // query params + public function getDealUpdatesRequest($id, $start = 0, $limit = null, $all_changes = null, $items = null): Request + { + // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ - if (is_array($user_id)) { - $user_id = ObjectSerializer::serializeCollection($user_id, '', true); - } - if ($user_id !== null) { - $queryParams['user_id'] = $user_id; + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling getDealUpdates' + ); } + + $resourcePath = '/deals/{id}/flow'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + // query params /* @phpstan-ignore-next-line */ - if (is_array($pipeline_id)) { - $pipeline_id = ObjectSerializer::serializeCollection($pipeline_id, '', true); + if (is_array($start)) { + $start = ObjectSerializer::serializeCollection($start, '', true); } - if ($pipeline_id !== null) { - $queryParams['pipeline_id'] = $pipeline_id; + if ($start !== null) { + $queryParams['start'] = $start; } // query params /* @phpstan-ignore-next-line */ - if (is_array($filter_id)) { - $filter_id = ObjectSerializer::serializeCollection($filter_id, '', true); + if (is_array($limit)) { + $limit = ObjectSerializer::serializeCollection($limit, '', true); } - if ($filter_id !== null) { - $queryParams['filter_id'] = $filter_id; + if ($limit !== null) { + $queryParams['limit'] = $limit; } // query params /* @phpstan-ignore-next-line */ - if (is_array($exclude_deals)) { - $exclude_deals = ObjectSerializer::serializeCollection($exclude_deals, '', true); + if (is_array($all_changes)) { + $all_changes = ObjectSerializer::serializeCollection($all_changes, '', true); } - if ($exclude_deals !== null) { - $queryParams['exclude_deals'] = $exclude_deals; + if ($all_changes !== null) { + $queryParams['all_changes'] = $all_changes; } // query params /* @phpstan-ignore-next-line */ - if (is_array($totals_convert_currency)) { - $totals_convert_currency = ObjectSerializer::serializeCollection($totals_convert_currency, '', true); + if (is_array($items)) { + $items = ObjectSerializer::serializeCollection($items, '', true); } - if ($totals_convert_currency !== null) { - $queryParams['totals_convert_currency'] = $totals_convert_currency; + if ($items !== null) { + $queryParams['items'] = $items; } + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } /* @phpstan-ignore-next-line */ @@ -9528,38 +5145,36 @@ public function getDealsTimelineRequest($start_date, $interval, $amount, $field_ } /** - * Operation mergeDeals + * Operation getDealUsers * - * Merge two deals + * List permitted users * * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v1\Model\MergeDealsRequest|null $merge_deals_request merge_deals_request (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\GetMergedDeal + * @return \Pipedrive\versions\v1\Model\ListPermittedUsersResponse */ - public function mergeDeals($id, $merge_deals_request = null) + public function getDealUsers($id) { - list($response) = $this->mergeDealsWithHttpInfo($id, $merge_deals_request); + list($response) = $this->getDealUsersWithHttpInfo($id); return $response; } /** - * Operation mergeDealsWithHttpInfo + * Operation getDealUsersWithHttpInfo * - * Merge two deals + * List permitted users * * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v1\Model\MergeDealsRequest|null $merge_deals_request (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\GetMergedDeal, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v1\Model\ListPermittedUsersResponse, HTTP status code, HTTP response headers (array of strings) */ - public function mergeDealsWithHttpInfo($id, $merge_deals_request = null) + public function getDealUsersWithHttpInfo($id) { - $request = $this->mergeDealsRequest($id, $merge_deals_request); + $request = $this->getDealUsersRequest($id); try { $options = $this->createHttpClientOption(); @@ -9568,7 +5183,7 @@ public function mergeDealsWithHttpInfo($id, $merge_deals_request = null) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->mergeDealsRequest($id, $merge_deals_request); + $request = $this->getDealUsersRequest($id); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -9593,14 +5208,14 @@ public function mergeDealsWithHttpInfo($id, $merge_deals_request = null) switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetMergedDeal' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ListPermittedUsersResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetMergedDeal', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListPermittedUsersResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -9620,14 +5235,14 @@ public function mergeDealsWithHttpInfo($id, $merge_deals_request = null) } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetMergedDeal' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ListPermittedUsersResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetMergedDeal', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListPermittedUsersResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -9637,7 +5252,7 @@ public function mergeDealsWithHttpInfo($id, $merge_deals_request = null) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\GetMergedDeal', + '\Pipedrive\versions\v1\Model\ListPermittedUsersResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -9648,19 +5263,18 @@ public function mergeDealsWithHttpInfo($id, $merge_deals_request = null) } /** - * Operation mergeDealsAsync + * Operation getDealUsersAsync * - * Merge two deals + * List permitted users * * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v1\Model\MergeDealsRequest|null $merge_deals_request (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function mergeDealsAsync($id, $merge_deals_request = null): PromiseInterface + public function getDealUsersAsync($id): PromiseInterface { - return $this->mergeDealsAsyncWithHttpInfo($id, $merge_deals_request) + return $this->getDealUsersAsyncWithHttpInfo($id) ->then( function ($response) { return $response[0]; @@ -9669,20 +5283,19 @@ function ($response) { } /** - * Operation mergeDealsAsyncWithHttpInfo + * Operation getDealUsersAsyncWithHttpInfo * - * Merge two deals + * List permitted users * * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v1\Model\MergeDealsRequest|null $merge_deals_request (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function mergeDealsAsyncWithHttpInfo($id, $merge_deals_request = null): PromiseInterface + public function getDealUsersAsyncWithHttpInfo($id): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\GetMergedDeal'; - $request = $this->mergeDealsRequest($id, $merge_deals_request); + $returnType = '\Pipedrive\versions\v1\Model\ListPermittedUsersResponse'; + $request = $this->getDealUsersRequest($id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -9719,25 +5332,24 @@ function ($exception) { } /** - * Create request for operation 'mergeDeals' + * Create request for operation 'getDealUsers' * * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v1\Model\MergeDealsRequest|null $merge_deals_request (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function mergeDealsRequest($id, $merge_deals_request = null): Request + public function getDealUsersRequest($id): Request { // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling mergeDeals' + 'Missing the required parameter $id when calling getDealUsers' ); } - $resourcePath = '/deals/{id}/merge'; + $resourcePath = '/deals/{id}/permittedUsers'; $formParams = []; $queryParams = []; $headerParams = []; @@ -9764,18 +5376,12 @@ public function mergeDealsRequest($id, $merge_deals_request = null): Request } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - ['application/json'] + [] ); } // for model (json/xml) - if (isset($merge_deals_request)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($merge_deals_request)); - } else { - $httpBody = $merge_deals_request; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { /* @phpstan-ignore-next-line */ if ($multipart) { $multipartContents = []; @@ -9827,7 +5433,7 @@ public function mergeDealsRequest($id, $merge_deals_request = null): Request $query = Query::build($queryParams); return new Request( - 'PUT', + 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -9835,54 +5441,44 @@ public function mergeDealsRequest($id, $merge_deals_request = null): Request } /** - * Operation searchDeals - * - * Search deals - * - * @param string $term The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded. (required) - * @param string|null $fields A comma-separated string array. The fields to perform the search from. Defaults to all of them. Only the following custom field types are searchable: `address`, `varchar`, `text`, `varchar_auto`, `double`, `monetary` and `phone`. Read more about searching by custom fields <a href=\"https://support.pipedrive.com/en/article/search-finding-what-you-need#searching-by-custom-fields\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>. (optional) - * @param bool|null $exact_match When enabled, only full exact matches against the given term are returned. It is <b>not</b> case sensitive. (optional) - * @param int|null $person_id Will filter deals by the provided person ID. The upper limit of found deals associated with the person is 2000. (optional) - * @param int|null $organization_id Will filter deals by the provided organization ID. The upper limit of found deals associated with the organization is 2000. (optional) - * @param string|null $status Will filter deals by the provided specific status. open = Open, won = Won, lost = Lost. The upper limit of found deals associated with the status is 2000. (optional) - * @param string|null $include_fields Supports including optional fields in the results which are not provided by default (optional) - * @param int|0 $start Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter. (optional, default to 0) - * @param int|null $limit Items shown per page (optional) + * Operation getDealsSummary + * + * Get deals summary + * + * @param string|null $status Only fetch deals with a specific status. open = Open, won = Won, lost = Lost. (optional) + * @param int|null $filter_id <code>user_id</code> will not be considered. Only deals matching the given filter will be returned. (optional) + * @param int|null $user_id Only deals matching the given user will be returned. `user_id` will not be considered if you use `filter_id`. (optional) + * @param int|null $pipeline_id Only deals within the given pipeline will be returned (optional) + * @param int|null $stage_id Only deals within the given stage will be returned (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\DealSearchResponse - * @deprecated + * @return \Pipedrive\versions\v1\Model\GetDealsSummary */ - public function searchDeals($term, $fields = null, $exact_match = null, $person_id = null, $organization_id = null, $status = null, $include_fields = null, $start = 0, $limit = null) + public function getDealsSummary($status = null, $filter_id = null, $user_id = null, $pipeline_id = null, $stage_id = null) { - list($response) = $this->searchDealsWithHttpInfo($term, $fields, $exact_match, $person_id, $organization_id, $status, $include_fields, $start, $limit); + list($response) = $this->getDealsSummaryWithHttpInfo($status, $filter_id, $user_id, $pipeline_id, $stage_id); return $response; } /** - * Operation searchDealsWithHttpInfo - * - * Search deals - * - * @param string $term The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded. (required) - * @param string|null $fields A comma-separated string array. The fields to perform the search from. Defaults to all of them. Only the following custom field types are searchable: `address`, `varchar`, `text`, `varchar_auto`, `double`, `monetary` and `phone`. Read more about searching by custom fields <a href=\"https://support.pipedrive.com/en/article/search-finding-what-you-need#searching-by-custom-fields\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>. (optional) - * @param bool|null $exact_match When enabled, only full exact matches against the given term are returned. It is <b>not</b> case sensitive. (optional) - * @param int|null $person_id Will filter deals by the provided person ID. The upper limit of found deals associated with the person is 2000. (optional) - * @param int|null $organization_id Will filter deals by the provided organization ID. The upper limit of found deals associated with the organization is 2000. (optional) - * @param string|null $status Will filter deals by the provided specific status. open = Open, won = Won, lost = Lost. The upper limit of found deals associated with the status is 2000. (optional) - * @param string|null $include_fields Supports including optional fields in the results which are not provided by default (optional) - * @param int|0 $start Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter. (optional, default to 0) - * @param int|null $limit Items shown per page (optional) + * Operation getDealsSummaryWithHttpInfo + * + * Get deals summary + * + * @param string|null $status Only fetch deals with a specific status. open = Open, won = Won, lost = Lost. (optional) + * @param int|null $filter_id <code>user_id</code> will not be considered. Only deals matching the given filter will be returned. (optional) + * @param int|null $user_id Only deals matching the given user will be returned. `user_id` will not be considered if you use `filter_id`. (optional) + * @param int|null $pipeline_id Only deals within the given pipeline will be returned (optional) + * @param int|null $stage_id Only deals within the given stage will be returned (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\DealSearchResponse, HTTP status code, HTTP response headers (array of strings) - * @deprecated + * @return array of \Pipedrive\versions\v1\Model\GetDealsSummary, HTTP status code, HTTP response headers (array of strings) */ - public function searchDealsWithHttpInfo($term, $fields = null, $exact_match = null, $person_id = null, $organization_id = null, $status = null, $include_fields = null, $start = 0, $limit = null) + public function getDealsSummaryWithHttpInfo($status = null, $filter_id = null, $user_id = null, $pipeline_id = null, $stage_id = null) { - $request = $this->searchDealsRequest($term, $fields, $exact_match, $person_id, $organization_id, $status, $include_fields, $start, $limit); + $request = $this->getDealsSummaryRequest($status, $filter_id, $user_id, $pipeline_id, $stage_id); try { $options = $this->createHttpClientOption(); @@ -9891,7 +5487,7 @@ public function searchDealsWithHttpInfo($term, $fields = null, $exact_match = nu } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->searchDealsRequest($term, $fields, $exact_match, $person_id, $organization_id, $status, $include_fields, $start, $limit); + $request = $this->getDealsSummaryRequest($status, $filter_id, $user_id, $pipeline_id, $stage_id); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -9916,14 +5512,14 @@ public function searchDealsWithHttpInfo($term, $fields = null, $exact_match = nu switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\DealSearchResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\GetDealsSummary' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DealSearchResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDealsSummary', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -9943,14 +5539,14 @@ public function searchDealsWithHttpInfo($term, $fields = null, $exact_match = nu } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\DealSearchResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\GetDealsSummary' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DealSearchResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDealsSummary', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -9960,7 +5556,7 @@ public function searchDealsWithHttpInfo($term, $fields = null, $exact_match = nu case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\DealSearchResponse', + '\Pipedrive\versions\v1\Model\GetDealsSummary', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -9971,27 +5567,22 @@ public function searchDealsWithHttpInfo($term, $fields = null, $exact_match = nu } /** - * Operation searchDealsAsync - * - * Search deals - * - * @param string $term The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded. (required) - * @param string|null $fields A comma-separated string array. The fields to perform the search from. Defaults to all of them. Only the following custom field types are searchable: `address`, `varchar`, `text`, `varchar_auto`, `double`, `monetary` and `phone`. Read more about searching by custom fields <a href=\"https://support.pipedrive.com/en/article/search-finding-what-you-need#searching-by-custom-fields\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>. (optional) - * @param bool|null $exact_match When enabled, only full exact matches against the given term are returned. It is <b>not</b> case sensitive. (optional) - * @param int|null $person_id Will filter deals by the provided person ID. The upper limit of found deals associated with the person is 2000. (optional) - * @param int|null $organization_id Will filter deals by the provided organization ID. The upper limit of found deals associated with the organization is 2000. (optional) - * @param string|null $status Will filter deals by the provided specific status. open = Open, won = Won, lost = Lost. The upper limit of found deals associated with the status is 2000. (optional) - * @param string|null $include_fields Supports including optional fields in the results which are not provided by default (optional) - * @param int|0 $start Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter. (optional, default to 0) - * @param int|null $limit Items shown per page (optional) + * Operation getDealsSummaryAsync + * + * Get deals summary + * + * @param string|null $status Only fetch deals with a specific status. open = Open, won = Won, lost = Lost. (optional) + * @param int|null $filter_id <code>user_id</code> will not be considered. Only deals matching the given filter will be returned. (optional) + * @param int|null $user_id Only deals matching the given user will be returned. `user_id` will not be considered if you use `filter_id`. (optional) + * @param int|null $pipeline_id Only deals within the given pipeline will be returned (optional) + * @param int|null $stage_id Only deals within the given stage will be returned (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function searchDealsAsync($term, $fields = null, $exact_match = null, $person_id = null, $organization_id = null, $status = null, $include_fields = null, $start = 0, $limit = null): PromiseInterface + public function getDealsSummaryAsync($status = null, $filter_id = null, $user_id = null, $pipeline_id = null, $stage_id = null): PromiseInterface { - return $this->searchDealsAsyncWithHttpInfo($term, $fields, $exact_match, $person_id, $organization_id, $status, $include_fields, $start, $limit) + return $this->getDealsSummaryAsyncWithHttpInfo($status, $filter_id, $user_id, $pipeline_id, $stage_id) ->then( function ($response) { return $response[0]; @@ -10000,28 +5591,23 @@ function ($response) { } /** - * Operation searchDealsAsyncWithHttpInfo - * - * Search deals - * - * @param string $term The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded. (required) - * @param string|null $fields A comma-separated string array. The fields to perform the search from. Defaults to all of them. Only the following custom field types are searchable: `address`, `varchar`, `text`, `varchar_auto`, `double`, `monetary` and `phone`. Read more about searching by custom fields <a href=\"https://support.pipedrive.com/en/article/search-finding-what-you-need#searching-by-custom-fields\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>. (optional) - * @param bool|null $exact_match When enabled, only full exact matches against the given term are returned. It is <b>not</b> case sensitive. (optional) - * @param int|null $person_id Will filter deals by the provided person ID. The upper limit of found deals associated with the person is 2000. (optional) - * @param int|null $organization_id Will filter deals by the provided organization ID. The upper limit of found deals associated with the organization is 2000. (optional) - * @param string|null $status Will filter deals by the provided specific status. open = Open, won = Won, lost = Lost. The upper limit of found deals associated with the status is 2000. (optional) - * @param string|null $include_fields Supports including optional fields in the results which are not provided by default (optional) - * @param int|0 $start Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter. (optional, default to 0) - * @param int|null $limit Items shown per page (optional) + * Operation getDealsSummaryAsyncWithHttpInfo + * + * Get deals summary + * + * @param string|null $status Only fetch deals with a specific status. open = Open, won = Won, lost = Lost. (optional) + * @param int|null $filter_id <code>user_id</code> will not be considered. Only deals matching the given filter will be returned. (optional) + * @param int|null $user_id Only deals matching the given user will be returned. `user_id` will not be considered if you use `filter_id`. (optional) + * @param int|null $pipeline_id Only deals within the given pipeline will be returned (optional) + * @param int|null $stage_id Only deals within the given stage will be returned (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function searchDealsAsyncWithHttpInfo($term, $fields = null, $exact_match = null, $person_id = null, $organization_id = null, $status = null, $include_fields = null, $start = 0, $limit = null): PromiseInterface + public function getDealsSummaryAsyncWithHttpInfo($status = null, $filter_id = null, $user_id = null, $pipeline_id = null, $stage_id = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\DealSearchResponse'; - $request = $this->searchDealsRequest($term, $fields, $exact_match, $person_id, $organization_id, $status, $include_fields, $start, $limit); + $returnType = '\Pipedrive\versions\v1\Model\GetDealsSummary'; + $request = $this->getDealsSummaryRequest($status, $filter_id, $user_id, $pipeline_id, $stage_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -10058,79 +5644,27 @@ function ($exception) { } /** - * Create request for operation 'searchDeals' - * - * @param string $term The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded. (required) - * @param string|null $fields A comma-separated string array. The fields to perform the search from. Defaults to all of them. Only the following custom field types are searchable: `address`, `varchar`, `text`, `varchar_auto`, `double`, `monetary` and `phone`. Read more about searching by custom fields <a href=\"https://support.pipedrive.com/en/article/search-finding-what-you-need#searching-by-custom-fields\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>. (optional) - * @param bool|null $exact_match When enabled, only full exact matches against the given term are returned. It is <b>not</b> case sensitive. (optional) - * @param int|null $person_id Will filter deals by the provided person ID. The upper limit of found deals associated with the person is 2000. (optional) - * @param int|null $organization_id Will filter deals by the provided organization ID. The upper limit of found deals associated with the organization is 2000. (optional) - * @param string|null $status Will filter deals by the provided specific status. open = Open, won = Won, lost = Lost. The upper limit of found deals associated with the status is 2000. (optional) - * @param string|null $include_fields Supports including optional fields in the results which are not provided by default (optional) - * @param int|0 $start Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter. (optional, default to 0) - * @param int|null $limit Items shown per page (optional) + * Create request for operation 'getDealsSummary' + * + * @param string|null $status Only fetch deals with a specific status. open = Open, won = Won, lost = Lost. (optional) + * @param int|null $filter_id <code>user_id</code> will not be considered. Only deals matching the given filter will be returned. (optional) + * @param int|null $user_id Only deals matching the given user will be returned. `user_id` will not be considered if you use `filter_id`. (optional) + * @param int|null $pipeline_id Only deals within the given pipeline will be returned (optional) + * @param int|null $stage_id Only deals within the given stage will be returned (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request - * @deprecated */ - public function searchDealsRequest($term, $fields = null, $exact_match = null, $person_id = null, $organization_id = null, $status = null, $include_fields = null, $start = 0, $limit = null): Request + public function getDealsSummaryRequest($status = null, $filter_id = null, $user_id = null, $pipeline_id = null, $stage_id = null): Request { - // verify the required parameter 'term' is set - /* @phpstan-ignore-next-line */ - if ($term === null || (is_array($term) && count($term) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $term when calling searchDeals' - ); - } - $resourcePath = '/deals/search'; + $resourcePath = '/deals/summary'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - /* @phpstan-ignore-next-line */ - if (is_array($term)) { - $term = ObjectSerializer::serializeCollection($term, '', true); - } - if ($term !== null) { - $queryParams['term'] = $term; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($fields)) { - $fields = ObjectSerializer::serializeCollection($fields, '', true); - } - if ($fields !== null) { - $queryParams['fields'] = $fields; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($exact_match)) { - $exact_match = ObjectSerializer::serializeCollection($exact_match, '', true); - } - if ($exact_match !== null) { - $queryParams['exact_match'] = $exact_match; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($person_id)) { - $person_id = ObjectSerializer::serializeCollection($person_id, '', true); - } - if ($person_id !== null) { - $queryParams['person_id'] = $person_id; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($organization_id)) { - $organization_id = ObjectSerializer::serializeCollection($organization_id, '', true); - } - if ($organization_id !== null) { - $queryParams['organization_id'] = $organization_id; - } // query params /* @phpstan-ignore-next-line */ if (is_array($status)) { @@ -10141,27 +5675,35 @@ public function searchDealsRequest($term, $fields = null, $exact_match = null, $ } // query params /* @phpstan-ignore-next-line */ - if (is_array($include_fields)) { - $include_fields = ObjectSerializer::serializeCollection($include_fields, '', true); + if (is_array($filter_id)) { + $filter_id = ObjectSerializer::serializeCollection($filter_id, '', true); } - if ($include_fields !== null) { - $queryParams['include_fields'] = $include_fields; + if ($filter_id !== null) { + $queryParams['filter_id'] = $filter_id; } // query params /* @phpstan-ignore-next-line */ - if (is_array($start)) { - $start = ObjectSerializer::serializeCollection($start, '', true); + if (is_array($user_id)) { + $user_id = ObjectSerializer::serializeCollection($user_id, '', true); } - if ($start !== null) { - $queryParams['start'] = $start; + if ($user_id !== null) { + $queryParams['user_id'] = $user_id; } // query params /* @phpstan-ignore-next-line */ - if (is_array($limit)) { - $limit = ObjectSerializer::serializeCollection($limit, '', true); + if (is_array($pipeline_id)) { + $pipeline_id = ObjectSerializer::serializeCollection($pipeline_id, '', true); + } + if ($pipeline_id !== null) { + $queryParams['pipeline_id'] = $pipeline_id; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($stage_id)) { + $stage_id = ObjectSerializer::serializeCollection($stage_id, '', true); } - if ($limit !== null) { - $queryParams['limit'] = $limit; + if ($stage_id !== null) { + $queryParams['stage_id'] = $stage_id; } @@ -10240,40 +5782,52 @@ public function searchDealsRequest($term, $fields = null, $exact_match = null, $ } /** - * Operation updateDeal + * Operation getDealsTimeline * - * Update a deal + * Get deals timeline * - * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v1\Model\UpdateDealRequest|null $update_deal_request update_deal_request (optional) + * @param \DateTime $start_date The date when the first interval starts. Format: YYYY-MM-DD. (required) + * @param string $interval The type of the interval<table><tr><th>Value</th><th>Description</th></tr><tr><td>`day`</td><td>Day</td></tr><tr><td>`week`</td><td>A full week (7 days) starting from `start_date`</td></tr><tr><td>`month`</td><td>A full month (depending on the number of days in given month) starting from `start_date`</td></tr><tr><td>`quarter`</td><td>A full quarter (3 months) starting from `start_date`</td></tr></table> (required) + * @param int $amount The number of given intervals, starting from `start_date`, to fetch. E.g. 3 (months). (required) + * @param string $field_key The date field key which deals will be retrieved from (required) + * @param int|null $user_id If supplied, only deals matching the given user will be returned (optional) + * @param int|null $pipeline_id If supplied, only deals matching the given pipeline will be returned (optional) + * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $exclude_deals Whether to exclude deals list (1) or not (0). Note that when deals are excluded, the timeline summary (counts and values) is still returned. (optional) + * @param string|null $totals_convert_currency The 3-letter currency code of any of the supported currencies. When supplied, `totals_converted` is returned per each interval which contains the currency-converted total amounts in the given currency. You may also set this parameter to `default_currency` in which case the user's default currency is used. (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\GetAddedDeal - * @deprecated + * @return \Pipedrive\versions\v1\Model\GetDealsTimeline */ - public function updateDeal($id, $update_deal_request = null) + public function getDealsTimeline($start_date, $interval, $amount, $field_key, $user_id = null, $pipeline_id = null, $filter_id = null, $exclude_deals = null, $totals_convert_currency = null) { - list($response) = $this->updateDealWithHttpInfo($id, $update_deal_request); + list($response) = $this->getDealsTimelineWithHttpInfo($start_date, $interval, $amount, $field_key, $user_id, $pipeline_id, $filter_id, $exclude_deals, $totals_convert_currency); return $response; } /** - * Operation updateDealWithHttpInfo + * Operation getDealsTimelineWithHttpInfo * - * Update a deal + * Get deals timeline * - * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v1\Model\UpdateDealRequest|null $update_deal_request (optional) + * @param \DateTime $start_date The date when the first interval starts. Format: YYYY-MM-DD. (required) + * @param string $interval The type of the interval<table><tr><th>Value</th><th>Description</th></tr><tr><td>`day`</td><td>Day</td></tr><tr><td>`week`</td><td>A full week (7 days) starting from `start_date`</td></tr><tr><td>`month`</td><td>A full month (depending on the number of days in given month) starting from `start_date`</td></tr><tr><td>`quarter`</td><td>A full quarter (3 months) starting from `start_date`</td></tr></table> (required) + * @param int $amount The number of given intervals, starting from `start_date`, to fetch. E.g. 3 (months). (required) + * @param string $field_key The date field key which deals will be retrieved from (required) + * @param int|null $user_id If supplied, only deals matching the given user will be returned (optional) + * @param int|null $pipeline_id If supplied, only deals matching the given pipeline will be returned (optional) + * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $exclude_deals Whether to exclude deals list (1) or not (0). Note that when deals are excluded, the timeline summary (counts and values) is still returned. (optional) + * @param string|null $totals_convert_currency The 3-letter currency code of any of the supported currencies. When supplied, `totals_converted` is returned per each interval which contains the currency-converted total amounts in the given currency. You may also set this parameter to `default_currency` in which case the user's default currency is used. (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\GetAddedDeal, HTTP status code, HTTP response headers (array of strings) - * @deprecated + * @return array of \Pipedrive\versions\v1\Model\GetDealsTimeline, HTTP status code, HTTP response headers (array of strings) */ - public function updateDealWithHttpInfo($id, $update_deal_request = null) + public function getDealsTimelineWithHttpInfo($start_date, $interval, $amount, $field_key, $user_id = null, $pipeline_id = null, $filter_id = null, $exclude_deals = null, $totals_convert_currency = null) { - $request = $this->updateDealRequest($id, $update_deal_request); + $request = $this->getDealsTimelineRequest($start_date, $interval, $amount, $field_key, $user_id, $pipeline_id, $filter_id, $exclude_deals, $totals_convert_currency); try { $options = $this->createHttpClientOption(); @@ -10282,7 +5836,7 @@ public function updateDealWithHttpInfo($id, $update_deal_request = null) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->updateDealRequest($id, $update_deal_request); + $request = $this->getDealsTimelineRequest($start_date, $interval, $amount, $field_key, $user_id, $pipeline_id, $filter_id, $exclude_deals, $totals_convert_currency); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -10307,14 +5861,14 @@ public function updateDealWithHttpInfo($id, $update_deal_request = null) switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetAddedDeal' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\GetDealsTimeline' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetAddedDeal', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDealsTimeline', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -10334,14 +5888,14 @@ public function updateDealWithHttpInfo($id, $update_deal_request = null) } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetAddedDeal' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\GetDealsTimeline' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetAddedDeal', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDealsTimeline', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -10351,7 +5905,7 @@ public function updateDealWithHttpInfo($id, $update_deal_request = null) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\GetAddedDeal', + '\Pipedrive\versions\v1\Model\GetDealsTimeline', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -10362,20 +5916,26 @@ public function updateDealWithHttpInfo($id, $update_deal_request = null) } /** - * Operation updateDealAsync + * Operation getDealsTimelineAsync * - * Update a deal + * Get deals timeline * - * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v1\Model\UpdateDealRequest|null $update_deal_request (optional) + * @param \DateTime $start_date The date when the first interval starts. Format: YYYY-MM-DD. (required) + * @param string $interval The type of the interval<table><tr><th>Value</th><th>Description</th></tr><tr><td>`day`</td><td>Day</td></tr><tr><td>`week`</td><td>A full week (7 days) starting from `start_date`</td></tr><tr><td>`month`</td><td>A full month (depending on the number of days in given month) starting from `start_date`</td></tr><tr><td>`quarter`</td><td>A full quarter (3 months) starting from `start_date`</td></tr></table> (required) + * @param int $amount The number of given intervals, starting from `start_date`, to fetch. E.g. 3 (months). (required) + * @param string $field_key The date field key which deals will be retrieved from (required) + * @param int|null $user_id If supplied, only deals matching the given user will be returned (optional) + * @param int|null $pipeline_id If supplied, only deals matching the given pipeline will be returned (optional) + * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $exclude_deals Whether to exclude deals list (1) or not (0). Note that when deals are excluded, the timeline summary (counts and values) is still returned. (optional) + * @param string|null $totals_convert_currency The 3-letter currency code of any of the supported currencies. When supplied, `totals_converted` is returned per each interval which contains the currency-converted total amounts in the given currency. You may also set this parameter to `default_currency` in which case the user's default currency is used. (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function updateDealAsync($id, $update_deal_request = null): PromiseInterface + public function getDealsTimelineAsync($start_date, $interval, $amount, $field_key, $user_id = null, $pipeline_id = null, $filter_id = null, $exclude_deals = null, $totals_convert_currency = null): PromiseInterface { - return $this->updateDealAsyncWithHttpInfo($id, $update_deal_request) + return $this->getDealsTimelineAsyncWithHttpInfo($start_date, $interval, $amount, $field_key, $user_id, $pipeline_id, $filter_id, $exclude_deals, $totals_convert_currency) ->then( function ($response) { return $response[0]; @@ -10384,21 +5944,27 @@ function ($response) { } /** - * Operation updateDealAsyncWithHttpInfo + * Operation getDealsTimelineAsyncWithHttpInfo * - * Update a deal + * Get deals timeline * - * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v1\Model\UpdateDealRequest|null $update_deal_request (optional) + * @param \DateTime $start_date The date when the first interval starts. Format: YYYY-MM-DD. (required) + * @param string $interval The type of the interval<table><tr><th>Value</th><th>Description</th></tr><tr><td>`day`</td><td>Day</td></tr><tr><td>`week`</td><td>A full week (7 days) starting from `start_date`</td></tr><tr><td>`month`</td><td>A full month (depending on the number of days in given month) starting from `start_date`</td></tr><tr><td>`quarter`</td><td>A full quarter (3 months) starting from `start_date`</td></tr></table> (required) + * @param int $amount The number of given intervals, starting from `start_date`, to fetch. E.g. 3 (months). (required) + * @param string $field_key The date field key which deals will be retrieved from (required) + * @param int|null $user_id If supplied, only deals matching the given user will be returned (optional) + * @param int|null $pipeline_id If supplied, only deals matching the given pipeline will be returned (optional) + * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $exclude_deals Whether to exclude deals list (1) or not (0). Note that when deals are excluded, the timeline summary (counts and values) is still returned. (optional) + * @param string|null $totals_convert_currency The 3-letter currency code of any of the supported currencies. When supplied, `totals_converted` is returned per each interval which contains the currency-converted total amounts in the given currency. You may also set this parameter to `default_currency` in which case the user's default currency is used. (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function updateDealAsyncWithHttpInfo($id, $update_deal_request = null): PromiseInterface + public function getDealsTimelineAsyncWithHttpInfo($start_date, $interval, $amount, $field_key, $user_id = null, $pipeline_id = null, $filter_id = null, $exclude_deals = null, $totals_convert_currency = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\GetAddedDeal'; - $request = $this->updateDealRequest($id, $update_deal_request); + $returnType = '\Pipedrive\versions\v1\Model\GetDealsTimeline'; + $request = $this->getDealsTimelineRequest($start_date, $interval, $amount, $field_key, $user_id, $pipeline_id, $filter_id, $exclude_deals, $totals_convert_currency); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -10435,42 +6001,133 @@ function ($exception) { } /** - * Create request for operation 'updateDeal' + * Create request for operation 'getDealsTimeline' * - * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v1\Model\UpdateDealRequest|null $update_deal_request (optional) + * @param \DateTime $start_date The date when the first interval starts. Format: YYYY-MM-DD. (required) + * @param string $interval The type of the interval<table><tr><th>Value</th><th>Description</th></tr><tr><td>`day`</td><td>Day</td></tr><tr><td>`week`</td><td>A full week (7 days) starting from `start_date`</td></tr><tr><td>`month`</td><td>A full month (depending on the number of days in given month) starting from `start_date`</td></tr><tr><td>`quarter`</td><td>A full quarter (3 months) starting from `start_date`</td></tr></table> (required) + * @param int $amount The number of given intervals, starting from `start_date`, to fetch. E.g. 3 (months). (required) + * @param string $field_key The date field key which deals will be retrieved from (required) + * @param int|null $user_id If supplied, only deals matching the given user will be returned (optional) + * @param int|null $pipeline_id If supplied, only deals matching the given pipeline will be returned (optional) + * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $exclude_deals Whether to exclude deals list (1) or not (0). Note that when deals are excluded, the timeline summary (counts and values) is still returned. (optional) + * @param string|null $totals_convert_currency The 3-letter currency code of any of the supported currencies. When supplied, `totals_converted` is returned per each interval which contains the currency-converted total amounts in the given currency. You may also set this parameter to `default_currency` in which case the user's default currency is used. (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request - * @deprecated */ - public function updateDealRequest($id, $update_deal_request = null): Request + public function getDealsTimelineRequest($start_date, $interval, $amount, $field_key, $user_id = null, $pipeline_id = null, $filter_id = null, $exclude_deals = null, $totals_convert_currency = null): Request { - // verify the required parameter 'id' is set + // verify the required parameter 'start_date' is set /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { + if ($start_date === null || (is_array($start_date) && count($start_date) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $start_date when calling getDealsTimeline' + ); + } + // verify the required parameter 'interval' is set + /* @phpstan-ignore-next-line */ + if ($interval === null || (is_array($interval) && count($interval) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $interval when calling getDealsTimeline' + ); + } + // verify the required parameter 'amount' is set + /* @phpstan-ignore-next-line */ + if ($amount === null || (is_array($amount) && count($amount) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $amount when calling getDealsTimeline' + ); + } + // verify the required parameter 'field_key' is set + /* @phpstan-ignore-next-line */ + if ($field_key === null || (is_array($field_key) && count($field_key) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling updateDeal' + 'Missing the required parameter $field_key when calling getDealsTimeline' ); } - $resourcePath = '/deals/{id}'; + $resourcePath = '/deals/timeline'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; + // query params + /* @phpstan-ignore-next-line */ + if (is_array($start_date)) { + $start_date = ObjectSerializer::serializeCollection($start_date, '', true); + } + if ($start_date !== null) { + $queryParams['start_date'] = $start_date; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($interval)) { + $interval = ObjectSerializer::serializeCollection($interval, '', true); + } + if ($interval !== null) { + $queryParams['interval'] = $interval; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($amount)) { + $amount = ObjectSerializer::serializeCollection($amount, '', true); + } + if ($amount !== null) { + $queryParams['amount'] = $amount; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($field_key)) { + $field_key = ObjectSerializer::serializeCollection($field_key, '', true); + } + if ($field_key !== null) { + $queryParams['field_key'] = $field_key; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($user_id)) { + $user_id = ObjectSerializer::serializeCollection($user_id, '', true); + } + if ($user_id !== null) { + $queryParams['user_id'] = $user_id; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($pipeline_id)) { + $pipeline_id = ObjectSerializer::serializeCollection($pipeline_id, '', true); + } + if ($pipeline_id !== null) { + $queryParams['pipeline_id'] = $pipeline_id; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($filter_id)) { + $filter_id = ObjectSerializer::serializeCollection($filter_id, '', true); + } + if ($filter_id !== null) { + $queryParams['filter_id'] = $filter_id; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($exclude_deals)) { + $exclude_deals = ObjectSerializer::serializeCollection($exclude_deals, '', true); + } + if ($exclude_deals !== null) { + $queryParams['exclude_deals'] = $exclude_deals; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($totals_convert_currency)) { + $totals_convert_currency = ObjectSerializer::serializeCollection($totals_convert_currency, '', true); + } + if ($totals_convert_currency !== null) { + $queryParams['totals_convert_currency'] = $totals_convert_currency; + } - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } /* @phpstan-ignore-next-line */ @@ -10481,18 +6138,12 @@ public function updateDealRequest($id, $update_deal_request = null): Request } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - ['application/json'] + [] ); } // for model (json/xml) - if (isset($update_deal_request)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_deal_request)); - } else { - $httpBody = $update_deal_request; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { /* @phpstan-ignore-next-line */ if ($multipart) { $multipartContents = []; @@ -10544,7 +6195,7 @@ public function updateDealRequest($id, $update_deal_request = null): Request $query = Query::build($queryParams); return new Request( - 'PUT', + 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -10552,42 +6203,38 @@ public function updateDealRequest($id, $update_deal_request = null): Request } /** - * Operation updateDealProduct + * Operation mergeDeals * - * Update the product attached to a deal + * Merge two deals * * @param int $id The ID of the deal (required) - * @param int $product_attachment_id The ID of the deal-product (the ID of the product attached to the deal) (required) - * @param \Pipedrive\versions\v1\Model\UpdateDealProduct|null $update_deal_product update_deal_product (optional) + * @param \Pipedrive\versions\v1\Model\MergeDealsRequest|null $merge_deals_request merge_deals_request (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\GetProductAttachmentDetails - * @deprecated + * @return \Pipedrive\versions\v1\Model\GetMergedDeal */ - public function updateDealProduct($id, $product_attachment_id, $update_deal_product = null) + public function mergeDeals($id, $merge_deals_request = null) { - list($response) = $this->updateDealProductWithHttpInfo($id, $product_attachment_id, $update_deal_product); + list($response) = $this->mergeDealsWithHttpInfo($id, $merge_deals_request); return $response; } /** - * Operation updateDealProductWithHttpInfo + * Operation mergeDealsWithHttpInfo * - * Update the product attached to a deal + * Merge two deals * * @param int $id The ID of the deal (required) - * @param int $product_attachment_id The ID of the deal-product (the ID of the product attached to the deal) (required) - * @param \Pipedrive\versions\v1\Model\UpdateDealProduct|null $update_deal_product (optional) + * @param \Pipedrive\versions\v1\Model\MergeDealsRequest|null $merge_deals_request (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\GetProductAttachmentDetails, HTTP status code, HTTP response headers (array of strings) - * @deprecated + * @return array of \Pipedrive\versions\v1\Model\GetMergedDeal, HTTP status code, HTTP response headers (array of strings) */ - public function updateDealProductWithHttpInfo($id, $product_attachment_id, $update_deal_product = null) + public function mergeDealsWithHttpInfo($id, $merge_deals_request = null) { - $request = $this->updateDealProductRequest($id, $product_attachment_id, $update_deal_product); + $request = $this->mergeDealsRequest($id, $merge_deals_request); try { $options = $this->createHttpClientOption(); @@ -10596,7 +6243,7 @@ public function updateDealProductWithHttpInfo($id, $product_attachment_id, $upda } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->updateDealProductRequest($id, $product_attachment_id, $update_deal_product); + $request = $this->mergeDealsRequest($id, $merge_deals_request); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -10621,14 +6268,14 @@ public function updateDealProductWithHttpInfo($id, $product_attachment_id, $upda switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetProductAttachmentDetails' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\GetMergedDeal' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetProductAttachmentDetails', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetMergedDeal', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -10648,14 +6295,14 @@ public function updateDealProductWithHttpInfo($id, $product_attachment_id, $upda } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetProductAttachmentDetails' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\GetMergedDeal' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetProductAttachmentDetails', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetMergedDeal', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -10665,7 +6312,7 @@ public function updateDealProductWithHttpInfo($id, $product_attachment_id, $upda case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\GetProductAttachmentDetails', + '\Pipedrive\versions\v1\Model\GetMergedDeal', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -10676,21 +6323,19 @@ public function updateDealProductWithHttpInfo($id, $product_attachment_id, $upda } /** - * Operation updateDealProductAsync + * Operation mergeDealsAsync * - * Update the product attached to a deal + * Merge two deals * * @param int $id The ID of the deal (required) - * @param int $product_attachment_id The ID of the deal-product (the ID of the product attached to the deal) (required) - * @param \Pipedrive\versions\v1\Model\UpdateDealProduct|null $update_deal_product (optional) + * @param \Pipedrive\versions\v1\Model\MergeDealsRequest|null $merge_deals_request (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function updateDealProductAsync($id, $product_attachment_id, $update_deal_product = null): PromiseInterface + public function mergeDealsAsync($id, $merge_deals_request = null): PromiseInterface { - return $this->updateDealProductAsyncWithHttpInfo($id, $product_attachment_id, $update_deal_product) + return $this->mergeDealsAsyncWithHttpInfo($id, $merge_deals_request) ->then( function ($response) { return $response[0]; @@ -10699,22 +6344,20 @@ function ($response) { } /** - * Operation updateDealProductAsyncWithHttpInfo + * Operation mergeDealsAsyncWithHttpInfo * - * Update the product attached to a deal + * Merge two deals * * @param int $id The ID of the deal (required) - * @param int $product_attachment_id The ID of the deal-product (the ID of the product attached to the deal) (required) - * @param \Pipedrive\versions\v1\Model\UpdateDealProduct|null $update_deal_product (optional) + * @param \Pipedrive\versions\v1\Model\MergeDealsRequest|null $merge_deals_request (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function updateDealProductAsyncWithHttpInfo($id, $product_attachment_id, $update_deal_product = null): PromiseInterface + public function mergeDealsAsyncWithHttpInfo($id, $merge_deals_request = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\GetProductAttachmentDetails'; - $request = $this->updateDealProductRequest($id, $product_attachment_id, $update_deal_product); + $returnType = '\Pipedrive\versions\v1\Model\GetMergedDeal'; + $request = $this->mergeDealsRequest($id, $merge_deals_request); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -10751,34 +6394,25 @@ function ($exception) { } /** - * Create request for operation 'updateDealProduct' + * Create request for operation 'mergeDeals' * * @param int $id The ID of the deal (required) - * @param int $product_attachment_id The ID of the deal-product (the ID of the product attached to the deal) (required) - * @param \Pipedrive\versions\v1\Model\UpdateDealProduct|null $update_deal_product (optional) + * @param \Pipedrive\versions\v1\Model\MergeDealsRequest|null $merge_deals_request (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request - * @deprecated */ - public function updateDealProductRequest($id, $product_attachment_id, $update_deal_product = null): Request + public function mergeDealsRequest($id, $merge_deals_request = null): Request { // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling updateDealProduct' - ); - } - // verify the required parameter 'product_attachment_id' is set - /* @phpstan-ignore-next-line */ - if ($product_attachment_id === null || (is_array($product_attachment_id) && count($product_attachment_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $product_attachment_id when calling updateDealProduct' + 'Missing the required parameter $id when calling mergeDeals' ); } - $resourcePath = '/deals/{id}/products/{product_attachment_id}'; + $resourcePath = '/deals/{id}/merge'; $formParams = []; $queryParams = []; $headerParams = []; @@ -10795,14 +6429,6 @@ public function updateDealProductRequest($id, $product_attachment_id, $update_de $resourcePath ); } - // path params - if ($product_attachment_id !== null) { - $resourcePath = str_replace( - '{' . 'product_attachment_id' . '}', - ObjectSerializer::toPathValue($product_attachment_id), - $resourcePath - ); - } /* @phpstan-ignore-next-line */ @@ -10818,11 +6444,11 @@ public function updateDealProductRequest($id, $product_attachment_id, $update_de } // for model (json/xml) - if (isset($update_deal_product)) { + if (isset($merge_deals_request)) { if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_deal_product)); + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($merge_deals_request)); } else { - $httpBody = $update_deal_product; + $httpBody = $merge_deals_request; } } elseif (count($formParams) > 0) { /* @phpstan-ignore-next-line */ diff --git a/lib/versions/v1/Api/OrganizationsApi.php b/lib/versions/v1/Api/OrganizationsApi.php index 7f068258..c7ff9164 100644 --- a/lib/versions/v1/Api/OrganizationsApi.php +++ b/lib/versions/v1/Api/OrganizationsApi.php @@ -123,38 +123,38 @@ public function getConfig(): Configuration } /** - * Operation addOrganization + * Operation addOrganizationFollower * - * Add an organization + * Add a follower to an organization * - * @param \Pipedrive\versions\v1\Model\NewOrganization|null $new_organization new_organization (optional) + * @param int $id The ID of the organization (required) + * @param \Pipedrive\versions\v1\Model\AddOrganizationFollowerRequest|null $add_organization_follower_request add_organization_follower_request (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\OrganizationPostResponse - * @deprecated + * @return \Pipedrive\versions\v1\Model\OrganizationFollowerPostResponse */ - public function addOrganization($new_organization = null) + public function addOrganizationFollower($id, $add_organization_follower_request = null) { - list($response) = $this->addOrganizationWithHttpInfo($new_organization); + list($response) = $this->addOrganizationFollowerWithHttpInfo($id, $add_organization_follower_request); return $response; } /** - * Operation addOrganizationWithHttpInfo + * Operation addOrganizationFollowerWithHttpInfo * - * Add an organization + * Add a follower to an organization * - * @param \Pipedrive\versions\v1\Model\NewOrganization|null $new_organization (optional) + * @param int $id The ID of the organization (required) + * @param \Pipedrive\versions\v1\Model\AddOrganizationFollowerRequest|null $add_organization_follower_request (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\OrganizationPostResponse, HTTP status code, HTTP response headers (array of strings) - * @deprecated + * @return array of \Pipedrive\versions\v1\Model\OrganizationFollowerPostResponse, HTTP status code, HTTP response headers (array of strings) */ - public function addOrganizationWithHttpInfo($new_organization = null) + public function addOrganizationFollowerWithHttpInfo($id, $add_organization_follower_request = null) { - $request = $this->addOrganizationRequest($new_organization); + $request = $this->addOrganizationFollowerRequest($id, $add_organization_follower_request); try { $options = $this->createHttpClientOption(); @@ -163,7 +163,7 @@ public function addOrganizationWithHttpInfo($new_organization = null) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->addOrganizationRequest($new_organization); + $request = $this->addOrganizationFollowerRequest($id, $add_organization_follower_request); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -186,16 +186,16 @@ public function addOrganizationWithHttpInfo($new_organization = null) switch($statusCode) { - case 201: + case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\OrganizationPostResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\OrganizationFollowerPostResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\OrganizationPostResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\OrganizationFollowerPostResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -215,24 +215,24 @@ public function addOrganizationWithHttpInfo($new_organization = null) } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\OrganizationPostResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\OrganizationFollowerPostResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\OrganizationPostResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\OrganizationFollowerPostResponse', []), $response->getStatusCode(), $response->getHeaders() ]; } catch (ApiException $e) { switch ($e->getCode()) { - case 201: + case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\OrganizationPostResponse', + '\Pipedrive\versions\v1\Model\OrganizationFollowerPostResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -243,19 +243,19 @@ public function addOrganizationWithHttpInfo($new_organization = null) } /** - * Operation addOrganizationAsync + * Operation addOrganizationFollowerAsync * - * Add an organization + * Add a follower to an organization * - * @param \Pipedrive\versions\v1\Model\NewOrganization|null $new_organization (optional) + * @param int $id The ID of the organization (required) + * @param \Pipedrive\versions\v1\Model\AddOrganizationFollowerRequest|null $add_organization_follower_request (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function addOrganizationAsync($new_organization = null): PromiseInterface + public function addOrganizationFollowerAsync($id, $add_organization_follower_request = null): PromiseInterface { - return $this->addOrganizationAsyncWithHttpInfo($new_organization) + return $this->addOrganizationFollowerAsyncWithHttpInfo($id, $add_organization_follower_request) ->then( function ($response) { return $response[0]; @@ -264,20 +264,20 @@ function ($response) { } /** - * Operation addOrganizationAsyncWithHttpInfo + * Operation addOrganizationFollowerAsyncWithHttpInfo * - * Add an organization + * Add a follower to an organization * - * @param \Pipedrive\versions\v1\Model\NewOrganization|null $new_organization (optional) + * @param int $id The ID of the organization (required) + * @param \Pipedrive\versions\v1\Model\AddOrganizationFollowerRequest|null $add_organization_follower_request (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function addOrganizationAsyncWithHttpInfo($new_organization = null): PromiseInterface + public function addOrganizationFollowerAsyncWithHttpInfo($id, $add_organization_follower_request = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\OrganizationPostResponse'; - $request = $this->addOrganizationRequest($new_organization); + $returnType = '\Pipedrive\versions\v1\Model\OrganizationFollowerPostResponse'; + $request = $this->addOrganizationFollowerRequest($id, $add_organization_follower_request); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -314,18 +314,25 @@ function ($exception) { } /** - * Create request for operation 'addOrganization' + * Create request for operation 'addOrganizationFollower' * - * @param \Pipedrive\versions\v1\Model\NewOrganization|null $new_organization (optional) + * @param int $id The ID of the organization (required) + * @param \Pipedrive\versions\v1\Model\AddOrganizationFollowerRequest|null $add_organization_follower_request (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request - * @deprecated */ - public function addOrganizationRequest($new_organization = null): Request + public function addOrganizationFollowerRequest($id, $add_organization_follower_request = null): Request { + // verify the required parameter 'id' is set + /* @phpstan-ignore-next-line */ + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling addOrganizationFollower' + ); + } - $resourcePath = '/organizations'; + $resourcePath = '/organizations/{id}/followers'; $formParams = []; $queryParams = []; $headerParams = []; @@ -334,6 +341,14 @@ public function addOrganizationRequest($new_organization = null): Request + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } /* @phpstan-ignore-next-line */ @@ -349,11 +364,11 @@ public function addOrganizationRequest($new_organization = null): Request } // for model (json/xml) - if (isset($new_organization)) { + if (isset($add_organization_follower_request)) { if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($new_organization)); + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($add_organization_follower_request)); } else { - $httpBody = $new_organization; + $httpBody = $add_organization_follower_request; } } elseif (count($formParams) > 0) { /* @phpstan-ignore-next-line */ @@ -415,38 +430,38 @@ public function addOrganizationRequest($new_organization = null): Request } /** - * Operation addOrganizationFollower + * Operation deleteOrganizationFollower * - * Add a follower to an organization + * Delete a follower from an organization * * @param int $id The ID of the organization (required) - * @param \Pipedrive\versions\v1\Model\AddOrganizationFollowerRequest|null $add_organization_follower_request add_organization_follower_request (optional) + * @param int $follower_id The ID of the relationship between the follower and the organization (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\OrganizationFollowerPostResponse + * @return \Pipedrive\versions\v1\Model\OrganizationFollowerDeleteResponse */ - public function addOrganizationFollower($id, $add_organization_follower_request = null) + public function deleteOrganizationFollower($id, $follower_id) { - list($response) = $this->addOrganizationFollowerWithHttpInfo($id, $add_organization_follower_request); + list($response) = $this->deleteOrganizationFollowerWithHttpInfo($id, $follower_id); return $response; } /** - * Operation addOrganizationFollowerWithHttpInfo + * Operation deleteOrganizationFollowerWithHttpInfo * - * Add a follower to an organization + * Delete a follower from an organization * * @param int $id The ID of the organization (required) - * @param \Pipedrive\versions\v1\Model\AddOrganizationFollowerRequest|null $add_organization_follower_request (optional) + * @param int $follower_id The ID of the relationship between the follower and the organization (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\OrganizationFollowerPostResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v1\Model\OrganizationFollowerDeleteResponse, HTTP status code, HTTP response headers (array of strings) */ - public function addOrganizationFollowerWithHttpInfo($id, $add_organization_follower_request = null) + public function deleteOrganizationFollowerWithHttpInfo($id, $follower_id) { - $request = $this->addOrganizationFollowerRequest($id, $add_organization_follower_request); + $request = $this->deleteOrganizationFollowerRequest($id, $follower_id); try { $options = $this->createHttpClientOption(); @@ -455,7 +470,7 @@ public function addOrganizationFollowerWithHttpInfo($id, $add_organization_follo } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->addOrganizationFollowerRequest($id, $add_organization_follower_request); + $request = $this->deleteOrganizationFollowerRequest($id, $follower_id); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -480,14 +495,14 @@ public function addOrganizationFollowerWithHttpInfo($id, $add_organization_follo switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\OrganizationFollowerPostResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\OrganizationFollowerDeleteResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\OrganizationFollowerPostResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\OrganizationFollowerDeleteResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -507,14 +522,14 @@ public function addOrganizationFollowerWithHttpInfo($id, $add_organization_follo } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\OrganizationFollowerPostResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\OrganizationFollowerDeleteResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\OrganizationFollowerPostResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\OrganizationFollowerDeleteResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -524,7 +539,7 @@ public function addOrganizationFollowerWithHttpInfo($id, $add_organization_follo case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\OrganizationFollowerPostResponse', + '\Pipedrive\versions\v1\Model\OrganizationFollowerDeleteResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -535,19 +550,19 @@ public function addOrganizationFollowerWithHttpInfo($id, $add_organization_follo } /** - * Operation addOrganizationFollowerAsync + * Operation deleteOrganizationFollowerAsync * - * Add a follower to an organization + * Delete a follower from an organization * * @param int $id The ID of the organization (required) - * @param \Pipedrive\versions\v1\Model\AddOrganizationFollowerRequest|null $add_organization_follower_request (optional) + * @param int $follower_id The ID of the relationship between the follower and the organization (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function addOrganizationFollowerAsync($id, $add_organization_follower_request = null): PromiseInterface + public function deleteOrganizationFollowerAsync($id, $follower_id): PromiseInterface { - return $this->addOrganizationFollowerAsyncWithHttpInfo($id, $add_organization_follower_request) + return $this->deleteOrganizationFollowerAsyncWithHttpInfo($id, $follower_id) ->then( function ($response) { return $response[0]; @@ -556,20 +571,20 @@ function ($response) { } /** - * Operation addOrganizationFollowerAsyncWithHttpInfo + * Operation deleteOrganizationFollowerAsyncWithHttpInfo * - * Add a follower to an organization + * Delete a follower from an organization * * @param int $id The ID of the organization (required) - * @param \Pipedrive\versions\v1\Model\AddOrganizationFollowerRequest|null $add_organization_follower_request (optional) + * @param int $follower_id The ID of the relationship between the follower and the organization (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function addOrganizationFollowerAsyncWithHttpInfo($id, $add_organization_follower_request = null): PromiseInterface + public function deleteOrganizationFollowerAsyncWithHttpInfo($id, $follower_id): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\OrganizationFollowerPostResponse'; - $request = $this->addOrganizationFollowerRequest($id, $add_organization_follower_request); + $returnType = '\Pipedrive\versions\v1\Model\OrganizationFollowerDeleteResponse'; + $request = $this->deleteOrganizationFollowerRequest($id, $follower_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -606,25 +621,32 @@ function ($exception) { } /** - * Create request for operation 'addOrganizationFollower' + * Create request for operation 'deleteOrganizationFollower' * * @param int $id The ID of the organization (required) - * @param \Pipedrive\versions\v1\Model\AddOrganizationFollowerRequest|null $add_organization_follower_request (optional) + * @param int $follower_id The ID of the relationship between the follower and the organization (required) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function addOrganizationFollowerRequest($id, $add_organization_follower_request = null): Request + public function deleteOrganizationFollowerRequest($id, $follower_id): Request { // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling addOrganizationFollower' + 'Missing the required parameter $id when calling deleteOrganizationFollower' + ); + } + // verify the required parameter 'follower_id' is set + /* @phpstan-ignore-next-line */ + if ($follower_id === null || (is_array($follower_id) && count($follower_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $follower_id when calling deleteOrganizationFollower' ); } - $resourcePath = '/organizations/{id}/followers'; + $resourcePath = '/organizations/{id}/followers/{follower_id}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -641,6 +663,14 @@ public function addOrganizationFollowerRequest($id, $add_organization_follower_r $resourcePath ); } + // path params + if ($follower_id !== null) { + $resourcePath = str_replace( + '{' . 'follower_id' . '}', + ObjectSerializer::toPathValue($follower_id), + $resourcePath + ); + } /* @phpstan-ignore-next-line */ @@ -651,18 +681,12 @@ public function addOrganizationFollowerRequest($id, $add_organization_follower_r } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - ['application/json'] + [] ); } // for model (json/xml) - if (isset($add_organization_follower_request)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($add_organization_follower_request)); - } else { - $httpBody = $add_organization_follower_request; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { /* @phpstan-ignore-next-line */ if ($multipart) { $multipartContents = []; @@ -714,7 +738,7 @@ public function addOrganizationFollowerRequest($id, $add_organization_follower_r $query = Query::build($queryParams); return new Request( - 'POST', + 'DELETE', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -722,38 +746,40 @@ public function addOrganizationFollowerRequest($id, $add_organization_follower_r } /** - * Operation deleteOrganization + * Operation getOrganizationChangelog * - * Delete an organization + * List updates about organization field values * * @param int $id The ID of the organization (required) + * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) + * @param int|null $limit Items shown per page (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\OrganizationDeleteResponse - * @deprecated + * @return \Pipedrive\versions\v1\Model\ChangelogResponse */ - public function deleteOrganization($id) + public function getOrganizationChangelog($id, $cursor = null, $limit = null) { - list($response) = $this->deleteOrganizationWithHttpInfo($id); + list($response) = $this->getOrganizationChangelogWithHttpInfo($id, $cursor, $limit); return $response; } /** - * Operation deleteOrganizationWithHttpInfo + * Operation getOrganizationChangelogWithHttpInfo * - * Delete an organization + * List updates about organization field values * * @param int $id The ID of the organization (required) + * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) + * @param int|null $limit Items shown per page (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\OrganizationDeleteResponse, HTTP status code, HTTP response headers (array of strings) - * @deprecated + * @return array of \Pipedrive\versions\v1\Model\ChangelogResponse, HTTP status code, HTTP response headers (array of strings) */ - public function deleteOrganizationWithHttpInfo($id) + public function getOrganizationChangelogWithHttpInfo($id, $cursor = null, $limit = null) { - $request = $this->deleteOrganizationRequest($id); + $request = $this->getOrganizationChangelogRequest($id, $cursor, $limit); try { $options = $this->createHttpClientOption(); @@ -762,7 +788,7 @@ public function deleteOrganizationWithHttpInfo($id) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->deleteOrganizationRequest($id); + $request = $this->getOrganizationChangelogRequest($id, $cursor, $limit); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -787,14 +813,14 @@ public function deleteOrganizationWithHttpInfo($id) switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\OrganizationDeleteResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ChangelogResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\OrganizationDeleteResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ChangelogResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -814,14 +840,14 @@ public function deleteOrganizationWithHttpInfo($id) } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\OrganizationDeleteResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ChangelogResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\OrganizationDeleteResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ChangelogResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -831,7 +857,7 @@ public function deleteOrganizationWithHttpInfo($id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\OrganizationDeleteResponse', + '\Pipedrive\versions\v1\Model\ChangelogResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -842,19 +868,20 @@ public function deleteOrganizationWithHttpInfo($id) } /** - * Operation deleteOrganizationAsync + * Operation getOrganizationChangelogAsync * - * Delete an organization + * List updates about organization field values * * @param int $id The ID of the organization (required) + * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) + * @param int|null $limit Items shown per page (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function deleteOrganizationAsync($id): PromiseInterface + public function getOrganizationChangelogAsync($id, $cursor = null, $limit = null): PromiseInterface { - return $this->deleteOrganizationAsyncWithHttpInfo($id) + return $this->getOrganizationChangelogAsyncWithHttpInfo($id, $cursor, $limit) ->then( function ($response) { return $response[0]; @@ -863,20 +890,21 @@ function ($response) { } /** - * Operation deleteOrganizationAsyncWithHttpInfo + * Operation getOrganizationChangelogAsyncWithHttpInfo * - * Delete an organization + * List updates about organization field values * * @param int $id The ID of the organization (required) + * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) + * @param int|null $limit Items shown per page (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function deleteOrganizationAsyncWithHttpInfo($id): PromiseInterface + public function getOrganizationChangelogAsyncWithHttpInfo($id, $cursor = null, $limit = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\OrganizationDeleteResponse'; - $request = $this->deleteOrganizationRequest($id); + $returnType = '\Pipedrive\versions\v1\Model\ChangelogResponse'; + $request = $this->getOrganizationChangelogRequest($id, $cursor, $limit); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -913,31 +941,48 @@ function ($exception) { } /** - * Create request for operation 'deleteOrganization' + * Create request for operation 'getOrganizationChangelog' * * @param int $id The ID of the organization (required) + * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) + * @param int|null $limit Items shown per page (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request - * @deprecated */ - public function deleteOrganizationRequest($id): Request + public function getOrganizationChangelogRequest($id, $cursor = null, $limit = null): Request { // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling deleteOrganization' + 'Missing the required parameter $id when calling getOrganizationChangelog' ); } - $resourcePath = '/organizations/{id}'; + $resourcePath = '/organizations/{id}/changelog'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; + // query params + /* @phpstan-ignore-next-line */ + if (is_array($cursor)) { + $cursor = ObjectSerializer::serializeCollection($cursor, '', true); + } + if ($cursor !== null) { + $queryParams['cursor'] = $cursor; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($limit)) { + $limit = ObjectSerializer::serializeCollection($limit, '', true); + } + if ($limit !== null) { + $queryParams['limit'] = $limit; + } // path params @@ -1015,7 +1060,7 @@ public function deleteOrganizationRequest($id): Request $query = Query::build($queryParams); return new Request( - 'DELETE', + 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -1023,38 +1068,42 @@ public function deleteOrganizationRequest($id): Request } /** - * Operation deleteOrganizationFollower + * Operation getOrganizationFiles * - * Delete a follower from an organization + * List files attached to an organization * * @param int $id The ID of the organization (required) - * @param int $follower_id The ID of the relationship between the follower and the organization (required) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) + * @param string|null $sort Supported fields: `id`, `update_time` (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\OrganizationFollowerDeleteResponse + * @return \Pipedrive\versions\v1\Model\ListFilesResponse */ - public function deleteOrganizationFollower($id, $follower_id) + public function getOrganizationFiles($id, $start = 0, $limit = null, $sort = null) { - list($response) = $this->deleteOrganizationFollowerWithHttpInfo($id, $follower_id); + list($response) = $this->getOrganizationFilesWithHttpInfo($id, $start, $limit, $sort); return $response; } /** - * Operation deleteOrganizationFollowerWithHttpInfo + * Operation getOrganizationFilesWithHttpInfo * - * Delete a follower from an organization + * List files attached to an organization * * @param int $id The ID of the organization (required) - * @param int $follower_id The ID of the relationship between the follower and the organization (required) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) + * @param string|null $sort Supported fields: `id`, `update_time` (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\OrganizationFollowerDeleteResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v1\Model\ListFilesResponse, HTTP status code, HTTP response headers (array of strings) */ - public function deleteOrganizationFollowerWithHttpInfo($id, $follower_id) + public function getOrganizationFilesWithHttpInfo($id, $start = 0, $limit = null, $sort = null) { - $request = $this->deleteOrganizationFollowerRequest($id, $follower_id); + $request = $this->getOrganizationFilesRequest($id, $start, $limit, $sort); try { $options = $this->createHttpClientOption(); @@ -1063,7 +1112,7 @@ public function deleteOrganizationFollowerWithHttpInfo($id, $follower_id) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->deleteOrganizationFollowerRequest($id, $follower_id); + $request = $this->getOrganizationFilesRequest($id, $start, $limit, $sort); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -1088,14 +1137,14 @@ public function deleteOrganizationFollowerWithHttpInfo($id, $follower_id) switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\OrganizationFollowerDeleteResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ListFilesResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\OrganizationFollowerDeleteResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListFilesResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -1115,14 +1164,14 @@ public function deleteOrganizationFollowerWithHttpInfo($id, $follower_id) } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\OrganizationFollowerDeleteResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ListFilesResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\OrganizationFollowerDeleteResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListFilesResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -1132,7 +1181,7 @@ public function deleteOrganizationFollowerWithHttpInfo($id, $follower_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\OrganizationFollowerDeleteResponse', + '\Pipedrive\versions\v1\Model\ListFilesResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1143,19 +1192,21 @@ public function deleteOrganizationFollowerWithHttpInfo($id, $follower_id) } /** - * Operation deleteOrganizationFollowerAsync + * Operation getOrganizationFilesAsync * - * Delete a follower from an organization + * List files attached to an organization * * @param int $id The ID of the organization (required) - * @param int $follower_id The ID of the relationship between the follower and the organization (required) - * + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) + * @param string|null $sort Supported fields: `id`, `update_time` (optional) + * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function deleteOrganizationFollowerAsync($id, $follower_id): PromiseInterface + public function getOrganizationFilesAsync($id, $start = 0, $limit = null, $sort = null): PromiseInterface { - return $this->deleteOrganizationFollowerAsyncWithHttpInfo($id, $follower_id) + return $this->getOrganizationFilesAsyncWithHttpInfo($id, $start, $limit, $sort) ->then( function ($response) { return $response[0]; @@ -1164,20 +1215,22 @@ function ($response) { } /** - * Operation deleteOrganizationFollowerAsyncWithHttpInfo + * Operation getOrganizationFilesAsyncWithHttpInfo * - * Delete a follower from an organization + * List files attached to an organization * * @param int $id The ID of the organization (required) - * @param int $follower_id The ID of the relationship between the follower and the organization (required) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) + * @param string|null $sort Supported fields: `id`, `update_time` (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function deleteOrganizationFollowerAsyncWithHttpInfo($id, $follower_id): PromiseInterface + public function getOrganizationFilesAsyncWithHttpInfo($id, $start = 0, $limit = null, $sort = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\OrganizationFollowerDeleteResponse'; - $request = $this->deleteOrganizationFollowerRequest($id, $follower_id); + $returnType = '\Pipedrive\versions\v1\Model\ListFilesResponse'; + $request = $this->getOrganizationFilesRequest($id, $start, $limit, $sort); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1214,38 +1267,61 @@ function ($exception) { } /** - * Create request for operation 'deleteOrganizationFollower' + * Create request for operation 'getOrganizationFiles' * * @param int $id The ID of the organization (required) - * @param int $follower_id The ID of the relationship between the follower and the organization (required) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) + * @param string|null $sort Supported fields: `id`, `update_time` (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function deleteOrganizationFollowerRequest($id, $follower_id): Request + public function getOrganizationFilesRequest($id, $start = 0, $limit = null, $sort = null): Request { // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling deleteOrganizationFollower' + 'Missing the required parameter $id when calling getOrganizationFiles' ); } - // verify the required parameter 'follower_id' is set - /* @phpstan-ignore-next-line */ - if ($follower_id === null || (is_array($follower_id) && count($follower_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $follower_id when calling deleteOrganizationFollower' - ); + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling OrganizationsApi.getOrganizationFiles, must be smaller than or equal to 100.'); } - $resourcePath = '/organizations/{id}/followers/{follower_id}'; + + $resourcePath = '/organizations/{id}/files'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; + // query params + /* @phpstan-ignore-next-line */ + if (is_array($start)) { + $start = ObjectSerializer::serializeCollection($start, '', true); + } + if ($start !== null) { + $queryParams['start'] = $start; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($limit)) { + $limit = ObjectSerializer::serializeCollection($limit, '', true); + } + if ($limit !== null) { + $queryParams['limit'] = $limit; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($sort)) { + $sort = ObjectSerializer::serializeCollection($sort, '', true); + } + if ($sort !== null) { + $queryParams['sort'] = $sort; + } // path params @@ -1256,14 +1332,6 @@ public function deleteOrganizationFollowerRequest($id, $follower_id): Request $resourcePath ); } - // path params - if ($follower_id !== null) { - $resourcePath = str_replace( - '{' . 'follower_id' . '}', - ObjectSerializer::toPathValue($follower_id), - $resourcePath - ); - } /* @phpstan-ignore-next-line */ @@ -1331,7 +1399,7 @@ public function deleteOrganizationFollowerRequest($id, $follower_id): Request $query = Query::build($queryParams); return new Request( - 'DELETE', + 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -1339,38 +1407,36 @@ public function deleteOrganizationFollowerRequest($id, $follower_id): Request } /** - * Operation getOrganization + * Operation getOrganizationFollowers * - * Get details of an organization + * List followers of an organization * * @param int $id The ID of the organization (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\OrganizationDetailsGetResponse - * @deprecated + * @return \Pipedrive\versions\v1\Model\OrganizationFollowersListResponse */ - public function getOrganization($id) + public function getOrganizationFollowers($id) { - list($response) = $this->getOrganizationWithHttpInfo($id); + list($response) = $this->getOrganizationFollowersWithHttpInfo($id); return $response; } /** - * Operation getOrganizationWithHttpInfo + * Operation getOrganizationFollowersWithHttpInfo * - * Get details of an organization + * List followers of an organization * * @param int $id The ID of the organization (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\OrganizationDetailsGetResponse, HTTP status code, HTTP response headers (array of strings) - * @deprecated + * @return array of \Pipedrive\versions\v1\Model\OrganizationFollowersListResponse, HTTP status code, HTTP response headers (array of strings) */ - public function getOrganizationWithHttpInfo($id) + public function getOrganizationFollowersWithHttpInfo($id) { - $request = $this->getOrganizationRequest($id); + $request = $this->getOrganizationFollowersRequest($id); try { $options = $this->createHttpClientOption(); @@ -1379,7 +1445,7 @@ public function getOrganizationWithHttpInfo($id) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getOrganizationRequest($id); + $request = $this->getOrganizationFollowersRequest($id); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -1404,14 +1470,14 @@ public function getOrganizationWithHttpInfo($id) switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\OrganizationDetailsGetResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\OrganizationFollowersListResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\OrganizationDetailsGetResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\OrganizationFollowersListResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -1431,14 +1497,14 @@ public function getOrganizationWithHttpInfo($id) } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\OrganizationDetailsGetResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\OrganizationFollowersListResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\OrganizationDetailsGetResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\OrganizationFollowersListResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -1448,7 +1514,7 @@ public function getOrganizationWithHttpInfo($id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\OrganizationDetailsGetResponse', + '\Pipedrive\versions\v1\Model\OrganizationFollowersListResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1459,19 +1525,18 @@ public function getOrganizationWithHttpInfo($id) } /** - * Operation getOrganizationAsync + * Operation getOrganizationFollowersAsync * - * Get details of an organization + * List followers of an organization * * @param int $id The ID of the organization (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function getOrganizationAsync($id): PromiseInterface + public function getOrganizationFollowersAsync($id): PromiseInterface { - return $this->getOrganizationAsyncWithHttpInfo($id) + return $this->getOrganizationFollowersAsyncWithHttpInfo($id) ->then( function ($response) { return $response[0]; @@ -1480,20 +1545,19 @@ function ($response) { } /** - * Operation getOrganizationAsyncWithHttpInfo + * Operation getOrganizationFollowersAsyncWithHttpInfo * - * Get details of an organization + * List followers of an organization * * @param int $id The ID of the organization (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function getOrganizationAsyncWithHttpInfo($id): PromiseInterface + public function getOrganizationFollowersAsyncWithHttpInfo($id): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\OrganizationDetailsGetResponse'; - $request = $this->getOrganizationRequest($id); + $returnType = '\Pipedrive\versions\v1\Model\OrganizationFollowersListResponse'; + $request = $this->getOrganizationFollowersRequest($id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1530,25 +1594,24 @@ function ($exception) { } /** - * Create request for operation 'getOrganization' + * Create request for operation 'getOrganizationFollowers' * * @param int $id The ID of the organization (required) * * @throws InvalidArgumentException|OAuthProviderException * @return Request - * @deprecated */ - public function getOrganizationRequest($id): Request + public function getOrganizationFollowersRequest($id): Request { // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getOrganization' + 'Missing the required parameter $id when calling getOrganizationFollowers' ); } - $resourcePath = '/organizations/{id}'; + $resourcePath = '/organizations/{id}/followers'; $formParams = []; $queryParams = []; $headerParams = []; @@ -1640,46 +1703,40 @@ public function getOrganizationRequest($id): Request } /** - * Operation getOrganizationActivities + * Operation getOrganizationMailMessages * - * List activities associated with an organization + * List mail messages associated with an organization * * @param int $id The ID of the organization (required) * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $done Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted returns both Done and Not done activities. (optional) - * @param string|null $exclude A comma-separated string of activity IDs to exclude from result (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\ListActivitiesResponse - * @deprecated + * @return \Pipedrive\versions\v1\Model\ListMailMessagesResponse */ - public function getOrganizationActivities($id, $start = 0, $limit = null, $done = null, $exclude = null) + public function getOrganizationMailMessages($id, $start = 0, $limit = null) { - list($response) = $this->getOrganizationActivitiesWithHttpInfo($id, $start, $limit, $done, $exclude); + list($response) = $this->getOrganizationMailMessagesWithHttpInfo($id, $start, $limit); return $response; } /** - * Operation getOrganizationActivitiesWithHttpInfo + * Operation getOrganizationMailMessagesWithHttpInfo * - * List activities associated with an organization + * List mail messages associated with an organization * * @param int $id The ID of the organization (required) * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $done Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted returns both Done and Not done activities. (optional) - * @param string|null $exclude A comma-separated string of activity IDs to exclude from result (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\ListActivitiesResponse, HTTP status code, HTTP response headers (array of strings) - * @deprecated + * @return array of \Pipedrive\versions\v1\Model\ListMailMessagesResponse, HTTP status code, HTTP response headers (array of strings) */ - public function getOrganizationActivitiesWithHttpInfo($id, $start = 0, $limit = null, $done = null, $exclude = null) + public function getOrganizationMailMessagesWithHttpInfo($id, $start = 0, $limit = null) { - $request = $this->getOrganizationActivitiesRequest($id, $start, $limit, $done, $exclude); + $request = $this->getOrganizationMailMessagesRequest($id, $start, $limit); try { $options = $this->createHttpClientOption(); @@ -1688,7 +1745,7 @@ public function getOrganizationActivitiesWithHttpInfo($id, $start = 0, $limit = } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getOrganizationActivitiesRequest($id, $start, $limit, $done, $exclude); + $request = $this->getOrganizationMailMessagesRequest($id, $start, $limit); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -1713,14 +1770,14 @@ public function getOrganizationActivitiesWithHttpInfo($id, $start = 0, $limit = switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListActivitiesResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ListMailMessagesResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListActivitiesResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListMailMessagesResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -1740,14 +1797,14 @@ public function getOrganizationActivitiesWithHttpInfo($id, $start = 0, $limit = } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListActivitiesResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ListMailMessagesResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListActivitiesResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListMailMessagesResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -1757,7 +1814,7 @@ public function getOrganizationActivitiesWithHttpInfo($id, $start = 0, $limit = case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\ListActivitiesResponse', + '\Pipedrive\versions\v1\Model\ListMailMessagesResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1768,23 +1825,20 @@ public function getOrganizationActivitiesWithHttpInfo($id, $start = 0, $limit = } /** - * Operation getOrganizationActivitiesAsync + * Operation getOrganizationMailMessagesAsync * - * List activities associated with an organization + * List mail messages associated with an organization * * @param int $id The ID of the organization (required) * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $done Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted returns both Done and Not done activities. (optional) - * @param string|null $exclude A comma-separated string of activity IDs to exclude from result (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function getOrganizationActivitiesAsync($id, $start = 0, $limit = null, $done = null, $exclude = null): PromiseInterface + public function getOrganizationMailMessagesAsync($id, $start = 0, $limit = null): PromiseInterface { - return $this->getOrganizationActivitiesAsyncWithHttpInfo($id, $start, $limit, $done, $exclude) + return $this->getOrganizationMailMessagesAsyncWithHttpInfo($id, $start, $limit) ->then( function ($response) { return $response[0]; @@ -1793,24 +1847,21 @@ function ($response) { } /** - * Operation getOrganizationActivitiesAsyncWithHttpInfo + * Operation getOrganizationMailMessagesAsyncWithHttpInfo * - * List activities associated with an organization + * List mail messages associated with an organization * * @param int $id The ID of the organization (required) * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $done Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted returns both Done and Not done activities. (optional) - * @param string|null $exclude A comma-separated string of activity IDs to exclude from result (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function getOrganizationActivitiesAsyncWithHttpInfo($id, $start = 0, $limit = null, $done = null, $exclude = null): PromiseInterface + public function getOrganizationMailMessagesAsyncWithHttpInfo($id, $start = 0, $limit = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\ListActivitiesResponse'; - $request = $this->getOrganizationActivitiesRequest($id, $start, $limit, $done, $exclude); + $returnType = '\Pipedrive\versions\v1\Model\ListMailMessagesResponse'; + $request = $this->getOrganizationMailMessagesRequest($id, $start, $limit); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1847,29 +1898,26 @@ function ($exception) { } /** - * Create request for operation 'getOrganizationActivities' + * Create request for operation 'getOrganizationMailMessages' * * @param int $id The ID of the organization (required) * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $done Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted returns both Done and Not done activities. (optional) - * @param string|null $exclude A comma-separated string of activity IDs to exclude from result (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request - * @deprecated */ - public function getOrganizationActivitiesRequest($id, $start = 0, $limit = null, $done = null, $exclude = null): Request + public function getOrganizationMailMessagesRequest($id, $start = 0, $limit = null): Request { // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getOrganizationActivities' + 'Missing the required parameter $id when calling getOrganizationMailMessages' ); } - $resourcePath = '/organizations/{id}/activities'; + $resourcePath = '/organizations/{id}/mailMessages'; $formParams = []; $queryParams = []; $headerParams = []; @@ -1892,22 +1940,6 @@ public function getOrganizationActivitiesRequest($id, $start = 0, $limit = null, if ($limit !== null) { $queryParams['limit'] = $limit; } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($done)) { - $done = ObjectSerializer::serializeCollection($done, '', true); - } - if ($done !== null) { - $queryParams['done'] = $done; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($exclude)) { - $exclude = ObjectSerializer::serializeCollection($exclude, '', true); - } - if ($exclude !== null) { - $queryParams['exclude'] = $exclude; - } // path params @@ -1993,40 +2025,44 @@ public function getOrganizationActivitiesRequest($id, $start = 0, $limit = null, } /** - * Operation getOrganizationChangelog + * Operation getOrganizationUpdates * - * List updates about organization field values + * List updates about an organization * * @param int $id The ID of the organization (required) - * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) + * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) + * @param string|null $all_changes Whether to show custom field updates or not. 1 = Include custom field changes. If omitted, returns changes without custom field updates. (optional) + * @param string|null $items A comma-separated string for filtering out item specific updates. (Possible values - activity, plannedActivity, note, file, change, deal, follower, participant, mailMessage, mailMessageWithAttachment, invoice, activityFile, document). (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\ChangelogResponse + * @return \Pipedrive\versions\v1\Model\OrganizationFlowResponse */ - public function getOrganizationChangelog($id, $cursor = null, $limit = null) + public function getOrganizationUpdates($id, $start = 0, $limit = null, $all_changes = null, $items = null) { - list($response) = $this->getOrganizationChangelogWithHttpInfo($id, $cursor, $limit); + list($response) = $this->getOrganizationUpdatesWithHttpInfo($id, $start, $limit, $all_changes, $items); return $response; } /** - * Operation getOrganizationChangelogWithHttpInfo + * Operation getOrganizationUpdatesWithHttpInfo * - * List updates about organization field values + * List updates about an organization * * @param int $id The ID of the organization (required) - * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) + * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) + * @param string|null $all_changes Whether to show custom field updates or not. 1 = Include custom field changes. If omitted, returns changes without custom field updates. (optional) + * @param string|null $items A comma-separated string for filtering out item specific updates. (Possible values - activity, plannedActivity, note, file, change, deal, follower, participant, mailMessage, mailMessageWithAttachment, invoice, activityFile, document). (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\ChangelogResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v1\Model\OrganizationFlowResponse, HTTP status code, HTTP response headers (array of strings) */ - public function getOrganizationChangelogWithHttpInfo($id, $cursor = null, $limit = null) + public function getOrganizationUpdatesWithHttpInfo($id, $start = 0, $limit = null, $all_changes = null, $items = null) { - $request = $this->getOrganizationChangelogRequest($id, $cursor, $limit); + $request = $this->getOrganizationUpdatesRequest($id, $start, $limit, $all_changes, $items); try { $options = $this->createHttpClientOption(); @@ -2035,7 +2071,7 @@ public function getOrganizationChangelogWithHttpInfo($id, $cursor = null, $limit } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getOrganizationChangelogRequest($id, $cursor, $limit); + $request = $this->getOrganizationUpdatesRequest($id, $start, $limit, $all_changes, $items); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -2060,14 +2096,14 @@ public function getOrganizationChangelogWithHttpInfo($id, $cursor = null, $limit switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ChangelogResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\OrganizationFlowResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ChangelogResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\OrganizationFlowResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -2087,14 +2123,14 @@ public function getOrganizationChangelogWithHttpInfo($id, $cursor = null, $limit } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ChangelogResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\OrganizationFlowResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ChangelogResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\OrganizationFlowResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -2104,7 +2140,7 @@ public function getOrganizationChangelogWithHttpInfo($id, $cursor = null, $limit case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\ChangelogResponse', + '\Pipedrive\versions\v1\Model\OrganizationFlowResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2115,20 +2151,22 @@ public function getOrganizationChangelogWithHttpInfo($id, $cursor = null, $limit } /** - * Operation getOrganizationChangelogAsync + * Operation getOrganizationUpdatesAsync * - * List updates about organization field values + * List updates about an organization * * @param int $id The ID of the organization (required) - * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) + * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) + * @param string|null $all_changes Whether to show custom field updates or not. 1 = Include custom field changes. If omitted, returns changes without custom field updates. (optional) + * @param string|null $items A comma-separated string for filtering out item specific updates. (Possible values - activity, plannedActivity, note, file, change, deal, follower, participant, mailMessage, mailMessageWithAttachment, invoice, activityFile, document). (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getOrganizationChangelogAsync($id, $cursor = null, $limit = null): PromiseInterface + public function getOrganizationUpdatesAsync($id, $start = 0, $limit = null, $all_changes = null, $items = null): PromiseInterface { - return $this->getOrganizationChangelogAsyncWithHttpInfo($id, $cursor, $limit) + return $this->getOrganizationUpdatesAsyncWithHttpInfo($id, $start, $limit, $all_changes, $items) ->then( function ($response) { return $response[0]; @@ -2137,21 +2175,23 @@ function ($response) { } /** - * Operation getOrganizationChangelogAsyncWithHttpInfo + * Operation getOrganizationUpdatesAsyncWithHttpInfo * - * List updates about organization field values + * List updates about an organization * * @param int $id The ID of the organization (required) - * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) + * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) + * @param string|null $all_changes Whether to show custom field updates or not. 1 = Include custom field changes. If omitted, returns changes without custom field updates. (optional) + * @param string|null $items A comma-separated string for filtering out item specific updates. (Possible values - activity, plannedActivity, note, file, change, deal, follower, participant, mailMessage, mailMessageWithAttachment, invoice, activityFile, document). (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getOrganizationChangelogAsyncWithHttpInfo($id, $cursor = null, $limit = null): PromiseInterface + public function getOrganizationUpdatesAsyncWithHttpInfo($id, $start = 0, $limit = null, $all_changes = null, $items = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\ChangelogResponse'; - $request = $this->getOrganizationChangelogRequest($id, $cursor, $limit); + $returnType = '\Pipedrive\versions\v1\Model\OrganizationFlowResponse'; + $request = $this->getOrganizationUpdatesRequest($id, $start, $limit, $all_changes, $items); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2188,26 +2228,28 @@ function ($exception) { } /** - * Create request for operation 'getOrganizationChangelog' + * Create request for operation 'getOrganizationUpdates' * * @param int $id The ID of the organization (required) - * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) + * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) + * @param string|null $all_changes Whether to show custom field updates or not. 1 = Include custom field changes. If omitted, returns changes without custom field updates. (optional) + * @param string|null $items A comma-separated string for filtering out item specific updates. (Possible values - activity, plannedActivity, note, file, change, deal, follower, participant, mailMessage, mailMessageWithAttachment, invoice, activityFile, document). (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function getOrganizationChangelogRequest($id, $cursor = null, $limit = null): Request + public function getOrganizationUpdatesRequest($id, $start = 0, $limit = null, $all_changes = null, $items = null): Request { // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getOrganizationChangelog' + 'Missing the required parameter $id when calling getOrganizationUpdates' ); } - $resourcePath = '/organizations/{id}/changelog'; + $resourcePath = '/organizations/{id}/flow'; $formParams = []; $queryParams = []; $headerParams = []; @@ -2216,11 +2258,11 @@ public function getOrganizationChangelogRequest($id, $cursor = null, $limit = nu // query params /* @phpstan-ignore-next-line */ - if (is_array($cursor)) { - $cursor = ObjectSerializer::serializeCollection($cursor, '', true); + if (is_array($start)) { + $start = ObjectSerializer::serializeCollection($start, '', true); } - if ($cursor !== null) { - $queryParams['cursor'] = $cursor; + if ($start !== null) { + $queryParams['start'] = $start; } // query params /* @phpstan-ignore-next-line */ @@ -2230,6 +2272,22 @@ public function getOrganizationChangelogRequest($id, $cursor = null, $limit = nu if ($limit !== null) { $queryParams['limit'] = $limit; } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($all_changes)) { + $all_changes = ObjectSerializer::serializeCollection($all_changes, '', true); + } + if ($all_changes !== null) { + $queryParams['all_changes'] = $all_changes; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($items)) { + $items = ObjectSerializer::serializeCollection($items, '', true); + } + if ($items !== null) { + $queryParams['items'] = $items; + } // path params @@ -2315,48 +2373,36 @@ public function getOrganizationChangelogRequest($id, $cursor = null, $limit = nu } /** - * Operation getOrganizationDeals + * Operation getOrganizationUsers * - * List deals associated with an organization + * List permitted users * * @param int $id The ID of the organization (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|'all_not_deleted' $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional, default to 'all_not_deleted') - * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $only_primary_association If set, only deals that are directly associated to the organization are fetched. If not set (default), all deals are fetched that are either directly or indirectly related to the organization. Indirect relations include relations through custom, organization-type fields and through persons of the given organization. (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\ListDealsResponse - * @deprecated + * @return \Pipedrive\versions\v1\Model\ListPermittedUsersResponse1 */ - public function getOrganizationDeals($id, $start = 0, $limit = null, $status = 'all_not_deleted', $sort = null, $only_primary_association = null) + public function getOrganizationUsers($id) { - list($response) = $this->getOrganizationDealsWithHttpInfo($id, $start, $limit, $status, $sort, $only_primary_association); + list($response) = $this->getOrganizationUsersWithHttpInfo($id); return $response; } /** - * Operation getOrganizationDealsWithHttpInfo + * Operation getOrganizationUsersWithHttpInfo * - * List deals associated with an organization + * List permitted users * * @param int $id The ID of the organization (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|'all_not_deleted' $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional, default to 'all_not_deleted') - * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $only_primary_association If set, only deals that are directly associated to the organization are fetched. If not set (default), all deals are fetched that are either directly or indirectly related to the organization. Indirect relations include relations through custom, organization-type fields and through persons of the given organization. (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\ListDealsResponse, HTTP status code, HTTP response headers (array of strings) - * @deprecated + * @return array of \Pipedrive\versions\v1\Model\ListPermittedUsersResponse1, HTTP status code, HTTP response headers (array of strings) */ - public function getOrganizationDealsWithHttpInfo($id, $start = 0, $limit = null, $status = 'all_not_deleted', $sort = null, $only_primary_association = null) + public function getOrganizationUsersWithHttpInfo($id) { - $request = $this->getOrganizationDealsRequest($id, $start, $limit, $status, $sort, $only_primary_association); + $request = $this->getOrganizationUsersRequest($id); try { $options = $this->createHttpClientOption(); @@ -2365,7 +2411,7 @@ public function getOrganizationDealsWithHttpInfo($id, $start = 0, $limit = null, } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getOrganizationDealsRequest($id, $start, $limit, $status, $sort, $only_primary_association); + $request = $this->getOrganizationUsersRequest($id); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -2390,14 +2436,14 @@ public function getOrganizationDealsWithHttpInfo($id, $start = 0, $limit = null, switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListDealsResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ListPermittedUsersResponse1' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListDealsResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListPermittedUsersResponse1', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -2417,14 +2463,14 @@ public function getOrganizationDealsWithHttpInfo($id, $start = 0, $limit = null, } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListDealsResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ListPermittedUsersResponse1' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListDealsResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListPermittedUsersResponse1', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -2434,7 +2480,7 @@ public function getOrganizationDealsWithHttpInfo($id, $start = 0, $limit = null, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\ListDealsResponse', + '\Pipedrive\versions\v1\Model\ListPermittedUsersResponse1', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2445,24 +2491,18 @@ public function getOrganizationDealsWithHttpInfo($id, $start = 0, $limit = null, } /** - * Operation getOrganizationDealsAsync + * Operation getOrganizationUsersAsync * - * List deals associated with an organization + * List permitted users * * @param int $id The ID of the organization (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|'all_not_deleted' $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional, default to 'all_not_deleted') - * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $only_primary_association If set, only deals that are directly associated to the organization are fetched. If not set (default), all deals are fetched that are either directly or indirectly related to the organization. Indirect relations include relations through custom, organization-type fields and through persons of the given organization. (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function getOrganizationDealsAsync($id, $start = 0, $limit = null, $status = 'all_not_deleted', $sort = null, $only_primary_association = null): PromiseInterface + public function getOrganizationUsersAsync($id): PromiseInterface { - return $this->getOrganizationDealsAsyncWithHttpInfo($id, $start, $limit, $status, $sort, $only_primary_association) + return $this->getOrganizationUsersAsyncWithHttpInfo($id) ->then( function ($response) { return $response[0]; @@ -2471,25 +2511,19 @@ function ($response) { } /** - * Operation getOrganizationDealsAsyncWithHttpInfo + * Operation getOrganizationUsersAsyncWithHttpInfo * - * List deals associated with an organization + * List permitted users * * @param int $id The ID of the organization (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|'all_not_deleted' $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional, default to 'all_not_deleted') - * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $only_primary_association If set, only deals that are directly associated to the organization are fetched. If not set (default), all deals are fetched that are either directly or indirectly related to the organization. Indirect relations include relations through custom, organization-type fields and through persons of the given organization. (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function getOrganizationDealsAsyncWithHttpInfo($id, $start = 0, $limit = null, $status = 'all_not_deleted', $sort = null, $only_primary_association = null): PromiseInterface + public function getOrganizationUsersAsyncWithHttpInfo($id): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\ListDealsResponse'; - $request = $this->getOrganizationDealsRequest($id, $start, $limit, $status, $sort, $only_primary_association); + $returnType = '\Pipedrive\versions\v1\Model\ListPermittedUsersResponse1'; + $request = $this->getOrganizationUsersRequest($id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2526,76 +2560,30 @@ function ($exception) { } /** - * Create request for operation 'getOrganizationDeals' + * Create request for operation 'getOrganizationUsers' * * @param int $id The ID of the organization (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|'all_not_deleted' $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional, default to 'all_not_deleted') - * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $only_primary_association If set, only deals that are directly associated to the organization are fetched. If not set (default), all deals are fetched that are either directly or indirectly related to the organization. Indirect relations include relations through custom, organization-type fields and through persons of the given organization. (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request - * @deprecated */ - public function getOrganizationDealsRequest($id, $start = 0, $limit = null, $status = 'all_not_deleted', $sort = null, $only_primary_association = null): Request + public function getOrganizationUsersRequest($id): Request { // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getOrganizationDeals' + 'Missing the required parameter $id when calling getOrganizationUsers' ); } - $resourcePath = '/organizations/{id}/deals'; + $resourcePath = '/organizations/{id}/permittedUsers'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - /* @phpstan-ignore-next-line */ - if (is_array($start)) { - $start = ObjectSerializer::serializeCollection($start, '', true); - } - if ($start !== null) { - $queryParams['start'] = $start; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($limit)) { - $limit = ObjectSerializer::serializeCollection($limit, '', true); - } - if ($limit !== null) { - $queryParams['limit'] = $limit; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($status)) { - $status = ObjectSerializer::serializeCollection($status, '', true); - } - if ($status !== null) { - $queryParams['status'] = $status; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($sort)) { - $sort = ObjectSerializer::serializeCollection($sort, '', true); - } - if ($sort !== null) { - $queryParams['sort'] = $sort; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($only_primary_association)) { - $only_primary_association = ObjectSerializer::serializeCollection($only_primary_association, '', true); - } - if ($only_primary_association !== null) { - $queryParams['only_primary_association'] = $only_primary_association; - } // path params @@ -2681,42 +2669,38 @@ public function getOrganizationDealsRequest($id, $start = 0, $limit = null, $sta } /** - * Operation getOrganizationFiles + * Operation mergeOrganizations * - * List files attached to an organization + * Merge two organizations * * @param int $id The ID of the organization (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) - * @param string|null $sort Supported fields: `id`, `update_time` (optional) + * @param \Pipedrive\versions\v1\Model\MergeOrganizationsRequest|null $merge_organizations_request merge_organizations_request (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\ListFilesResponse + * @return \Pipedrive\versions\v1\Model\OrganizationsMergeResponse */ - public function getOrganizationFiles($id, $start = 0, $limit = null, $sort = null) + public function mergeOrganizations($id, $merge_organizations_request = null) { - list($response) = $this->getOrganizationFilesWithHttpInfo($id, $start, $limit, $sort); + list($response) = $this->mergeOrganizationsWithHttpInfo($id, $merge_organizations_request); return $response; } /** - * Operation getOrganizationFilesWithHttpInfo + * Operation mergeOrganizationsWithHttpInfo * - * List files attached to an organization + * Merge two organizations * * @param int $id The ID of the organization (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) - * @param string|null $sort Supported fields: `id`, `update_time` (optional) + * @param \Pipedrive\versions\v1\Model\MergeOrganizationsRequest|null $merge_organizations_request (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\ListFilesResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v1\Model\OrganizationsMergeResponse, HTTP status code, HTTP response headers (array of strings) */ - public function getOrganizationFilesWithHttpInfo($id, $start = 0, $limit = null, $sort = null) + public function mergeOrganizationsWithHttpInfo($id, $merge_organizations_request = null) { - $request = $this->getOrganizationFilesRequest($id, $start, $limit, $sort); + $request = $this->mergeOrganizationsRequest($id, $merge_organizations_request); try { $options = $this->createHttpClientOption(); @@ -2725,7 +2709,7 @@ public function getOrganizationFilesWithHttpInfo($id, $start = 0, $limit = null, } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getOrganizationFilesRequest($id, $start, $limit, $sort); + $request = $this->mergeOrganizationsRequest($id, $merge_organizations_request); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -2750,14 +2734,14 @@ public function getOrganizationFilesWithHttpInfo($id, $start = 0, $limit = null, switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListFilesResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\OrganizationsMergeResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListFilesResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\OrganizationsMergeResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -2777,14 +2761,14 @@ public function getOrganizationFilesWithHttpInfo($id, $start = 0, $limit = null, } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListFilesResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\OrganizationsMergeResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListFilesResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\OrganizationsMergeResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -2794,7 +2778,7 @@ public function getOrganizationFilesWithHttpInfo($id, $start = 0, $limit = null, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\ListFilesResponse', + '\Pipedrive\versions\v1\Model\OrganizationsMergeResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2805,21 +2789,19 @@ public function getOrganizationFilesWithHttpInfo($id, $start = 0, $limit = null, } /** - * Operation getOrganizationFilesAsync + * Operation mergeOrganizationsAsync * - * List files attached to an organization + * Merge two organizations * * @param int $id The ID of the organization (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) - * @param string|null $sort Supported fields: `id`, `update_time` (optional) + * @param \Pipedrive\versions\v1\Model\MergeOrganizationsRequest|null $merge_organizations_request (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getOrganizationFilesAsync($id, $start = 0, $limit = null, $sort = null): PromiseInterface + public function mergeOrganizationsAsync($id, $merge_organizations_request = null): PromiseInterface { - return $this->getOrganizationFilesAsyncWithHttpInfo($id, $start, $limit, $sort) + return $this->mergeOrganizationsAsyncWithHttpInfo($id, $merge_organizations_request) ->then( function ($response) { return $response[0]; @@ -2828,22 +2810,20 @@ function ($response) { } /** - * Operation getOrganizationFilesAsyncWithHttpInfo + * Operation mergeOrganizationsAsyncWithHttpInfo * - * List files attached to an organization + * Merge two organizations * * @param int $id The ID of the organization (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) - * @param string|null $sort Supported fields: `id`, `update_time` (optional) + * @param \Pipedrive\versions\v1\Model\MergeOrganizationsRequest|null $merge_organizations_request (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getOrganizationFilesAsyncWithHttpInfo($id, $start = 0, $limit = null, $sort = null): PromiseInterface + public function mergeOrganizationsAsyncWithHttpInfo($id, $merge_organizations_request = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\ListFilesResponse'; - $request = $this->getOrganizationFilesRequest($id, $start, $limit, $sort); + $returnType = '\Pipedrive\versions\v1\Model\OrganizationsMergeResponse'; + $request = $this->mergeOrganizationsRequest($id, $merge_organizations_request); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2880,61 +2860,31 @@ function ($exception) { } /** - * Create request for operation 'getOrganizationFiles' + * Create request for operation 'mergeOrganizations' * * @param int $id The ID of the organization (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) - * @param string|null $sort Supported fields: `id`, `update_time` (optional) + * @param \Pipedrive\versions\v1\Model\MergeOrganizationsRequest|null $merge_organizations_request (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function getOrganizationFilesRequest($id, $start = 0, $limit = null, $sort = null): Request + public function mergeOrganizationsRequest($id, $merge_organizations_request = null): Request { // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getOrganizationFiles' + 'Missing the required parameter $id when calling mergeOrganizations' ); } - if ($limit !== null && $limit > 100) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling OrganizationsApi.getOrganizationFiles, must be smaller than or equal to 100.'); - } - - $resourcePath = '/organizations/{id}/files'; + $resourcePath = '/organizations/{id}/merge'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - /* @phpstan-ignore-next-line */ - if (is_array($start)) { - $start = ObjectSerializer::serializeCollection($start, '', true); - } - if ($start !== null) { - $queryParams['start'] = $start; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($limit)) { - $limit = ObjectSerializer::serializeCollection($limit, '', true); - } - if ($limit !== null) { - $queryParams['limit'] = $limit; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($sort)) { - $sort = ObjectSerializer::serializeCollection($sort, '', true); - } - if ($sort !== null) { - $queryParams['sort'] = $sort; - } // path params @@ -2955,3310 +2905,16 @@ public function getOrganizationFilesRequest($id, $start = 0, $limit = null, $sor } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - [] + ['application/json'] ); } // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - + if (isset($merge_organizations_request)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($merge_organizations_request)); } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getOrganizationFollowers - * - * List followers of an organization - * - * @param int $id The ID of the organization (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\OrganizationFollowersListResponse - */ - public function getOrganizationFollowers($id) - { - list($response) = $this->getOrganizationFollowersWithHttpInfo($id); - return $response; - } - - /** - * Operation getOrganizationFollowersWithHttpInfo - * - * List followers of an organization - * - * @param int $id The ID of the organization (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\OrganizationFollowersListResponse, HTTP status code, HTTP response headers (array of strings) - */ - public function getOrganizationFollowersWithHttpInfo($id) - { - $request = $this->getOrganizationFollowersRequest($id); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->getOrganizationFollowersRequest($id); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\OrganizationFollowersListResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\OrganizationFollowersListResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\OrganizationFollowersListResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\OrganizationFollowersListResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\OrganizationFollowersListResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getOrganizationFollowersAsync - * - * List followers of an organization - * - * @param int $id The ID of the organization (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getOrganizationFollowersAsync($id): PromiseInterface - { - return $this->getOrganizationFollowersAsyncWithHttpInfo($id) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getOrganizationFollowersAsyncWithHttpInfo - * - * List followers of an organization - * - * @param int $id The ID of the organization (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getOrganizationFollowersAsyncWithHttpInfo($id): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\OrganizationFollowersListResponse'; - $request = $this->getOrganizationFollowersRequest($id); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getOrganizationFollowers' - * - * @param int $id The ID of the organization (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - */ - public function getOrganizationFollowersRequest($id): Request - { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getOrganizationFollowers' - ); - } - - $resourcePath = '/organizations/{id}/followers'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getOrganizationMailMessages - * - * List mail messages associated with an organization - * - * @param int $id The ID of the organization (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\ListMailMessagesResponse - */ - public function getOrganizationMailMessages($id, $start = 0, $limit = null) - { - list($response) = $this->getOrganizationMailMessagesWithHttpInfo($id, $start, $limit); - return $response; - } - - /** - * Operation getOrganizationMailMessagesWithHttpInfo - * - * List mail messages associated with an organization - * - * @param int $id The ID of the organization (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\ListMailMessagesResponse, HTTP status code, HTTP response headers (array of strings) - */ - public function getOrganizationMailMessagesWithHttpInfo($id, $start = 0, $limit = null) - { - $request = $this->getOrganizationMailMessagesRequest($id, $start, $limit); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->getOrganizationMailMessagesRequest($id, $start, $limit); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListMailMessagesResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListMailMessagesResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListMailMessagesResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListMailMessagesResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\ListMailMessagesResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getOrganizationMailMessagesAsync - * - * List mail messages associated with an organization - * - * @param int $id The ID of the organization (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getOrganizationMailMessagesAsync($id, $start = 0, $limit = null): PromiseInterface - { - return $this->getOrganizationMailMessagesAsyncWithHttpInfo($id, $start, $limit) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getOrganizationMailMessagesAsyncWithHttpInfo - * - * List mail messages associated with an organization - * - * @param int $id The ID of the organization (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getOrganizationMailMessagesAsyncWithHttpInfo($id, $start = 0, $limit = null): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\ListMailMessagesResponse'; - $request = $this->getOrganizationMailMessagesRequest($id, $start, $limit); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getOrganizationMailMessages' - * - * @param int $id The ID of the organization (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - */ - public function getOrganizationMailMessagesRequest($id, $start = 0, $limit = null): Request - { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getOrganizationMailMessages' - ); - } - - $resourcePath = '/organizations/{id}/mailMessages'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - /* @phpstan-ignore-next-line */ - if (is_array($start)) { - $start = ObjectSerializer::serializeCollection($start, '', true); - } - if ($start !== null) { - $queryParams['start'] = $start; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($limit)) { - $limit = ObjectSerializer::serializeCollection($limit, '', true); - } - if ($limit !== null) { - $queryParams['limit'] = $limit; - } - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getOrganizationPersons - * - * List persons of an organization - * - * @param int $id The ID of the organization (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\ListPersonsResponse - * @deprecated - */ - public function getOrganizationPersons($id, $start = 0, $limit = null) - { - list($response) = $this->getOrganizationPersonsWithHttpInfo($id, $start, $limit); - return $response; - } - - /** - * Operation getOrganizationPersonsWithHttpInfo - * - * List persons of an organization - * - * @param int $id The ID of the organization (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\ListPersonsResponse, HTTP status code, HTTP response headers (array of strings) - * @deprecated - */ - public function getOrganizationPersonsWithHttpInfo($id, $start = 0, $limit = null) - { - $request = $this->getOrganizationPersonsRequest($id, $start, $limit); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->getOrganizationPersonsRequest($id, $start, $limit); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListPersonsResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListPersonsResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListPersonsResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListPersonsResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\ListPersonsResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getOrganizationPersonsAsync - * - * List persons of an organization - * - * @param int $id The ID of the organization (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function getOrganizationPersonsAsync($id, $start = 0, $limit = null): PromiseInterface - { - return $this->getOrganizationPersonsAsyncWithHttpInfo($id, $start, $limit) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getOrganizationPersonsAsyncWithHttpInfo - * - * List persons of an organization - * - * @param int $id The ID of the organization (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function getOrganizationPersonsAsyncWithHttpInfo($id, $start = 0, $limit = null): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\ListPersonsResponse'; - $request = $this->getOrganizationPersonsRequest($id, $start, $limit); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getOrganizationPersons' - * - * @param int $id The ID of the organization (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - * @deprecated - */ - public function getOrganizationPersonsRequest($id, $start = 0, $limit = null): Request - { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getOrganizationPersons' - ); - } - - $resourcePath = '/organizations/{id}/persons'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - /* @phpstan-ignore-next-line */ - if (is_array($start)) { - $start = ObjectSerializer::serializeCollection($start, '', true); - } - if ($start !== null) { - $queryParams['start'] = $start; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($limit)) { - $limit = ObjectSerializer::serializeCollection($limit, '', true); - } - if ($limit !== null) { - $queryParams['limit'] = $limit; - } - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getOrganizationUpdates - * - * List updates about an organization - * - * @param int $id The ID of the organization (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|null $all_changes Whether to show custom field updates or not. 1 = Include custom field changes. If omitted, returns changes without custom field updates. (optional) - * @param string|null $items A comma-separated string for filtering out item specific updates. (Possible values - activity, plannedActivity, note, file, change, deal, follower, participant, mailMessage, mailMessageWithAttachment, invoice, activityFile, document). (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\OrganizationFlowResponse - */ - public function getOrganizationUpdates($id, $start = 0, $limit = null, $all_changes = null, $items = null) - { - list($response) = $this->getOrganizationUpdatesWithHttpInfo($id, $start, $limit, $all_changes, $items); - return $response; - } - - /** - * Operation getOrganizationUpdatesWithHttpInfo - * - * List updates about an organization - * - * @param int $id The ID of the organization (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|null $all_changes Whether to show custom field updates or not. 1 = Include custom field changes. If omitted, returns changes without custom field updates. (optional) - * @param string|null $items A comma-separated string for filtering out item specific updates. (Possible values - activity, plannedActivity, note, file, change, deal, follower, participant, mailMessage, mailMessageWithAttachment, invoice, activityFile, document). (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\OrganizationFlowResponse, HTTP status code, HTTP response headers (array of strings) - */ - public function getOrganizationUpdatesWithHttpInfo($id, $start = 0, $limit = null, $all_changes = null, $items = null) - { - $request = $this->getOrganizationUpdatesRequest($id, $start, $limit, $all_changes, $items); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->getOrganizationUpdatesRequest($id, $start, $limit, $all_changes, $items); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\OrganizationFlowResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\OrganizationFlowResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\OrganizationFlowResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\OrganizationFlowResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\OrganizationFlowResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getOrganizationUpdatesAsync - * - * List updates about an organization - * - * @param int $id The ID of the organization (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|null $all_changes Whether to show custom field updates or not. 1 = Include custom field changes. If omitted, returns changes without custom field updates. (optional) - * @param string|null $items A comma-separated string for filtering out item specific updates. (Possible values - activity, plannedActivity, note, file, change, deal, follower, participant, mailMessage, mailMessageWithAttachment, invoice, activityFile, document). (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getOrganizationUpdatesAsync($id, $start = 0, $limit = null, $all_changes = null, $items = null): PromiseInterface - { - return $this->getOrganizationUpdatesAsyncWithHttpInfo($id, $start, $limit, $all_changes, $items) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getOrganizationUpdatesAsyncWithHttpInfo - * - * List updates about an organization - * - * @param int $id The ID of the organization (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|null $all_changes Whether to show custom field updates or not. 1 = Include custom field changes. If omitted, returns changes without custom field updates. (optional) - * @param string|null $items A comma-separated string for filtering out item specific updates. (Possible values - activity, plannedActivity, note, file, change, deal, follower, participant, mailMessage, mailMessageWithAttachment, invoice, activityFile, document). (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getOrganizationUpdatesAsyncWithHttpInfo($id, $start = 0, $limit = null, $all_changes = null, $items = null): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\OrganizationFlowResponse'; - $request = $this->getOrganizationUpdatesRequest($id, $start, $limit, $all_changes, $items); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getOrganizationUpdates' - * - * @param int $id The ID of the organization (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|null $all_changes Whether to show custom field updates or not. 1 = Include custom field changes. If omitted, returns changes without custom field updates. (optional) - * @param string|null $items A comma-separated string for filtering out item specific updates. (Possible values - activity, plannedActivity, note, file, change, deal, follower, participant, mailMessage, mailMessageWithAttachment, invoice, activityFile, document). (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - */ - public function getOrganizationUpdatesRequest($id, $start = 0, $limit = null, $all_changes = null, $items = null): Request - { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getOrganizationUpdates' - ); - } - - $resourcePath = '/organizations/{id}/flow'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - /* @phpstan-ignore-next-line */ - if (is_array($start)) { - $start = ObjectSerializer::serializeCollection($start, '', true); - } - if ($start !== null) { - $queryParams['start'] = $start; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($limit)) { - $limit = ObjectSerializer::serializeCollection($limit, '', true); - } - if ($limit !== null) { - $queryParams['limit'] = $limit; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($all_changes)) { - $all_changes = ObjectSerializer::serializeCollection($all_changes, '', true); - } - if ($all_changes !== null) { - $queryParams['all_changes'] = $all_changes; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($items)) { - $items = ObjectSerializer::serializeCollection($items, '', true); - } - if ($items !== null) { - $queryParams['items'] = $items; - } - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getOrganizationUsers - * - * List permitted users - * - * @param int $id The ID of the organization (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\ListPermittedUsersResponse1 - */ - public function getOrganizationUsers($id) - { - list($response) = $this->getOrganizationUsersWithHttpInfo($id); - return $response; - } - - /** - * Operation getOrganizationUsersWithHttpInfo - * - * List permitted users - * - * @param int $id The ID of the organization (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\ListPermittedUsersResponse1, HTTP status code, HTTP response headers (array of strings) - */ - public function getOrganizationUsersWithHttpInfo($id) - { - $request = $this->getOrganizationUsersRequest($id); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->getOrganizationUsersRequest($id); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListPermittedUsersResponse1' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListPermittedUsersResponse1', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListPermittedUsersResponse1' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListPermittedUsersResponse1', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\ListPermittedUsersResponse1', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getOrganizationUsersAsync - * - * List permitted users - * - * @param int $id The ID of the organization (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getOrganizationUsersAsync($id): PromiseInterface - { - return $this->getOrganizationUsersAsyncWithHttpInfo($id) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getOrganizationUsersAsyncWithHttpInfo - * - * List permitted users - * - * @param int $id The ID of the organization (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getOrganizationUsersAsyncWithHttpInfo($id): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\ListPermittedUsersResponse1'; - $request = $this->getOrganizationUsersRequest($id); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getOrganizationUsers' - * - * @param int $id The ID of the organization (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - */ - public function getOrganizationUsersRequest($id): Request - { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getOrganizationUsers' - ); - } - - $resourcePath = '/organizations/{id}/permittedUsers'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getOrganizations - * - * Get all organizations - * - * @param int|null $user_id If supplied, only organizations owned by the given user will be returned. However, `filter_id` takes precedence over `user_id` when both are supplied. (optional) - * @param int|null $filter_id The ID of the filter to use (optional) - * @param string|null $first_char If supplied, only organizations whose name starts with the specified letter will be returned (case-insensitive) (optional) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\AllOrganizationsGetResponse - * @deprecated - */ - public function getOrganizations($user_id = null, $filter_id = null, $first_char = null, $start = 0, $limit = null, $sort = null) - { - list($response) = $this->getOrganizationsWithHttpInfo($user_id, $filter_id, $first_char, $start, $limit, $sort); - return $response; - } - - /** - * Operation getOrganizationsWithHttpInfo - * - * Get all organizations - * - * @param int|null $user_id If supplied, only organizations owned by the given user will be returned. However, `filter_id` takes precedence over `user_id` when both are supplied. (optional) - * @param int|null $filter_id The ID of the filter to use (optional) - * @param string|null $first_char If supplied, only organizations whose name starts with the specified letter will be returned (case-insensitive) (optional) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\AllOrganizationsGetResponse, HTTP status code, HTTP response headers (array of strings) - * @deprecated - */ - public function getOrganizationsWithHttpInfo($user_id = null, $filter_id = null, $first_char = null, $start = 0, $limit = null, $sort = null) - { - $request = $this->getOrganizationsRequest($user_id, $filter_id, $first_char, $start, $limit, $sort); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->getOrganizationsRequest($user_id, $filter_id, $first_char, $start, $limit, $sort); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\AllOrganizationsGetResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\AllOrganizationsGetResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\AllOrganizationsGetResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\AllOrganizationsGetResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\AllOrganizationsGetResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getOrganizationsAsync - * - * Get all organizations - * - * @param int|null $user_id If supplied, only organizations owned by the given user will be returned. However, `filter_id` takes precedence over `user_id` when both are supplied. (optional) - * @param int|null $filter_id The ID of the filter to use (optional) - * @param string|null $first_char If supplied, only organizations whose name starts with the specified letter will be returned (case-insensitive) (optional) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function getOrganizationsAsync($user_id = null, $filter_id = null, $first_char = null, $start = 0, $limit = null, $sort = null): PromiseInterface - { - return $this->getOrganizationsAsyncWithHttpInfo($user_id, $filter_id, $first_char, $start, $limit, $sort) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getOrganizationsAsyncWithHttpInfo - * - * Get all organizations - * - * @param int|null $user_id If supplied, only organizations owned by the given user will be returned. However, `filter_id` takes precedence over `user_id` when both are supplied. (optional) - * @param int|null $filter_id The ID of the filter to use (optional) - * @param string|null $first_char If supplied, only organizations whose name starts with the specified letter will be returned (case-insensitive) (optional) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function getOrganizationsAsyncWithHttpInfo($user_id = null, $filter_id = null, $first_char = null, $start = 0, $limit = null, $sort = null): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\AllOrganizationsGetResponse'; - $request = $this->getOrganizationsRequest($user_id, $filter_id, $first_char, $start, $limit, $sort); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getOrganizations' - * - * @param int|null $user_id If supplied, only organizations owned by the given user will be returned. However, `filter_id` takes precedence over `user_id` when both are supplied. (optional) - * @param int|null $filter_id The ID of the filter to use (optional) - * @param string|null $first_char If supplied, only organizations whose name starts with the specified letter will be returned (case-insensitive) (optional) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - * @deprecated - */ - public function getOrganizationsRequest($user_id = null, $filter_id = null, $first_char = null, $start = 0, $limit = null, $sort = null): Request - { - - $resourcePath = '/organizations'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - /* @phpstan-ignore-next-line */ - if (is_array($user_id)) { - $user_id = ObjectSerializer::serializeCollection($user_id, '', true); - } - if ($user_id !== null) { - $queryParams['user_id'] = $user_id; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($filter_id)) { - $filter_id = ObjectSerializer::serializeCollection($filter_id, '', true); - } - if ($filter_id !== null) { - $queryParams['filter_id'] = $filter_id; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($first_char)) { - $first_char = ObjectSerializer::serializeCollection($first_char, '', true); - } - if ($first_char !== null) { - $queryParams['first_char'] = $first_char; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($start)) { - $start = ObjectSerializer::serializeCollection($start, '', true); - } - if ($start !== null) { - $queryParams['start'] = $start; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($limit)) { - $limit = ObjectSerializer::serializeCollection($limit, '', true); - } - if ($limit !== null) { - $queryParams['limit'] = $limit; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($sort)) { - $sort = ObjectSerializer::serializeCollection($sort, '', true); - } - if ($sort !== null) { - $queryParams['sort'] = $sort; - } - - - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getOrganizationsCollection - * - * Get all organizations collection - * - * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) - * @param int|null $limit For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. (optional) - * @param string|null $since The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) - * @param string|null $until The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) - * @param int|null $owner_id If supplied, only organizations owned by the given user will be returned (optional) - * @param string|null $first_char If supplied, only organizations whose name starts with the specified letter will be returned (case-insensitive) (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\InlineResponse200|\Pipedrive\versions\v1\Model\FailResponse - * @deprecated - */ - public function getOrganizationsCollection($cursor = null, $limit = null, $since = null, $until = null, $owner_id = null, $first_char = null) - { - list($response) = $this->getOrganizationsCollectionWithHttpInfo($cursor, $limit, $since, $until, $owner_id, $first_char); - return $response; - } - - /** - * Operation getOrganizationsCollectionWithHttpInfo - * - * Get all organizations collection - * - * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) - * @param int|null $limit For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. (optional) - * @param string|null $since The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) - * @param string|null $until The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) - * @param int|null $owner_id If supplied, only organizations owned by the given user will be returned (optional) - * @param string|null $first_char If supplied, only organizations whose name starts with the specified letter will be returned (case-insensitive) (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\InlineResponse200|\Pipedrive\versions\v1\Model\FailResponse, HTTP status code, HTTP response headers (array of strings) - * @deprecated - */ - public function getOrganizationsCollectionWithHttpInfo($cursor = null, $limit = null, $since = null, $until = null, $owner_id = null, $first_char = null) - { - $request = $this->getOrganizationsCollectionRequest($cursor, $limit, $since, $until, $owner_id, $first_char); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->getOrganizationsCollectionRequest($cursor, $limit, $since, $until, $owner_id, $first_char); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\InlineResponse200' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\InlineResponse200', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 403: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\FailResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\FailResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\InlineResponse200' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\InlineResponse200', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\InlineResponse200', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\FailResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getOrganizationsCollectionAsync - * - * Get all organizations collection - * - * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) - * @param int|null $limit For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. (optional) - * @param string|null $since The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) - * @param string|null $until The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) - * @param int|null $owner_id If supplied, only organizations owned by the given user will be returned (optional) - * @param string|null $first_char If supplied, only organizations whose name starts with the specified letter will be returned (case-insensitive) (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function getOrganizationsCollectionAsync($cursor = null, $limit = null, $since = null, $until = null, $owner_id = null, $first_char = null): PromiseInterface - { - return $this->getOrganizationsCollectionAsyncWithHttpInfo($cursor, $limit, $since, $until, $owner_id, $first_char) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getOrganizationsCollectionAsyncWithHttpInfo - * - * Get all organizations collection - * - * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) - * @param int|null $limit For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. (optional) - * @param string|null $since The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) - * @param string|null $until The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) - * @param int|null $owner_id If supplied, only organizations owned by the given user will be returned (optional) - * @param string|null $first_char If supplied, only organizations whose name starts with the specified letter will be returned (case-insensitive) (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function getOrganizationsCollectionAsyncWithHttpInfo($cursor = null, $limit = null, $since = null, $until = null, $owner_id = null, $first_char = null): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\InlineResponse200'; - $request = $this->getOrganizationsCollectionRequest($cursor, $limit, $since, $until, $owner_id, $first_char); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getOrganizationsCollection' - * - * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) - * @param int|null $limit For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. (optional) - * @param string|null $since The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) - * @param string|null $until The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) - * @param int|null $owner_id If supplied, only organizations owned by the given user will be returned (optional) - * @param string|null $first_char If supplied, only organizations whose name starts with the specified letter will be returned (case-insensitive) (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - * @deprecated - */ - public function getOrganizationsCollectionRequest($cursor = null, $limit = null, $since = null, $until = null, $owner_id = null, $first_char = null): Request - { - - $resourcePath = '/organizations/collection'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - /* @phpstan-ignore-next-line */ - if (is_array($cursor)) { - $cursor = ObjectSerializer::serializeCollection($cursor, '', true); - } - if ($cursor !== null) { - $queryParams['cursor'] = $cursor; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($limit)) { - $limit = ObjectSerializer::serializeCollection($limit, '', true); - } - if ($limit !== null) { - $queryParams['limit'] = $limit; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($since)) { - $since = ObjectSerializer::serializeCollection($since, '', true); - } - if ($since !== null) { - $queryParams['since'] = $since; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($until)) { - $until = ObjectSerializer::serializeCollection($until, '', true); - } - if ($until !== null) { - $queryParams['until'] = $until; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($owner_id)) { - $owner_id = ObjectSerializer::serializeCollection($owner_id, '', true); - } - if ($owner_id !== null) { - $queryParams['owner_id'] = $owner_id; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($first_char)) { - $first_char = ObjectSerializer::serializeCollection($first_char, '', true); - } - if ($first_char !== null) { - $queryParams['first_char'] = $first_char; - } - - - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation mergeOrganizations - * - * Merge two organizations - * - * @param int $id The ID of the organization (required) - * @param \Pipedrive\versions\v1\Model\MergeOrganizationsRequest|null $merge_organizations_request merge_organizations_request (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\OrganizationsMergeResponse - */ - public function mergeOrganizations($id, $merge_organizations_request = null) - { - list($response) = $this->mergeOrganizationsWithHttpInfo($id, $merge_organizations_request); - return $response; - } - - /** - * Operation mergeOrganizationsWithHttpInfo - * - * Merge two organizations - * - * @param int $id The ID of the organization (required) - * @param \Pipedrive\versions\v1\Model\MergeOrganizationsRequest|null $merge_organizations_request (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\OrganizationsMergeResponse, HTTP status code, HTTP response headers (array of strings) - */ - public function mergeOrganizationsWithHttpInfo($id, $merge_organizations_request = null) - { - $request = $this->mergeOrganizationsRequest($id, $merge_organizations_request); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->mergeOrganizationsRequest($id, $merge_organizations_request); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\OrganizationsMergeResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\OrganizationsMergeResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\OrganizationsMergeResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\OrganizationsMergeResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\OrganizationsMergeResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation mergeOrganizationsAsync - * - * Merge two organizations - * - * @param int $id The ID of the organization (required) - * @param \Pipedrive\versions\v1\Model\MergeOrganizationsRequest|null $merge_organizations_request (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function mergeOrganizationsAsync($id, $merge_organizations_request = null): PromiseInterface - { - return $this->mergeOrganizationsAsyncWithHttpInfo($id, $merge_organizations_request) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation mergeOrganizationsAsyncWithHttpInfo - * - * Merge two organizations - * - * @param int $id The ID of the organization (required) - * @param \Pipedrive\versions\v1\Model\MergeOrganizationsRequest|null $merge_organizations_request (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function mergeOrganizationsAsyncWithHttpInfo($id, $merge_organizations_request = null): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\OrganizationsMergeResponse'; - $request = $this->mergeOrganizationsRequest($id, $merge_organizations_request); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'mergeOrganizations' - * - * @param int $id The ID of the organization (required) - * @param \Pipedrive\versions\v1\Model\MergeOrganizationsRequest|null $merge_organizations_request (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - */ - public function mergeOrganizationsRequest($id, $merge_organizations_request = null): Request - { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling mergeOrganizations' - ); - } - - $resourcePath = '/organizations/{id}/merge'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($merge_organizations_request)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($merge_organizations_request)); - } else { - $httpBody = $merge_organizations_request; - } - } elseif (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation searchOrganization - * - * Search organizations - * - * @param string $term The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded. (required) - * @param string|null $fields A comma-separated string array. The fields to perform the search from. Defaults to all of them. Only the following custom field types are searchable: `address`, `varchar`, `text`, `varchar_auto`, `double`, `monetary` and `phone`. Read more about searching by custom fields <a href=\"https://support.pipedrive.com/en/article/search-finding-what-you-need#searching-by-custom-fields\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>. (optional) - * @param bool|null $exact_match When enabled, only full exact matches against the given term are returned. It is <b>not</b> case sensitive. (optional) - * @param int|0 $start Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter. (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\OrganizationSearchResponse - * @deprecated - */ - public function searchOrganization($term, $fields = null, $exact_match = null, $start = 0, $limit = null) - { - list($response) = $this->searchOrganizationWithHttpInfo($term, $fields, $exact_match, $start, $limit); - return $response; - } - - /** - * Operation searchOrganizationWithHttpInfo - * - * Search organizations - * - * @param string $term The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded. (required) - * @param string|null $fields A comma-separated string array. The fields to perform the search from. Defaults to all of them. Only the following custom field types are searchable: `address`, `varchar`, `text`, `varchar_auto`, `double`, `monetary` and `phone`. Read more about searching by custom fields <a href=\"https://support.pipedrive.com/en/article/search-finding-what-you-need#searching-by-custom-fields\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>. (optional) - * @param bool|null $exact_match When enabled, only full exact matches against the given term are returned. It is <b>not</b> case sensitive. (optional) - * @param int|0 $start Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter. (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\OrganizationSearchResponse, HTTP status code, HTTP response headers (array of strings) - * @deprecated - */ - public function searchOrganizationWithHttpInfo($term, $fields = null, $exact_match = null, $start = 0, $limit = null) - { - $request = $this->searchOrganizationRequest($term, $fields, $exact_match, $start, $limit); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->searchOrganizationRequest($term, $fields, $exact_match, $start, $limit); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\OrganizationSearchResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\OrganizationSearchResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\OrganizationSearchResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\OrganizationSearchResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\OrganizationSearchResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation searchOrganizationAsync - * - * Search organizations - * - * @param string $term The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded. (required) - * @param string|null $fields A comma-separated string array. The fields to perform the search from. Defaults to all of them. Only the following custom field types are searchable: `address`, `varchar`, `text`, `varchar_auto`, `double`, `monetary` and `phone`. Read more about searching by custom fields <a href=\"https://support.pipedrive.com/en/article/search-finding-what-you-need#searching-by-custom-fields\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>. (optional) - * @param bool|null $exact_match When enabled, only full exact matches against the given term are returned. It is <b>not</b> case sensitive. (optional) - * @param int|0 $start Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter. (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function searchOrganizationAsync($term, $fields = null, $exact_match = null, $start = 0, $limit = null): PromiseInterface - { - return $this->searchOrganizationAsyncWithHttpInfo($term, $fields, $exact_match, $start, $limit) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation searchOrganizationAsyncWithHttpInfo - * - * Search organizations - * - * @param string $term The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded. (required) - * @param string|null $fields A comma-separated string array. The fields to perform the search from. Defaults to all of them. Only the following custom field types are searchable: `address`, `varchar`, `text`, `varchar_auto`, `double`, `monetary` and `phone`. Read more about searching by custom fields <a href=\"https://support.pipedrive.com/en/article/search-finding-what-you-need#searching-by-custom-fields\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>. (optional) - * @param bool|null $exact_match When enabled, only full exact matches against the given term are returned. It is <b>not</b> case sensitive. (optional) - * @param int|0 $start Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter. (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function searchOrganizationAsyncWithHttpInfo($term, $fields = null, $exact_match = null, $start = 0, $limit = null): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\OrganizationSearchResponse'; - $request = $this->searchOrganizationRequest($term, $fields, $exact_match, $start, $limit); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'searchOrganization' - * - * @param string $term The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded. (required) - * @param string|null $fields A comma-separated string array. The fields to perform the search from. Defaults to all of them. Only the following custom field types are searchable: `address`, `varchar`, `text`, `varchar_auto`, `double`, `monetary` and `phone`. Read more about searching by custom fields <a href=\"https://support.pipedrive.com/en/article/search-finding-what-you-need#searching-by-custom-fields\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>. (optional) - * @param bool|null $exact_match When enabled, only full exact matches against the given term are returned. It is <b>not</b> case sensitive. (optional) - * @param int|0 $start Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter. (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - * @deprecated - */ - public function searchOrganizationRequest($term, $fields = null, $exact_match = null, $start = 0, $limit = null): Request - { - // verify the required parameter 'term' is set - /* @phpstan-ignore-next-line */ - if ($term === null || (is_array($term) && count($term) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $term when calling searchOrganization' - ); - } - - $resourcePath = '/organizations/search'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - /* @phpstan-ignore-next-line */ - if (is_array($term)) { - $term = ObjectSerializer::serializeCollection($term, '', true); - } - if ($term !== null) { - $queryParams['term'] = $term; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($fields)) { - $fields = ObjectSerializer::serializeCollection($fields, '', true); - } - if ($fields !== null) { - $queryParams['fields'] = $fields; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($exact_match)) { - $exact_match = ObjectSerializer::serializeCollection($exact_match, '', true); - } - if ($exact_match !== null) { - $queryParams['exact_match'] = $exact_match; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($start)) { - $start = ObjectSerializer::serializeCollection($start, '', true); - } - if ($start !== null) { - $queryParams['start'] = $start; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($limit)) { - $limit = ObjectSerializer::serializeCollection($limit, '', true); - } - if ($limit !== null) { - $queryParams['limit'] = $limit; - } - - - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation updateOrganization - * - * Update an organization - * - * @param int $id The ID of the organization (required) - * @param \Pipedrive\versions\v1\Model\UpdateOrganization|null $update_organization update_organization (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\OrganizationUpdateResponse - * @deprecated - */ - public function updateOrganization($id, $update_organization = null) - { - list($response) = $this->updateOrganizationWithHttpInfo($id, $update_organization); - return $response; - } - - /** - * Operation updateOrganizationWithHttpInfo - * - * Update an organization - * - * @param int $id The ID of the organization (required) - * @param \Pipedrive\versions\v1\Model\UpdateOrganization|null $update_organization (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\OrganizationUpdateResponse, HTTP status code, HTTP response headers (array of strings) - * @deprecated - */ - public function updateOrganizationWithHttpInfo($id, $update_organization = null) - { - $request = $this->updateOrganizationRequest($id, $update_organization); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->updateOrganizationRequest($id, $update_organization); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\OrganizationUpdateResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\OrganizationUpdateResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\OrganizationUpdateResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\OrganizationUpdateResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\OrganizationUpdateResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation updateOrganizationAsync - * - * Update an organization - * - * @param int $id The ID of the organization (required) - * @param \Pipedrive\versions\v1\Model\UpdateOrganization|null $update_organization (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function updateOrganizationAsync($id, $update_organization = null): PromiseInterface - { - return $this->updateOrganizationAsyncWithHttpInfo($id, $update_organization) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateOrganizationAsyncWithHttpInfo - * - * Update an organization - * - * @param int $id The ID of the organization (required) - * @param \Pipedrive\versions\v1\Model\UpdateOrganization|null $update_organization (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function updateOrganizationAsyncWithHttpInfo($id, $update_organization = null): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\OrganizationUpdateResponse'; - $request = $this->updateOrganizationRequest($id, $update_organization); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'updateOrganization' - * - * @param int $id The ID of the organization (required) - * @param \Pipedrive\versions\v1\Model\UpdateOrganization|null $update_organization (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - * @deprecated - */ - public function updateOrganizationRequest($id, $update_organization = null): Request - { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling updateOrganization' - ); - } - - $resourcePath = '/organizations/{id}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($update_organization)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_organization)); - } else { - $httpBody = $update_organization; + $httpBody = $merge_organizations_request; } } elseif (count($formParams) > 0) { /* @phpstan-ignore-next-line */ diff --git a/lib/versions/v1/Api/PersonsApi.php b/lib/versions/v1/Api/PersonsApi.php index 9f9a3245..30086b11 100644 --- a/lib/versions/v1/Api/PersonsApi.php +++ b/lib/versions/v1/Api/PersonsApi.php @@ -122,298 +122,6 @@ public function getConfig(): Configuration return $this->config; } - /** - * Operation addPerson - * - * Add a person - * - * @param \Pipedrive\versions\v1\Model\NewPerson|null $new_person new_person (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\AddPersonResponse - * @deprecated - */ - public function addPerson($new_person = null) - { - list($response) = $this->addPersonWithHttpInfo($new_person); - return $response; - } - - /** - * Operation addPersonWithHttpInfo - * - * Add a person - * - * @param \Pipedrive\versions\v1\Model\NewPerson|null $new_person (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\AddPersonResponse, HTTP status code, HTTP response headers (array of strings) - * @deprecated - */ - public function addPersonWithHttpInfo($new_person = null) - { - $request = $this->addPersonRequest($new_person); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->addPersonRequest($new_person); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 201: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\AddPersonResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\AddPersonResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\AddPersonResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\AddPersonResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\AddPersonResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation addPersonAsync - * - * Add a person - * - * @param \Pipedrive\versions\v1\Model\NewPerson|null $new_person (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function addPersonAsync($new_person = null): PromiseInterface - { - return $this->addPersonAsyncWithHttpInfo($new_person) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation addPersonAsyncWithHttpInfo - * - * Add a person - * - * @param \Pipedrive\versions\v1\Model\NewPerson|null $new_person (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function addPersonAsyncWithHttpInfo($new_person = null): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\AddPersonResponse'; - $request = $this->addPersonRequest($new_person); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'addPerson' - * - * @param \Pipedrive\versions\v1\Model\NewPerson|null $new_person (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - * @deprecated - */ - public function addPersonRequest($new_person = null): Request - { - - $resourcePath = '/persons'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($new_person)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($new_person)); - } else { - $httpBody = $new_person; - } - } elseif (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - /** * Operation addPersonFollower * @@ -1079,38 +787,38 @@ public function addPersonPictureRequest($id, $file, $crop_x = null, $crop_y = nu } /** - * Operation deletePerson + * Operation deletePersonFollower * - * Delete a person + * Delete a follower from a person * * @param int $id The ID of the person (required) + * @param int $follower_id The ID of the relationship between the follower and the person (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException * @return \Pipedrive\versions\v1\Model\DeletePersonResponse - * @deprecated */ - public function deletePerson($id) + public function deletePersonFollower($id, $follower_id) { - list($response) = $this->deletePersonWithHttpInfo($id); + list($response) = $this->deletePersonFollowerWithHttpInfo($id, $follower_id); return $response; } /** - * Operation deletePersonWithHttpInfo + * Operation deletePersonFollowerWithHttpInfo * - * Delete a person + * Delete a follower from a person * * @param int $id The ID of the person (required) + * @param int $follower_id The ID of the relationship between the follower and the person (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException * @return array of \Pipedrive\versions\v1\Model\DeletePersonResponse, HTTP status code, HTTP response headers (array of strings) - * @deprecated */ - public function deletePersonWithHttpInfo($id) + public function deletePersonFollowerWithHttpInfo($id, $follower_id) { - $request = $this->deletePersonRequest($id); + $request = $this->deletePersonFollowerRequest($id, $follower_id); try { $options = $this->createHttpClientOption(); @@ -1119,7 +827,7 @@ public function deletePersonWithHttpInfo($id) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->deletePersonRequest($id); + $request = $this->deletePersonFollowerRequest($id, $follower_id); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -1199,19 +907,19 @@ public function deletePersonWithHttpInfo($id) } /** - * Operation deletePersonAsync + * Operation deletePersonFollowerAsync * - * Delete a person + * Delete a follower from a person * * @param int $id The ID of the person (required) + * @param int $follower_id The ID of the relationship between the follower and the person (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function deletePersonAsync($id): PromiseInterface + public function deletePersonFollowerAsync($id, $follower_id): PromiseInterface { - return $this->deletePersonAsyncWithHttpInfo($id) + return $this->deletePersonFollowerAsyncWithHttpInfo($id, $follower_id) ->then( function ($response) { return $response[0]; @@ -1220,20 +928,20 @@ function ($response) { } /** - * Operation deletePersonAsyncWithHttpInfo + * Operation deletePersonFollowerAsyncWithHttpInfo * - * Delete a person + * Delete a follower from a person * * @param int $id The ID of the person (required) + * @param int $follower_id The ID of the relationship between the follower and the person (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function deletePersonAsyncWithHttpInfo($id): PromiseInterface + public function deletePersonFollowerAsyncWithHttpInfo($id, $follower_id): PromiseInterface { $returnType = '\Pipedrive\versions\v1\Model\DeletePersonResponse'; - $request = $this->deletePersonRequest($id); + $request = $this->deletePersonFollowerRequest($id, $follower_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1270,2601 +978,32 @@ function ($exception) { } /** - * Create request for operation 'deletePerson' - * - * @param int $id The ID of the person (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - * @deprecated - */ - public function deletePersonRequest($id): Request - { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling deletePerson' - ); - } - - $resourcePath = '/persons/{id}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation deletePersonFollower - * - * Delete a follower from a person - * - * @param int $id The ID of the person (required) - * @param int $follower_id The ID of the relationship between the follower and the person (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\DeletePersonResponse - */ - public function deletePersonFollower($id, $follower_id) - { - list($response) = $this->deletePersonFollowerWithHttpInfo($id, $follower_id); - return $response; - } - - /** - * Operation deletePersonFollowerWithHttpInfo - * - * Delete a follower from a person - * - * @param int $id The ID of the person (required) - * @param int $follower_id The ID of the relationship between the follower and the person (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\DeletePersonResponse, HTTP status code, HTTP response headers (array of strings) - */ - public function deletePersonFollowerWithHttpInfo($id, $follower_id) - { - $request = $this->deletePersonFollowerRequest($id, $follower_id); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->deletePersonFollowerRequest($id, $follower_id); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\DeletePersonResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DeletePersonResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\DeletePersonResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DeletePersonResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\DeletePersonResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation deletePersonFollowerAsync - * - * Delete a follower from a person + * Create request for operation 'deletePersonFollower' * * @param int $id The ID of the person (required) * @param int $follower_id The ID of the relationship between the follower and the person (required) * * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface + * @return Request */ - public function deletePersonFollowerAsync($id, $follower_id): PromiseInterface - { - return $this->deletePersonFollowerAsyncWithHttpInfo($id, $follower_id) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation deletePersonFollowerAsyncWithHttpInfo - * - * Delete a follower from a person - * - * @param int $id The ID of the person (required) - * @param int $follower_id The ID of the relationship between the follower and the person (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function deletePersonFollowerAsyncWithHttpInfo($id, $follower_id): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\DeletePersonResponse'; - $request = $this->deletePersonFollowerRequest($id, $follower_id); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'deletePersonFollower' - * - * @param int $id The ID of the person (required) - * @param int $follower_id The ID of the relationship between the follower and the person (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - */ - public function deletePersonFollowerRequest($id, $follower_id): Request - { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling deletePersonFollower' - ); - } - // verify the required parameter 'follower_id' is set - /* @phpstan-ignore-next-line */ - if ($follower_id === null || (is_array($follower_id) && count($follower_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $follower_id when calling deletePersonFollower' - ); - } - - $resourcePath = '/persons/{id}/followers/{follower_id}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - // path params - if ($follower_id !== null) { - $resourcePath = str_replace( - '{' . 'follower_id' . '}', - ObjectSerializer::toPathValue($follower_id), - $resourcePath - ); - } - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation deletePersonPicture - * - * Delete person picture - * - * @param int $id The ID of the person (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\DeletePersonResponse - */ - public function deletePersonPicture($id) - { - list($response) = $this->deletePersonPictureWithHttpInfo($id); - return $response; - } - - /** - * Operation deletePersonPictureWithHttpInfo - * - * Delete person picture - * - * @param int $id The ID of the person (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\DeletePersonResponse, HTTP status code, HTTP response headers (array of strings) - */ - public function deletePersonPictureWithHttpInfo($id) - { - $request = $this->deletePersonPictureRequest($id); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->deletePersonPictureRequest($id); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\DeletePersonResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DeletePersonResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\DeletePersonResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DeletePersonResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\DeletePersonResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation deletePersonPictureAsync - * - * Delete person picture - * - * @param int $id The ID of the person (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function deletePersonPictureAsync($id): PromiseInterface - { - return $this->deletePersonPictureAsyncWithHttpInfo($id) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation deletePersonPictureAsyncWithHttpInfo - * - * Delete person picture - * - * @param int $id The ID of the person (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function deletePersonPictureAsyncWithHttpInfo($id): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\DeletePersonResponse'; - $request = $this->deletePersonPictureRequest($id); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'deletePersonPicture' - * - * @param int $id The ID of the person (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - */ - public function deletePersonPictureRequest($id): Request - { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling deletePersonPicture' - ); - } - - $resourcePath = '/persons/{id}/picture'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getPerson - * - * Get details of a person - * - * @param int $id The ID of the person (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\GetPersonDetailsResponse - * @deprecated - */ - public function getPerson($id) - { - list($response) = $this->getPersonWithHttpInfo($id); - return $response; - } - - /** - * Operation getPersonWithHttpInfo - * - * Get details of a person - * - * @param int $id The ID of the person (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\GetPersonDetailsResponse, HTTP status code, HTTP response headers (array of strings) - * @deprecated - */ - public function getPersonWithHttpInfo($id) - { - $request = $this->getPersonRequest($id); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->getPersonRequest($id); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetPersonDetailsResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetPersonDetailsResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetPersonDetailsResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetPersonDetailsResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\GetPersonDetailsResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getPersonAsync - * - * Get details of a person - * - * @param int $id The ID of the person (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function getPersonAsync($id): PromiseInterface - { - return $this->getPersonAsyncWithHttpInfo($id) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getPersonAsyncWithHttpInfo - * - * Get details of a person - * - * @param int $id The ID of the person (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function getPersonAsyncWithHttpInfo($id): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\GetPersonDetailsResponse'; - $request = $this->getPersonRequest($id); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getPerson' - * - * @param int $id The ID of the person (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - * @deprecated - */ - public function getPersonRequest($id): Request - { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getPerson' - ); - } - - $resourcePath = '/persons/{id}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getPersonActivities - * - * List activities associated with a person - * - * @param int $id The ID of the person (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $done Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted, returns both Done and Not done activities. (optional) - * @param string|null $exclude A comma-separated string of activity IDs to exclude from result (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\ListActivitiesResponse - * @deprecated - */ - public function getPersonActivities($id, $start = 0, $limit = null, $done = null, $exclude = null) - { - list($response) = $this->getPersonActivitiesWithHttpInfo($id, $start, $limit, $done, $exclude); - return $response; - } - - /** - * Operation getPersonActivitiesWithHttpInfo - * - * List activities associated with a person - * - * @param int $id The ID of the person (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $done Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted, returns both Done and Not done activities. (optional) - * @param string|null $exclude A comma-separated string of activity IDs to exclude from result (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\ListActivitiesResponse, HTTP status code, HTTP response headers (array of strings) - * @deprecated - */ - public function getPersonActivitiesWithHttpInfo($id, $start = 0, $limit = null, $done = null, $exclude = null) - { - $request = $this->getPersonActivitiesRequest($id, $start, $limit, $done, $exclude); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->getPersonActivitiesRequest($id, $start, $limit, $done, $exclude); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListActivitiesResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListActivitiesResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListActivitiesResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListActivitiesResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\ListActivitiesResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getPersonActivitiesAsync - * - * List activities associated with a person - * - * @param int $id The ID of the person (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $done Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted, returns both Done and Not done activities. (optional) - * @param string|null $exclude A comma-separated string of activity IDs to exclude from result (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function getPersonActivitiesAsync($id, $start = 0, $limit = null, $done = null, $exclude = null): PromiseInterface - { - return $this->getPersonActivitiesAsyncWithHttpInfo($id, $start, $limit, $done, $exclude) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getPersonActivitiesAsyncWithHttpInfo - * - * List activities associated with a person - * - * @param int $id The ID of the person (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $done Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted, returns both Done and Not done activities. (optional) - * @param string|null $exclude A comma-separated string of activity IDs to exclude from result (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function getPersonActivitiesAsyncWithHttpInfo($id, $start = 0, $limit = null, $done = null, $exclude = null): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\ListActivitiesResponse'; - $request = $this->getPersonActivitiesRequest($id, $start, $limit, $done, $exclude); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getPersonActivities' - * - * @param int $id The ID of the person (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $done Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted, returns both Done and Not done activities. (optional) - * @param string|null $exclude A comma-separated string of activity IDs to exclude from result (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - * @deprecated - */ - public function getPersonActivitiesRequest($id, $start = 0, $limit = null, $done = null, $exclude = null): Request - { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getPersonActivities' - ); - } - - $resourcePath = '/persons/{id}/activities'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - /* @phpstan-ignore-next-line */ - if (is_array($start)) { - $start = ObjectSerializer::serializeCollection($start, '', true); - } - if ($start !== null) { - $queryParams['start'] = $start; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($limit)) { - $limit = ObjectSerializer::serializeCollection($limit, '', true); - } - if ($limit !== null) { - $queryParams['limit'] = $limit; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($done)) { - $done = ObjectSerializer::serializeCollection($done, '', true); - } - if ($done !== null) { - $queryParams['done'] = $done; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($exclude)) { - $exclude = ObjectSerializer::serializeCollection($exclude, '', true); - } - if ($exclude !== null) { - $queryParams['exclude'] = $exclude; - } - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getPersonChangelog - * - * List updates about person field values - * - * @param int $id The ID of the person (required) - * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) - * @param int|null $limit Items shown per page (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\ChangelogResponse - */ - public function getPersonChangelog($id, $cursor = null, $limit = null) - { - list($response) = $this->getPersonChangelogWithHttpInfo($id, $cursor, $limit); - return $response; - } - - /** - * Operation getPersonChangelogWithHttpInfo - * - * List updates about person field values - * - * @param int $id The ID of the person (required) - * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) - * @param int|null $limit Items shown per page (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\ChangelogResponse, HTTP status code, HTTP response headers (array of strings) - */ - public function getPersonChangelogWithHttpInfo($id, $cursor = null, $limit = null) - { - $request = $this->getPersonChangelogRequest($id, $cursor, $limit); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->getPersonChangelogRequest($id, $cursor, $limit); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ChangelogResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ChangelogResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ChangelogResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ChangelogResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\ChangelogResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getPersonChangelogAsync - * - * List updates about person field values - * - * @param int $id The ID of the person (required) - * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) - * @param int|null $limit Items shown per page (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getPersonChangelogAsync($id, $cursor = null, $limit = null): PromiseInterface - { - return $this->getPersonChangelogAsyncWithHttpInfo($id, $cursor, $limit) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getPersonChangelogAsyncWithHttpInfo - * - * List updates about person field values - * - * @param int $id The ID of the person (required) - * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) - * @param int|null $limit Items shown per page (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getPersonChangelogAsyncWithHttpInfo($id, $cursor = null, $limit = null): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\ChangelogResponse'; - $request = $this->getPersonChangelogRequest($id, $cursor, $limit); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getPersonChangelog' - * - * @param int $id The ID of the person (required) - * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) - * @param int|null $limit Items shown per page (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - */ - public function getPersonChangelogRequest($id, $cursor = null, $limit = null): Request - { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getPersonChangelog' - ); - } - - $resourcePath = '/persons/{id}/changelog'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - /* @phpstan-ignore-next-line */ - if (is_array($cursor)) { - $cursor = ObjectSerializer::serializeCollection($cursor, '', true); - } - if ($cursor !== null) { - $queryParams['cursor'] = $cursor; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($limit)) { - $limit = ObjectSerializer::serializeCollection($limit, '', true); - } - if ($limit !== null) { - $queryParams['limit'] = $limit; - } - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getPersonDeals - * - * List deals associated with a person - * - * @param int $id The ID of the person (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|'all_not_deleted' $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional, default to 'all_not_deleted') - * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\ListDealsResponse - * @deprecated - */ - public function getPersonDeals($id, $start = 0, $limit = null, $status = 'all_not_deleted', $sort = null) - { - list($response) = $this->getPersonDealsWithHttpInfo($id, $start, $limit, $status, $sort); - return $response; - } - - /** - * Operation getPersonDealsWithHttpInfo - * - * List deals associated with a person - * - * @param int $id The ID of the person (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|'all_not_deleted' $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional, default to 'all_not_deleted') - * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\ListDealsResponse, HTTP status code, HTTP response headers (array of strings) - * @deprecated - */ - public function getPersonDealsWithHttpInfo($id, $start = 0, $limit = null, $status = 'all_not_deleted', $sort = null) - { - $request = $this->getPersonDealsRequest($id, $start, $limit, $status, $sort); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->getPersonDealsRequest($id, $start, $limit, $status, $sort); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListDealsResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListDealsResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListDealsResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListDealsResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\ListDealsResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getPersonDealsAsync - * - * List deals associated with a person - * - * @param int $id The ID of the person (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|'all_not_deleted' $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional, default to 'all_not_deleted') - * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function getPersonDealsAsync($id, $start = 0, $limit = null, $status = 'all_not_deleted', $sort = null): PromiseInterface - { - return $this->getPersonDealsAsyncWithHttpInfo($id, $start, $limit, $status, $sort) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getPersonDealsAsyncWithHttpInfo - * - * List deals associated with a person - * - * @param int $id The ID of the person (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|'all_not_deleted' $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional, default to 'all_not_deleted') - * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function getPersonDealsAsyncWithHttpInfo($id, $start = 0, $limit = null, $status = 'all_not_deleted', $sort = null): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\ListDealsResponse'; - $request = $this->getPersonDealsRequest($id, $start, $limit, $status, $sort); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getPersonDeals' - * - * @param int $id The ID of the person (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|'all_not_deleted' $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional, default to 'all_not_deleted') - * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - * @deprecated - */ - public function getPersonDealsRequest($id, $start = 0, $limit = null, $status = 'all_not_deleted', $sort = null): Request - { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getPersonDeals' - ); - } - - $resourcePath = '/persons/{id}/deals'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - /* @phpstan-ignore-next-line */ - if (is_array($start)) { - $start = ObjectSerializer::serializeCollection($start, '', true); - } - if ($start !== null) { - $queryParams['start'] = $start; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($limit)) { - $limit = ObjectSerializer::serializeCollection($limit, '', true); - } - if ($limit !== null) { - $queryParams['limit'] = $limit; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($status)) { - $status = ObjectSerializer::serializeCollection($status, '', true); - } - if ($status !== null) { - $queryParams['status'] = $status; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($sort)) { - $sort = ObjectSerializer::serializeCollection($sort, '', true); - } - if ($sort !== null) { - $queryParams['sort'] = $sort; - } - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getPersonFiles - * - * List files attached to a person - * - * @param int $id The ID of the person (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) - * @param string|null $sort Supported fields: `id`, `update_time` (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\ListFilesResponse - */ - public function getPersonFiles($id, $start = 0, $limit = null, $sort = null) - { - list($response) = $this->getPersonFilesWithHttpInfo($id, $start, $limit, $sort); - return $response; - } - - /** - * Operation getPersonFilesWithHttpInfo - * - * List files attached to a person - * - * @param int $id The ID of the person (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) - * @param string|null $sort Supported fields: `id`, `update_time` (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\ListFilesResponse, HTTP status code, HTTP response headers (array of strings) - */ - public function getPersonFilesWithHttpInfo($id, $start = 0, $limit = null, $sort = null) - { - $request = $this->getPersonFilesRequest($id, $start, $limit, $sort); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->getPersonFilesRequest($id, $start, $limit, $sort); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListFilesResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListFilesResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListFilesResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListFilesResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\ListFilesResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getPersonFilesAsync - * - * List files attached to a person - * - * @param int $id The ID of the person (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) - * @param string|null $sort Supported fields: `id`, `update_time` (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getPersonFilesAsync($id, $start = 0, $limit = null, $sort = null): PromiseInterface - { - return $this->getPersonFilesAsyncWithHttpInfo($id, $start, $limit, $sort) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getPersonFilesAsyncWithHttpInfo - * - * List files attached to a person - * - * @param int $id The ID of the person (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) - * @param string|null $sort Supported fields: `id`, `update_time` (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getPersonFilesAsyncWithHttpInfo($id, $start = 0, $limit = null, $sort = null): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\ListFilesResponse'; - $request = $this->getPersonFilesRequest($id, $start, $limit, $sort); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getPersonFiles' - * - * @param int $id The ID of the person (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) - * @param string|null $sort Supported fields: `id`, `update_time` (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - */ - public function getPersonFilesRequest($id, $start = 0, $limit = null, $sort = null): Request - { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getPersonFiles' - ); - } - if ($limit !== null && $limit > 100) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling PersonsApi.getPersonFiles, must be smaller than or equal to 100.'); - } - - - $resourcePath = '/persons/{id}/files'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - /* @phpstan-ignore-next-line */ - if (is_array($start)) { - $start = ObjectSerializer::serializeCollection($start, '', true); - } - if ($start !== null) { - $queryParams['start'] = $start; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($limit)) { - $limit = ObjectSerializer::serializeCollection($limit, '', true); - } - if ($limit !== null) { - $queryParams['limit'] = $limit; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($sort)) { - $sort = ObjectSerializer::serializeCollection($sort, '', true); - } - if ($sort !== null) { - $queryParams['sort'] = $sort; - } - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getPersonFollowers - * - * List followers of a person - * - * @param int $id The ID of the person (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\ListFollowersResponse - */ - public function getPersonFollowers($id) - { - list($response) = $this->getPersonFollowersWithHttpInfo($id); - return $response; - } - - /** - * Operation getPersonFollowersWithHttpInfo - * - * List followers of a person - * - * @param int $id The ID of the person (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\ListFollowersResponse, HTTP status code, HTTP response headers (array of strings) - */ - public function getPersonFollowersWithHttpInfo($id) - { - $request = $this->getPersonFollowersRequest($id); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->getPersonFollowersRequest($id); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListFollowersResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListFollowersResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListFollowersResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListFollowersResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\ListFollowersResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getPersonFollowersAsync - * - * List followers of a person - * - * @param int $id The ID of the person (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getPersonFollowersAsync($id): PromiseInterface - { - return $this->getPersonFollowersAsyncWithHttpInfo($id) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getPersonFollowersAsyncWithHttpInfo - * - * List followers of a person - * - * @param int $id The ID of the person (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getPersonFollowersAsyncWithHttpInfo($id): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\ListFollowersResponse'; - $request = $this->getPersonFollowersRequest($id); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getPersonFollowers' - * - * @param int $id The ID of the person (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - */ - public function getPersonFollowersRequest($id): Request + public function deletePersonFollowerRequest($id, $follower_id): Request { // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getPersonFollowers' + 'Missing the required parameter $id when calling deletePersonFollower' + ); + } + // verify the required parameter 'follower_id' is set + /* @phpstan-ignore-next-line */ + if ($follower_id === null || (is_array($follower_id) && count($follower_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $follower_id when calling deletePersonFollower' ); } - $resourcePath = '/persons/{id}/followers'; + $resourcePath = '/persons/{id}/followers/{follower_id}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -3881,6 +1020,14 @@ public function getPersonFollowersRequest($id): Request $resourcePath ); } + // path params + if ($follower_id !== null) { + $resourcePath = str_replace( + '{' . 'follower_id' . '}', + ObjectSerializer::toPathValue($follower_id), + $resourcePath + ); + } /* @phpstan-ignore-next-line */ @@ -3948,7 +1095,7 @@ public function getPersonFollowersRequest($id): Request $query = Query::build($queryParams); return new Request( - 'GET', + 'DELETE', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -3956,40 +1103,36 @@ public function getPersonFollowersRequest($id): Request } /** - * Operation getPersonMailMessages + * Operation deletePersonPicture * - * List mail messages associated with a person + * Delete person picture * * @param int $id The ID of the person (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\ListMailMessagesResponse + * @return \Pipedrive\versions\v1\Model\DeletePersonResponse */ - public function getPersonMailMessages($id, $start = 0, $limit = null) + public function deletePersonPicture($id) { - list($response) = $this->getPersonMailMessagesWithHttpInfo($id, $start, $limit); + list($response) = $this->deletePersonPictureWithHttpInfo($id); return $response; } /** - * Operation getPersonMailMessagesWithHttpInfo + * Operation deletePersonPictureWithHttpInfo * - * List mail messages associated with a person + * Delete person picture * * @param int $id The ID of the person (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\ListMailMessagesResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v1\Model\DeletePersonResponse, HTTP status code, HTTP response headers (array of strings) */ - public function getPersonMailMessagesWithHttpInfo($id, $start = 0, $limit = null) + public function deletePersonPictureWithHttpInfo($id) { - $request = $this->getPersonMailMessagesRequest($id, $start, $limit); + $request = $this->deletePersonPictureRequest($id); try { $options = $this->createHttpClientOption(); @@ -3998,7 +1141,7 @@ public function getPersonMailMessagesWithHttpInfo($id, $start = 0, $limit = null } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getPersonMailMessagesRequest($id, $start, $limit); + $request = $this->deletePersonPictureRequest($id); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -4023,14 +1166,14 @@ public function getPersonMailMessagesWithHttpInfo($id, $start = 0, $limit = null switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListMailMessagesResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\DeletePersonResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListMailMessagesResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DeletePersonResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -4050,14 +1193,14 @@ public function getPersonMailMessagesWithHttpInfo($id, $start = 0, $limit = null } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListMailMessagesResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\DeletePersonResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListMailMessagesResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DeletePersonResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -4067,7 +1210,7 @@ public function getPersonMailMessagesWithHttpInfo($id, $start = 0, $limit = null case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\ListMailMessagesResponse', + '\Pipedrive\versions\v1\Model\DeletePersonResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4078,20 +1221,18 @@ public function getPersonMailMessagesWithHttpInfo($id, $start = 0, $limit = null } /** - * Operation getPersonMailMessagesAsync + * Operation deletePersonPictureAsync * - * List mail messages associated with a person + * Delete person picture * * @param int $id The ID of the person (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getPersonMailMessagesAsync($id, $start = 0, $limit = null): PromiseInterface + public function deletePersonPictureAsync($id): PromiseInterface { - return $this->getPersonMailMessagesAsyncWithHttpInfo($id, $start, $limit) + return $this->deletePersonPictureAsyncWithHttpInfo($id) ->then( function ($response) { return $response[0]; @@ -4100,21 +1241,19 @@ function ($response) { } /** - * Operation getPersonMailMessagesAsyncWithHttpInfo + * Operation deletePersonPictureAsyncWithHttpInfo * - * List mail messages associated with a person + * Delete person picture * * @param int $id The ID of the person (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getPersonMailMessagesAsyncWithHttpInfo($id, $start = 0, $limit = null): PromiseInterface + public function deletePersonPictureAsyncWithHttpInfo($id): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\ListMailMessagesResponse'; - $request = $this->getPersonMailMessagesRequest($id, $start, $limit); + $returnType = '\Pipedrive\versions\v1\Model\DeletePersonResponse'; + $request = $this->deletePersonPictureRequest($id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -4151,48 +1290,30 @@ function ($exception) { } /** - * Create request for operation 'getPersonMailMessages' + * Create request for operation 'deletePersonPicture' * * @param int $id The ID of the person (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function getPersonMailMessagesRequest($id, $start = 0, $limit = null): Request + public function deletePersonPictureRequest($id): Request { // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getPersonMailMessages' + 'Missing the required parameter $id when calling deletePersonPicture' ); } - $resourcePath = '/persons/{id}/mailMessages'; + $resourcePath = '/persons/{id}/picture'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - /* @phpstan-ignore-next-line */ - if (is_array($start)) { - $start = ObjectSerializer::serializeCollection($start, '', true); - } - if ($start !== null) { - $queryParams['start'] = $start; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($limit)) { - $limit = ObjectSerializer::serializeCollection($limit, '', true); - } - if ($limit !== null) { - $queryParams['limit'] = $limit; - } // path params @@ -4270,7 +1391,7 @@ public function getPersonMailMessagesRequest($id, $start = 0, $limit = null): Re $query = Query::build($queryParams); return new Request( - 'GET', + 'DELETE', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -4278,40 +1399,40 @@ public function getPersonMailMessagesRequest($id, $start = 0, $limit = null): Re } /** - * Operation getPersonProducts + * Operation getPersonChangelog * - * List products associated with a person + * List updates about person field values * * @param int $id The ID of the person (required) - * @param int|0 $start Pagination start (optional, default to 0) + * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) * @param int|null $limit Items shown per page (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\ListPersonProductsResponse + * @return \Pipedrive\versions\v1\Model\ChangelogResponse */ - public function getPersonProducts($id, $start = 0, $limit = null) + public function getPersonChangelog($id, $cursor = null, $limit = null) { - list($response) = $this->getPersonProductsWithHttpInfo($id, $start, $limit); + list($response) = $this->getPersonChangelogWithHttpInfo($id, $cursor, $limit); return $response; } /** - * Operation getPersonProductsWithHttpInfo + * Operation getPersonChangelogWithHttpInfo * - * List products associated with a person + * List updates about person field values * * @param int $id The ID of the person (required) - * @param int|0 $start Pagination start (optional, default to 0) + * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) * @param int|null $limit Items shown per page (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\ListPersonProductsResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v1\Model\ChangelogResponse, HTTP status code, HTTP response headers (array of strings) */ - public function getPersonProductsWithHttpInfo($id, $start = 0, $limit = null) + public function getPersonChangelogWithHttpInfo($id, $cursor = null, $limit = null) { - $request = $this->getPersonProductsRequest($id, $start, $limit); + $request = $this->getPersonChangelogRequest($id, $cursor, $limit); try { $options = $this->createHttpClientOption(); @@ -4320,7 +1441,7 @@ public function getPersonProductsWithHttpInfo($id, $start = 0, $limit = null) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getPersonProductsRequest($id, $start, $limit); + $request = $this->getPersonChangelogRequest($id, $cursor, $limit); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -4345,14 +1466,14 @@ public function getPersonProductsWithHttpInfo($id, $start = 0, $limit = null) switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListPersonProductsResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ChangelogResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListPersonProductsResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ChangelogResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -4372,14 +1493,14 @@ public function getPersonProductsWithHttpInfo($id, $start = 0, $limit = null) } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListPersonProductsResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ChangelogResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListPersonProductsResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ChangelogResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -4389,7 +1510,7 @@ public function getPersonProductsWithHttpInfo($id, $start = 0, $limit = null) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\ListPersonProductsResponse', + '\Pipedrive\versions\v1\Model\ChangelogResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4400,20 +1521,20 @@ public function getPersonProductsWithHttpInfo($id, $start = 0, $limit = null) } /** - * Operation getPersonProductsAsync + * Operation getPersonChangelogAsync * - * List products associated with a person + * List updates about person field values * * @param int $id The ID of the person (required) - * @param int|0 $start Pagination start (optional, default to 0) + * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) * @param int|null $limit Items shown per page (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getPersonProductsAsync($id, $start = 0, $limit = null): PromiseInterface + public function getPersonChangelogAsync($id, $cursor = null, $limit = null): PromiseInterface { - return $this->getPersonProductsAsyncWithHttpInfo($id, $start, $limit) + return $this->getPersonChangelogAsyncWithHttpInfo($id, $cursor, $limit) ->then( function ($response) { return $response[0]; @@ -4422,21 +1543,21 @@ function ($response) { } /** - * Operation getPersonProductsAsyncWithHttpInfo + * Operation getPersonChangelogAsyncWithHttpInfo * - * List products associated with a person + * List updates about person field values * * @param int $id The ID of the person (required) - * @param int|0 $start Pagination start (optional, default to 0) + * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) * @param int|null $limit Items shown per page (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getPersonProductsAsyncWithHttpInfo($id, $start = 0, $limit = null): PromiseInterface + public function getPersonChangelogAsyncWithHttpInfo($id, $cursor = null, $limit = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\ListPersonProductsResponse'; - $request = $this->getPersonProductsRequest($id, $start, $limit); + $returnType = '\Pipedrive\versions\v1\Model\ChangelogResponse'; + $request = $this->getPersonChangelogRequest($id, $cursor, $limit); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -4473,26 +1594,26 @@ function ($exception) { } /** - * Create request for operation 'getPersonProducts' + * Create request for operation 'getPersonChangelog' * * @param int $id The ID of the person (required) - * @param int|0 $start Pagination start (optional, default to 0) + * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) * @param int|null $limit Items shown per page (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function getPersonProductsRequest($id, $start = 0, $limit = null): Request + public function getPersonChangelogRequest($id, $cursor = null, $limit = null): Request { // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getPersonProducts' + 'Missing the required parameter $id when calling getPersonChangelog' ); } - $resourcePath = '/persons/{id}/products'; + $resourcePath = '/persons/{id}/changelog'; $formParams = []; $queryParams = []; $headerParams = []; @@ -4501,11 +1622,11 @@ public function getPersonProductsRequest($id, $start = 0, $limit = null): Reques // query params /* @phpstan-ignore-next-line */ - if (is_array($start)) { - $start = ObjectSerializer::serializeCollection($start, '', true); + if (is_array($cursor)) { + $cursor = ObjectSerializer::serializeCollection($cursor, '', true); } - if ($start !== null) { - $queryParams['start'] = $start; + if ($cursor !== null) { + $queryParams['cursor'] = $cursor; } // query params /* @phpstan-ignore-next-line */ @@ -4600,44 +1721,42 @@ public function getPersonProductsRequest($id, $start = 0, $limit = null): Reques } /** - * Operation getPersonUpdates + * Operation getPersonFiles * - * List updates about a person + * List files attached to a person * * @param int $id The ID of the person (required) * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|null $all_changes Whether to show custom field updates or not. 1 = Include custom field changes. If omitted returns changes without custom field updates. (optional) - * @param string|null $items A comma-separated string for filtering out item specific updates. (Possible values - call, activity, plannedActivity, change, note, deal, file, dealChange, personChange, organizationChange, follower, dealFollower, personFollower, organizationFollower, participant, comment, mailMessage, mailMessageWithAttachment, invoice, document, marketing_campaign_stat, marketing_status_change). (optional) + * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) + * @param string|null $sort Supported fields: `id`, `update_time` (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\PersonFlowResponse + * @return \Pipedrive\versions\v1\Model\ListFilesResponse */ - public function getPersonUpdates($id, $start = 0, $limit = null, $all_changes = null, $items = null) + public function getPersonFiles($id, $start = 0, $limit = null, $sort = null) { - list($response) = $this->getPersonUpdatesWithHttpInfo($id, $start, $limit, $all_changes, $items); + list($response) = $this->getPersonFilesWithHttpInfo($id, $start, $limit, $sort); return $response; } /** - * Operation getPersonUpdatesWithHttpInfo + * Operation getPersonFilesWithHttpInfo * - * List updates about a person + * List files attached to a person * * @param int $id The ID of the person (required) * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|null $all_changes Whether to show custom field updates or not. 1 = Include custom field changes. If omitted returns changes without custom field updates. (optional) - * @param string|null $items A comma-separated string for filtering out item specific updates. (Possible values - call, activity, plannedActivity, change, note, deal, file, dealChange, personChange, organizationChange, follower, dealFollower, personFollower, organizationFollower, participant, comment, mailMessage, mailMessageWithAttachment, invoice, document, marketing_campaign_stat, marketing_status_change). (optional) + * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) + * @param string|null $sort Supported fields: `id`, `update_time` (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\PersonFlowResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v1\Model\ListFilesResponse, HTTP status code, HTTP response headers (array of strings) */ - public function getPersonUpdatesWithHttpInfo($id, $start = 0, $limit = null, $all_changes = null, $items = null) + public function getPersonFilesWithHttpInfo($id, $start = 0, $limit = null, $sort = null) { - $request = $this->getPersonUpdatesRequest($id, $start, $limit, $all_changes, $items); + $request = $this->getPersonFilesRequest($id, $start, $limit, $sort); try { $options = $this->createHttpClientOption(); @@ -4646,7 +1765,7 @@ public function getPersonUpdatesWithHttpInfo($id, $start = 0, $limit = null, $al } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getPersonUpdatesRequest($id, $start, $limit, $all_changes, $items); + $request = $this->getPersonFilesRequest($id, $start, $limit, $sort); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -4671,14 +1790,14 @@ public function getPersonUpdatesWithHttpInfo($id, $start = 0, $limit = null, $al switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\PersonFlowResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ListFilesResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\PersonFlowResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListFilesResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -4698,14 +1817,14 @@ public function getPersonUpdatesWithHttpInfo($id, $start = 0, $limit = null, $al } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\PersonFlowResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ListFilesResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\PersonFlowResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListFilesResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -4715,7 +1834,7 @@ public function getPersonUpdatesWithHttpInfo($id, $start = 0, $limit = null, $al case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\PersonFlowResponse', + '\Pipedrive\versions\v1\Model\ListFilesResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4726,22 +1845,21 @@ public function getPersonUpdatesWithHttpInfo($id, $start = 0, $limit = null, $al } /** - * Operation getPersonUpdatesAsync + * Operation getPersonFilesAsync * - * List updates about a person + * List files attached to a person * * @param int $id The ID of the person (required) * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|null $all_changes Whether to show custom field updates or not. 1 = Include custom field changes. If omitted returns changes without custom field updates. (optional) - * @param string|null $items A comma-separated string for filtering out item specific updates. (Possible values - call, activity, plannedActivity, change, note, deal, file, dealChange, personChange, organizationChange, follower, dealFollower, personFollower, organizationFollower, participant, comment, mailMessage, mailMessageWithAttachment, invoice, document, marketing_campaign_stat, marketing_status_change). (optional) + * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) + * @param string|null $sort Supported fields: `id`, `update_time` (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getPersonUpdatesAsync($id, $start = 0, $limit = null, $all_changes = null, $items = null): PromiseInterface + public function getPersonFilesAsync($id, $start = 0, $limit = null, $sort = null): PromiseInterface { - return $this->getPersonUpdatesAsyncWithHttpInfo($id, $start, $limit, $all_changes, $items) + return $this->getPersonFilesAsyncWithHttpInfo($id, $start, $limit, $sort) ->then( function ($response) { return $response[0]; @@ -4750,23 +1868,22 @@ function ($response) { } /** - * Operation getPersonUpdatesAsyncWithHttpInfo + * Operation getPersonFilesAsyncWithHttpInfo * - * List updates about a person + * List files attached to a person * * @param int $id The ID of the person (required) * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|null $all_changes Whether to show custom field updates or not. 1 = Include custom field changes. If omitted returns changes without custom field updates. (optional) - * @param string|null $items A comma-separated string for filtering out item specific updates. (Possible values - call, activity, plannedActivity, change, note, deal, file, dealChange, personChange, organizationChange, follower, dealFollower, personFollower, organizationFollower, participant, comment, mailMessage, mailMessageWithAttachment, invoice, document, marketing_campaign_stat, marketing_status_change). (optional) + * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) + * @param string|null $sort Supported fields: `id`, `update_time` (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getPersonUpdatesAsyncWithHttpInfo($id, $start = 0, $limit = null, $all_changes = null, $items = null): PromiseInterface + public function getPersonFilesAsyncWithHttpInfo($id, $start = 0, $limit = null, $sort = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\PersonFlowResponse'; - $request = $this->getPersonUpdatesRequest($id, $start, $limit, $all_changes, $items); + $returnType = '\Pipedrive\versions\v1\Model\ListFilesResponse'; + $request = $this->getPersonFilesRequest($id, $start, $limit, $sort); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -4803,28 +1920,31 @@ function ($exception) { } /** - * Create request for operation 'getPersonUpdates' + * Create request for operation 'getPersonFiles' * * @param int $id The ID of the person (required) * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|null $all_changes Whether to show custom field updates or not. 1 = Include custom field changes. If omitted returns changes without custom field updates. (optional) - * @param string|null $items A comma-separated string for filtering out item specific updates. (Possible values - call, activity, plannedActivity, change, note, deal, file, dealChange, personChange, organizationChange, follower, dealFollower, personFollower, organizationFollower, participant, comment, mailMessage, mailMessageWithAttachment, invoice, document, marketing_campaign_stat, marketing_status_change). (optional) + * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) + * @param string|null $sort Supported fields: `id`, `update_time` (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function getPersonUpdatesRequest($id, $start = 0, $limit = null, $all_changes = null, $items = null): Request + public function getPersonFilesRequest($id, $start = 0, $limit = null, $sort = null): Request { // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getPersonUpdates' + 'Missing the required parameter $id when calling getPersonFiles' ); } + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling PersonsApi.getPersonFiles, must be smaller than or equal to 100.'); + } - $resourcePath = '/persons/{id}/flow'; + + $resourcePath = '/persons/{id}/files'; $formParams = []; $queryParams = []; $headerParams = []; @@ -4849,19 +1969,11 @@ public function getPersonUpdatesRequest($id, $start = 0, $limit = null, $all_cha } // query params /* @phpstan-ignore-next-line */ - if (is_array($all_changes)) { - $all_changes = ObjectSerializer::serializeCollection($all_changes, '', true); - } - if ($all_changes !== null) { - $queryParams['all_changes'] = $all_changes; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($items)) { - $items = ObjectSerializer::serializeCollection($items, '', true); + if (is_array($sort)) { + $sort = ObjectSerializer::serializeCollection($sort, '', true); } - if ($items !== null) { - $queryParams['items'] = $items; + if ($sort !== null) { + $queryParams['sort'] = $sort; } @@ -4948,36 +2060,36 @@ public function getPersonUpdatesRequest($id, $start = 0, $limit = null, $all_cha } /** - * Operation getPersonUsers + * Operation getPersonFollowers * - * List permitted users + * List followers of a person * * @param int $id The ID of the person (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\ListPermittedUsersResponse1 + * @return \Pipedrive\versions\v1\Model\ListFollowersResponse */ - public function getPersonUsers($id) + public function getPersonFollowers($id) { - list($response) = $this->getPersonUsersWithHttpInfo($id); + list($response) = $this->getPersonFollowersWithHttpInfo($id); return $response; } /** - * Operation getPersonUsersWithHttpInfo + * Operation getPersonFollowersWithHttpInfo * - * List permitted users + * List followers of a person * * @param int $id The ID of the person (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\ListPermittedUsersResponse1, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v1\Model\ListFollowersResponse, HTTP status code, HTTP response headers (array of strings) */ - public function getPersonUsersWithHttpInfo($id) + public function getPersonFollowersWithHttpInfo($id) { - $request = $this->getPersonUsersRequest($id); + $request = $this->getPersonFollowersRequest($id); try { $options = $this->createHttpClientOption(); @@ -4986,7 +2098,7 @@ public function getPersonUsersWithHttpInfo($id) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getPersonUsersRequest($id); + $request = $this->getPersonFollowersRequest($id); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -5011,14 +2123,14 @@ public function getPersonUsersWithHttpInfo($id) switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListPermittedUsersResponse1' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ListFollowersResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListPermittedUsersResponse1', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListFollowersResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -5038,14 +2150,14 @@ public function getPersonUsersWithHttpInfo($id) } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListPermittedUsersResponse1' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ListFollowersResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListPermittedUsersResponse1', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListFollowersResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -5055,7 +2167,7 @@ public function getPersonUsersWithHttpInfo($id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\ListPermittedUsersResponse1', + '\Pipedrive\versions\v1\Model\ListFollowersResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5066,18 +2178,18 @@ public function getPersonUsersWithHttpInfo($id) } /** - * Operation getPersonUsersAsync + * Operation getPersonFollowersAsync * - * List permitted users + * List followers of a person * * @param int $id The ID of the person (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getPersonUsersAsync($id): PromiseInterface + public function getPersonFollowersAsync($id): PromiseInterface { - return $this->getPersonUsersAsyncWithHttpInfo($id) + return $this->getPersonFollowersAsyncWithHttpInfo($id) ->then( function ($response) { return $response[0]; @@ -5086,19 +2198,19 @@ function ($response) { } /** - * Operation getPersonUsersAsyncWithHttpInfo + * Operation getPersonFollowersAsyncWithHttpInfo * - * List permitted users + * List followers of a person * * @param int $id The ID of the person (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getPersonUsersAsyncWithHttpInfo($id): PromiseInterface + public function getPersonFollowersAsyncWithHttpInfo($id): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\ListPermittedUsersResponse1'; - $request = $this->getPersonUsersRequest($id); + $returnType = '\Pipedrive\versions\v1\Model\ListFollowersResponse'; + $request = $this->getPersonFollowersRequest($id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -5135,24 +2247,24 @@ function ($exception) { } /** - * Create request for operation 'getPersonUsers' + * Create request for operation 'getPersonFollowers' * * @param int $id The ID of the person (required) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function getPersonUsersRequest($id): Request + public function getPersonFollowersRequest($id): Request { // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getPersonUsers' + 'Missing the required parameter $id when calling getPersonFollowers' ); } - $resourcePath = '/persons/{id}/permittedUsers'; + $resourcePath = '/persons/{id}/followers'; $formParams = []; $queryParams = []; $headerParams = []; @@ -5244,48 +2356,40 @@ public function getPersonUsersRequest($id): Request } /** - * Operation getPersons + * Operation getPersonMailMessages * - * Get all persons + * List mail messages associated with a person * - * @param int|null $user_id If supplied, only persons owned by the given user will be returned. However, `filter_id` takes precedence over `user_id` when both are supplied. (optional) - * @param int|null $filter_id The ID of the filter to use (optional) - * @param string|null $first_char If supplied, only persons whose name starts with the specified letter will be returned (case-insensitive) (optional) + * @param int $id The ID of the person (required) * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) - * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\GetAllPersonsResponse - * @deprecated + * @return \Pipedrive\versions\v1\Model\ListMailMessagesResponse */ - public function getPersons($user_id = null, $filter_id = null, $first_char = null, $start = 0, $limit = null, $sort = null) + public function getPersonMailMessages($id, $start = 0, $limit = null) { - list($response) = $this->getPersonsWithHttpInfo($user_id, $filter_id, $first_char, $start, $limit, $sort); + list($response) = $this->getPersonMailMessagesWithHttpInfo($id, $start, $limit); return $response; } /** - * Operation getPersonsWithHttpInfo + * Operation getPersonMailMessagesWithHttpInfo * - * Get all persons + * List mail messages associated with a person * - * @param int|null $user_id If supplied, only persons owned by the given user will be returned. However, `filter_id` takes precedence over `user_id` when both are supplied. (optional) - * @param int|null $filter_id The ID of the filter to use (optional) - * @param string|null $first_char If supplied, only persons whose name starts with the specified letter will be returned (case-insensitive) (optional) + * @param int $id The ID of the person (required) * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) - * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\GetAllPersonsResponse, HTTP status code, HTTP response headers (array of strings) - * @deprecated + * @return array of \Pipedrive\versions\v1\Model\ListMailMessagesResponse, HTTP status code, HTTP response headers (array of strings) */ - public function getPersonsWithHttpInfo($user_id = null, $filter_id = null, $first_char = null, $start = 0, $limit = null, $sort = null) + public function getPersonMailMessagesWithHttpInfo($id, $start = 0, $limit = null) { - $request = $this->getPersonsRequest($user_id, $filter_id, $first_char, $start, $limit, $sort); + $request = $this->getPersonMailMessagesRequest($id, $start, $limit); try { $options = $this->createHttpClientOption(); @@ -5294,7 +2398,7 @@ public function getPersonsWithHttpInfo($user_id = null, $filter_id = null, $firs } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getPersonsRequest($user_id, $filter_id, $first_char, $start, $limit, $sort); + $request = $this->getPersonMailMessagesRequest($id, $start, $limit); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -5319,14 +2423,14 @@ public function getPersonsWithHttpInfo($user_id = null, $filter_id = null, $firs switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetAllPersonsResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ListMailMessagesResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetAllPersonsResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListMailMessagesResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -5346,14 +2450,14 @@ public function getPersonsWithHttpInfo($user_id = null, $filter_id = null, $firs } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetAllPersonsResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ListMailMessagesResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetAllPersonsResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListMailMessagesResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -5363,7 +2467,7 @@ public function getPersonsWithHttpInfo($user_id = null, $filter_id = null, $firs case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\GetAllPersonsResponse', + '\Pipedrive\versions\v1\Model\ListMailMessagesResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5374,24 +2478,20 @@ public function getPersonsWithHttpInfo($user_id = null, $filter_id = null, $firs } /** - * Operation getPersonsAsync + * Operation getPersonMailMessagesAsync * - * Get all persons + * List mail messages associated with a person * - * @param int|null $user_id If supplied, only persons owned by the given user will be returned. However, `filter_id` takes precedence over `user_id` when both are supplied. (optional) - * @param int|null $filter_id The ID of the filter to use (optional) - * @param string|null $first_char If supplied, only persons whose name starts with the specified letter will be returned (case-insensitive) (optional) + * @param int $id The ID of the person (required) * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) - * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function getPersonsAsync($user_id = null, $filter_id = null, $first_char = null, $start = 0, $limit = null, $sort = null): PromiseInterface + public function getPersonMailMessagesAsync($id, $start = 0, $limit = null): PromiseInterface { - return $this->getPersonsAsyncWithHttpInfo($user_id, $filter_id, $first_char, $start, $limit, $sort) + return $this->getPersonMailMessagesAsyncWithHttpInfo($id, $start, $limit) ->then( function ($response) { return $response[0]; @@ -5400,25 +2500,21 @@ function ($response) { } /** - * Operation getPersonsAsyncWithHttpInfo + * Operation getPersonMailMessagesAsyncWithHttpInfo * - * Get all persons + * List mail messages associated with a person * - * @param int|null $user_id If supplied, only persons owned by the given user will be returned. However, `filter_id` takes precedence over `user_id` when both are supplied. (optional) - * @param int|null $filter_id The ID of the filter to use (optional) - * @param string|null $first_char If supplied, only persons whose name starts with the specified letter will be returned (case-insensitive) (optional) + * @param int $id The ID of the person (required) * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) - * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function getPersonsAsyncWithHttpInfo($user_id = null, $filter_id = null, $first_char = null, $start = 0, $limit = null, $sort = null): PromiseInterface + public function getPersonMailMessagesAsyncWithHttpInfo($id, $start = 0, $limit = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\GetAllPersonsResponse'; - $request = $this->getPersonsRequest($user_id, $filter_id, $first_char, $start, $limit, $sort); + $returnType = '\Pipedrive\versions\v1\Model\ListMailMessagesResponse'; + $request = $this->getPersonMailMessagesRequest($id, $start, $limit); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -5455,53 +2551,32 @@ function ($exception) { } /** - * Create request for operation 'getPersons' + * Create request for operation 'getPersonMailMessages' * - * @param int|null $user_id If supplied, only persons owned by the given user will be returned. However, `filter_id` takes precedence over `user_id` when both are supplied. (optional) - * @param int|null $filter_id The ID of the filter to use (optional) - * @param string|null $first_char If supplied, only persons whose name starts with the specified letter will be returned (case-insensitive) (optional) + * @param int $id The ID of the person (required) * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) - * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request - * @deprecated */ - public function getPersonsRequest($user_id = null, $filter_id = null, $first_char = null, $start = 0, $limit = null, $sort = null): Request + public function getPersonMailMessagesRequest($id, $start = 0, $limit = null): Request { + // verify the required parameter 'id' is set + /* @phpstan-ignore-next-line */ + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling getPersonMailMessages' + ); + } - $resourcePath = '/persons'; + $resourcePath = '/persons/{id}/mailMessages'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - /* @phpstan-ignore-next-line */ - if (is_array($user_id)) { - $user_id = ObjectSerializer::serializeCollection($user_id, '', true); - } - if ($user_id !== null) { - $queryParams['user_id'] = $user_id; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($filter_id)) { - $filter_id = ObjectSerializer::serializeCollection($filter_id, '', true); - } - if ($filter_id !== null) { - $queryParams['filter_id'] = $filter_id; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($first_char)) { - $first_char = ObjectSerializer::serializeCollection($first_char, '', true); - } - if ($first_char !== null) { - $queryParams['first_char'] = $first_char; - } // query params /* @phpstan-ignore-next-line */ if (is_array($start)) { @@ -5518,16 +2593,16 @@ public function getPersonsRequest($user_id = null, $filter_id = null, $first_cha if ($limit !== null) { $queryParams['limit'] = $limit; } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($sort)) { - $sort = ObjectSerializer::serializeCollection($sort, '', true); - } - if ($sort !== null) { - $queryParams['sort'] = $sort; - } + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } /* @phpstan-ignore-next-line */ @@ -5603,48 +2678,40 @@ public function getPersonsRequest($user_id = null, $filter_id = null, $first_cha } /** - * Operation getPersonsCollection + * Operation getPersonProducts * - * Get all persons collection + * List products associated with a person * - * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) - * @param int|null $limit For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. (optional) - * @param string|null $since The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) - * @param string|null $until The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) - * @param int|null $owner_id If supplied, only persons owned by the given user will be returned (optional) - * @param string|null $first_char If supplied, only persons whose name starts with the specified letter will be returned (case-insensitive) (optional) + * @param int $id The ID of the person (required) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\InlineResponse2001|\Pipedrive\versions\v1\Model\FailResponse - * @deprecated + * @return \Pipedrive\versions\v1\Model\ListPersonProductsResponse */ - public function getPersonsCollection($cursor = null, $limit = null, $since = null, $until = null, $owner_id = null, $first_char = null) + public function getPersonProducts($id, $start = 0, $limit = null) { - list($response) = $this->getPersonsCollectionWithHttpInfo($cursor, $limit, $since, $until, $owner_id, $first_char); + list($response) = $this->getPersonProductsWithHttpInfo($id, $start, $limit); return $response; } /** - * Operation getPersonsCollectionWithHttpInfo + * Operation getPersonProductsWithHttpInfo * - * Get all persons collection + * List products associated with a person * - * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) - * @param int|null $limit For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. (optional) - * @param string|null $since The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) - * @param string|null $until The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) - * @param int|null $owner_id If supplied, only persons owned by the given user will be returned (optional) - * @param string|null $first_char If supplied, only persons whose name starts with the specified letter will be returned (case-insensitive) (optional) + * @param int $id The ID of the person (required) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\InlineResponse2001|\Pipedrive\versions\v1\Model\FailResponse, HTTP status code, HTTP response headers (array of strings) - * @deprecated + * @return array of \Pipedrive\versions\v1\Model\ListPersonProductsResponse, HTTP status code, HTTP response headers (array of strings) */ - public function getPersonsCollectionWithHttpInfo($cursor = null, $limit = null, $since = null, $until = null, $owner_id = null, $first_char = null) + public function getPersonProductsWithHttpInfo($id, $start = 0, $limit = null) { - $request = $this->getPersonsCollectionRequest($cursor, $limit, $since, $until, $owner_id, $first_char); + $request = $this->getPersonProductsRequest($id, $start, $limit); try { $options = $this->createHttpClientOption(); @@ -5653,7 +2720,7 @@ public function getPersonsCollectionWithHttpInfo($cursor = null, $limit = null, } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getPersonsCollectionRequest($cursor, $limit, $since, $until, $owner_id, $first_char); + $request = $this->getPersonProductsRequest($id, $start, $limit); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -5678,27 +2745,14 @@ public function getPersonsCollectionWithHttpInfo($cursor = null, $limit = null, switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\InlineResponse2001' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\InlineResponse2001', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 403: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\FailResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ListPersonProductsResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\FailResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListPersonProductsResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -5718,14 +2772,14 @@ public function getPersonsCollectionWithHttpInfo($cursor = null, $limit = null, } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\InlineResponse2001' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ListPersonProductsResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\InlineResponse2001', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListPersonProductsResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -5735,15 +2789,7 @@ public function getPersonsCollectionWithHttpInfo($cursor = null, $limit = null, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\InlineResponse2001', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\FailResponse', + '\Pipedrive\versions\v1\Model\ListPersonProductsResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5754,24 +2800,20 @@ public function getPersonsCollectionWithHttpInfo($cursor = null, $limit = null, } /** - * Operation getPersonsCollectionAsync + * Operation getPersonProductsAsync * - * Get all persons collection + * List products associated with a person * - * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) - * @param int|null $limit For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. (optional) - * @param string|null $since The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) - * @param string|null $until The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) - * @param int|null $owner_id If supplied, only persons owned by the given user will be returned (optional) - * @param string|null $first_char If supplied, only persons whose name starts with the specified letter will be returned (case-insensitive) (optional) + * @param int $id The ID of the person (required) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function getPersonsCollectionAsync($cursor = null, $limit = null, $since = null, $until = null, $owner_id = null, $first_char = null): PromiseInterface + public function getPersonProductsAsync($id, $start = 0, $limit = null): PromiseInterface { - return $this->getPersonsCollectionAsyncWithHttpInfo($cursor, $limit, $since, $until, $owner_id, $first_char) + return $this->getPersonProductsAsyncWithHttpInfo($id, $start, $limit) ->then( function ($response) { return $response[0]; @@ -5780,25 +2822,21 @@ function ($response) { } /** - * Operation getPersonsCollectionAsyncWithHttpInfo + * Operation getPersonProductsAsyncWithHttpInfo * - * Get all persons collection + * List products associated with a person * - * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) - * @param int|null $limit For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. (optional) - * @param string|null $since The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) - * @param string|null $until The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) - * @param int|null $owner_id If supplied, only persons owned by the given user will be returned (optional) - * @param string|null $first_char If supplied, only persons whose name starts with the specified letter will be returned (case-insensitive) (optional) + * @param int $id The ID of the person (required) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function getPersonsCollectionAsyncWithHttpInfo($cursor = null, $limit = null, $since = null, $until = null, $owner_id = null, $first_char = null): PromiseInterface + public function getPersonProductsAsyncWithHttpInfo($id, $start = 0, $limit = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\InlineResponse2001'; - $request = $this->getPersonsCollectionRequest($cursor, $limit, $since, $until, $owner_id, $first_char); + $returnType = '\Pipedrive\versions\v1\Model\ListPersonProductsResponse'; + $request = $this->getPersonProductsRequest($id, $start, $limit); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -5835,23 +2873,26 @@ function ($exception) { } /** - * Create request for operation 'getPersonsCollection' + * Create request for operation 'getPersonProducts' * - * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) - * @param int|null $limit For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. (optional) - * @param string|null $since The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) - * @param string|null $until The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) - * @param int|null $owner_id If supplied, only persons owned by the given user will be returned (optional) - * @param string|null $first_char If supplied, only persons whose name starts with the specified letter will be returned (case-insensitive) (optional) + * @param int $id The ID of the person (required) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request - * @deprecated */ - public function getPersonsCollectionRequest($cursor = null, $limit = null, $since = null, $until = null, $owner_id = null, $first_char = null): Request + public function getPersonProductsRequest($id, $start = 0, $limit = null): Request { + // verify the required parameter 'id' is set + /* @phpstan-ignore-next-line */ + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling getPersonProducts' + ); + } - $resourcePath = '/persons/collection'; + $resourcePath = '/persons/{id}/products'; $formParams = []; $queryParams = []; $headerParams = []; @@ -5860,11 +2901,11 @@ public function getPersonsCollectionRequest($cursor = null, $limit = null, $sinc // query params /* @phpstan-ignore-next-line */ - if (is_array($cursor)) { - $cursor = ObjectSerializer::serializeCollection($cursor, '', true); + if (is_array($start)) { + $start = ObjectSerializer::serializeCollection($start, '', true); } - if ($cursor !== null) { - $queryParams['cursor'] = $cursor; + if ($start !== null) { + $queryParams['start'] = $start; } // query params /* @phpstan-ignore-next-line */ @@ -5874,42 +2915,18 @@ public function getPersonsCollectionRequest($cursor = null, $limit = null, $sinc if ($limit !== null) { $queryParams['limit'] = $limit; } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($since)) { - $since = ObjectSerializer::serializeCollection($since, '', true); - } - if ($since !== null) { - $queryParams['since'] = $since; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($until)) { - $until = ObjectSerializer::serializeCollection($until, '', true); - } - if ($until !== null) { - $queryParams['until'] = $until; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($owner_id)) { - $owner_id = ObjectSerializer::serializeCollection($owner_id, '', true); - } - if ($owner_id !== null) { - $queryParams['owner_id'] = $owner_id; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($first_char)) { - $first_char = ObjectSerializer::serializeCollection($first_char, '', true); - } - if ($first_char !== null) { - $queryParams['first_char'] = $first_char; + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); } - - /* @phpstan-ignore-next-line */ if ($multipart) { $headers = $this->headerSelector->selectHeadersForMultipart( @@ -5983,38 +3000,44 @@ public function getPersonsCollectionRequest($cursor = null, $limit = null, $sinc } /** - * Operation mergePersons + * Operation getPersonUpdates * - * Merge two persons + * List updates about a person * * @param int $id The ID of the person (required) - * @param \Pipedrive\versions\v1\Model\MergePersonsRequest|null $merge_persons_request merge_persons_request (optional) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) + * @param string|null $all_changes Whether to show custom field updates or not. 1 = Include custom field changes. If omitted returns changes without custom field updates. (optional) + * @param string|null $items A comma-separated string for filtering out item specific updates. (Possible values - call, activity, plannedActivity, change, note, deal, file, dealChange, personChange, organizationChange, follower, dealFollower, personFollower, organizationFollower, participant, comment, mailMessage, mailMessageWithAttachment, invoice, document, marketing_campaign_stat, marketing_status_change). (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\MergePersonsResponse + * @return \Pipedrive\versions\v1\Model\PersonFlowResponse */ - public function mergePersons($id, $merge_persons_request = null) + public function getPersonUpdates($id, $start = 0, $limit = null, $all_changes = null, $items = null) { - list($response) = $this->mergePersonsWithHttpInfo($id, $merge_persons_request); + list($response) = $this->getPersonUpdatesWithHttpInfo($id, $start, $limit, $all_changes, $items); return $response; } /** - * Operation mergePersonsWithHttpInfo + * Operation getPersonUpdatesWithHttpInfo * - * Merge two persons + * List updates about a person * * @param int $id The ID of the person (required) - * @param \Pipedrive\versions\v1\Model\MergePersonsRequest|null $merge_persons_request (optional) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) + * @param string|null $all_changes Whether to show custom field updates or not. 1 = Include custom field changes. If omitted returns changes without custom field updates. (optional) + * @param string|null $items A comma-separated string for filtering out item specific updates. (Possible values - call, activity, plannedActivity, change, note, deal, file, dealChange, personChange, organizationChange, follower, dealFollower, personFollower, organizationFollower, participant, comment, mailMessage, mailMessageWithAttachment, invoice, document, marketing_campaign_stat, marketing_status_change). (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\MergePersonsResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v1\Model\PersonFlowResponse, HTTP status code, HTTP response headers (array of strings) */ - public function mergePersonsWithHttpInfo($id, $merge_persons_request = null) + public function getPersonUpdatesWithHttpInfo($id, $start = 0, $limit = null, $all_changes = null, $items = null) { - $request = $this->mergePersonsRequest($id, $merge_persons_request); + $request = $this->getPersonUpdatesRequest($id, $start, $limit, $all_changes, $items); try { $options = $this->createHttpClientOption(); @@ -6023,7 +3046,7 @@ public function mergePersonsWithHttpInfo($id, $merge_persons_request = null) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->mergePersonsRequest($id, $merge_persons_request); + $request = $this->getPersonUpdatesRequest($id, $start, $limit, $all_changes, $items); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -6048,14 +3071,14 @@ public function mergePersonsWithHttpInfo($id, $merge_persons_request = null) switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\MergePersonsResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\PersonFlowResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\MergePersonsResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\PersonFlowResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -6075,14 +3098,14 @@ public function mergePersonsWithHttpInfo($id, $merge_persons_request = null) } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\MergePersonsResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\PersonFlowResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\MergePersonsResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\PersonFlowResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -6092,7 +3115,7 @@ public function mergePersonsWithHttpInfo($id, $merge_persons_request = null) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\MergePersonsResponse', + '\Pipedrive\versions\v1\Model\PersonFlowResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6103,19 +3126,22 @@ public function mergePersonsWithHttpInfo($id, $merge_persons_request = null) } /** - * Operation mergePersonsAsync + * Operation getPersonUpdatesAsync * - * Merge two persons + * List updates about a person * * @param int $id The ID of the person (required) - * @param \Pipedrive\versions\v1\Model\MergePersonsRequest|null $merge_persons_request (optional) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) + * @param string|null $all_changes Whether to show custom field updates or not. 1 = Include custom field changes. If omitted returns changes without custom field updates. (optional) + * @param string|null $items A comma-separated string for filtering out item specific updates. (Possible values - call, activity, plannedActivity, change, note, deal, file, dealChange, personChange, organizationChange, follower, dealFollower, personFollower, organizationFollower, participant, comment, mailMessage, mailMessageWithAttachment, invoice, document, marketing_campaign_stat, marketing_status_change). (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function mergePersonsAsync($id, $merge_persons_request = null): PromiseInterface + public function getPersonUpdatesAsync($id, $start = 0, $limit = null, $all_changes = null, $items = null): PromiseInterface { - return $this->mergePersonsAsyncWithHttpInfo($id, $merge_persons_request) + return $this->getPersonUpdatesAsyncWithHttpInfo($id, $start, $limit, $all_changes, $items) ->then( function ($response) { return $response[0]; @@ -6124,20 +3150,23 @@ function ($response) { } /** - * Operation mergePersonsAsyncWithHttpInfo + * Operation getPersonUpdatesAsyncWithHttpInfo * - * Merge two persons + * List updates about a person * * @param int $id The ID of the person (required) - * @param \Pipedrive\versions\v1\Model\MergePersonsRequest|null $merge_persons_request (optional) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) + * @param string|null $all_changes Whether to show custom field updates or not. 1 = Include custom field changes. If omitted returns changes without custom field updates. (optional) + * @param string|null $items A comma-separated string for filtering out item specific updates. (Possible values - call, activity, plannedActivity, change, note, deal, file, dealChange, personChange, organizationChange, follower, dealFollower, personFollower, organizationFollower, participant, comment, mailMessage, mailMessageWithAttachment, invoice, document, marketing_campaign_stat, marketing_status_change). (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function mergePersonsAsyncWithHttpInfo($id, $merge_persons_request = null): PromiseInterface + public function getPersonUpdatesAsyncWithHttpInfo($id, $start = 0, $limit = null, $all_changes = null, $items = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\MergePersonsResponse'; - $request = $this->mergePersonsRequest($id, $merge_persons_request); + $returnType = '\Pipedrive\versions\v1\Model\PersonFlowResponse'; + $request = $this->getPersonUpdatesRequest($id, $start, $limit, $all_changes, $items); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -6174,31 +3203,66 @@ function ($exception) { } /** - * Create request for operation 'mergePersons' + * Create request for operation 'getPersonUpdates' * * @param int $id The ID of the person (required) - * @param \Pipedrive\versions\v1\Model\MergePersonsRequest|null $merge_persons_request (optional) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) + * @param string|null $all_changes Whether to show custom field updates or not. 1 = Include custom field changes. If omitted returns changes without custom field updates. (optional) + * @param string|null $items A comma-separated string for filtering out item specific updates. (Possible values - call, activity, plannedActivity, change, note, deal, file, dealChange, personChange, organizationChange, follower, dealFollower, personFollower, organizationFollower, participant, comment, mailMessage, mailMessageWithAttachment, invoice, document, marketing_campaign_stat, marketing_status_change). (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function mergePersonsRequest($id, $merge_persons_request = null): Request + public function getPersonUpdatesRequest($id, $start = 0, $limit = null, $all_changes = null, $items = null): Request { // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling mergePersons' + 'Missing the required parameter $id when calling getPersonUpdates' ); } - $resourcePath = '/persons/{id}/merge'; + $resourcePath = '/persons/{id}/flow'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; + // query params + /* @phpstan-ignore-next-line */ + if (is_array($start)) { + $start = ObjectSerializer::serializeCollection($start, '', true); + } + if ($start !== null) { + $queryParams['start'] = $start; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($limit)) { + $limit = ObjectSerializer::serializeCollection($limit, '', true); + } + if ($limit !== null) { + $queryParams['limit'] = $limit; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($all_changes)) { + $all_changes = ObjectSerializer::serializeCollection($all_changes, '', true); + } + if ($all_changes !== null) { + $queryParams['all_changes'] = $all_changes; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($items)) { + $items = ObjectSerializer::serializeCollection($items, '', true); + } + if ($items !== null) { + $queryParams['items'] = $items; + } // path params @@ -6219,18 +3283,12 @@ public function mergePersonsRequest($id, $merge_persons_request = null): Request } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - ['application/json'] + [] ); } // for model (json/xml) - if (isset($merge_persons_request)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($merge_persons_request)); - } else { - $httpBody = $merge_persons_request; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { /* @phpstan-ignore-next-line */ if ($multipart) { $multipartContents = []; @@ -6282,7 +3340,7 @@ public function mergePersonsRequest($id, $merge_persons_request = null): Request $query = Query::build($queryParams); return new Request( - 'PUT', + 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -6290,50 +3348,36 @@ public function mergePersonsRequest($id, $merge_persons_request = null): Request } /** - * Operation searchPersons + * Operation getPersonUsers * - * Search persons + * List permitted users * - * @param string $term The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded. (required) - * @param string|null $fields A comma-separated string array. The fields to perform the search from. Defaults to all of them. Only the following custom field types are searchable: `address`, `varchar`, `text`, `varchar_auto`, `double`, `monetary` and `phone`. Read more about searching by custom fields <a href=\"https://support.pipedrive.com/en/article/search-finding-what-you-need#searching-by-custom-fields\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>. (optional) - * @param bool|null $exact_match When enabled, only full exact matches against the given term are returned. It is <b>not</b> case sensitive. (optional) - * @param int|null $organization_id Will filter persons by the provided organization ID. The upper limit of found persons associated with the organization is 2000. (optional) - * @param string|null $include_fields Supports including optional fields in the results which are not provided by default (optional) - * @param int|0 $start Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter. (optional, default to 0) - * @param int|null $limit Items shown per page (optional) + * @param int $id The ID of the person (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\PersonSearchResponse - * @deprecated + * @return \Pipedrive\versions\v1\Model\ListPermittedUsersResponse1 */ - public function searchPersons($term, $fields = null, $exact_match = null, $organization_id = null, $include_fields = null, $start = 0, $limit = null) + public function getPersonUsers($id) { - list($response) = $this->searchPersonsWithHttpInfo($term, $fields, $exact_match, $organization_id, $include_fields, $start, $limit); + list($response) = $this->getPersonUsersWithHttpInfo($id); return $response; } /** - * Operation searchPersonsWithHttpInfo + * Operation getPersonUsersWithHttpInfo * - * Search persons + * List permitted users * - * @param string $term The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded. (required) - * @param string|null $fields A comma-separated string array. The fields to perform the search from. Defaults to all of them. Only the following custom field types are searchable: `address`, `varchar`, `text`, `varchar_auto`, `double`, `monetary` and `phone`. Read more about searching by custom fields <a href=\"https://support.pipedrive.com/en/article/search-finding-what-you-need#searching-by-custom-fields\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>. (optional) - * @param bool|null $exact_match When enabled, only full exact matches against the given term are returned. It is <b>not</b> case sensitive. (optional) - * @param int|null $organization_id Will filter persons by the provided organization ID. The upper limit of found persons associated with the organization is 2000. (optional) - * @param string|null $include_fields Supports including optional fields in the results which are not provided by default (optional) - * @param int|0 $start Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter. (optional, default to 0) - * @param int|null $limit Items shown per page (optional) + * @param int $id The ID of the person (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\PersonSearchResponse, HTTP status code, HTTP response headers (array of strings) - * @deprecated + * @return array of \Pipedrive\versions\v1\Model\ListPermittedUsersResponse1, HTTP status code, HTTP response headers (array of strings) */ - public function searchPersonsWithHttpInfo($term, $fields = null, $exact_match = null, $organization_id = null, $include_fields = null, $start = 0, $limit = null) + public function getPersonUsersWithHttpInfo($id) { - $request = $this->searchPersonsRequest($term, $fields, $exact_match, $organization_id, $include_fields, $start, $limit); + $request = $this->getPersonUsersRequest($id); try { $options = $this->createHttpClientOption(); @@ -6342,7 +3386,7 @@ public function searchPersonsWithHttpInfo($term, $fields = null, $exact_match = } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->searchPersonsRequest($term, $fields, $exact_match, $organization_id, $include_fields, $start, $limit); + $request = $this->getPersonUsersRequest($id); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -6367,14 +3411,14 @@ public function searchPersonsWithHttpInfo($term, $fields = null, $exact_match = switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\PersonSearchResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ListPermittedUsersResponse1' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\PersonSearchResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListPermittedUsersResponse1', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -6394,14 +3438,14 @@ public function searchPersonsWithHttpInfo($term, $fields = null, $exact_match = } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\PersonSearchResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ListPermittedUsersResponse1' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\PersonSearchResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListPermittedUsersResponse1', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -6411,7 +3455,7 @@ public function searchPersonsWithHttpInfo($term, $fields = null, $exact_match = case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\PersonSearchResponse', + '\Pipedrive\versions\v1\Model\ListPermittedUsersResponse1', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6422,25 +3466,18 @@ public function searchPersonsWithHttpInfo($term, $fields = null, $exact_match = } /** - * Operation searchPersonsAsync + * Operation getPersonUsersAsync * - * Search persons + * List permitted users * - * @param string $term The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded. (required) - * @param string|null $fields A comma-separated string array. The fields to perform the search from. Defaults to all of them. Only the following custom field types are searchable: `address`, `varchar`, `text`, `varchar_auto`, `double`, `monetary` and `phone`. Read more about searching by custom fields <a href=\"https://support.pipedrive.com/en/article/search-finding-what-you-need#searching-by-custom-fields\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>. (optional) - * @param bool|null $exact_match When enabled, only full exact matches against the given term are returned. It is <b>not</b> case sensitive. (optional) - * @param int|null $organization_id Will filter persons by the provided organization ID. The upper limit of found persons associated with the organization is 2000. (optional) - * @param string|null $include_fields Supports including optional fields in the results which are not provided by default (optional) - * @param int|0 $start Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter. (optional, default to 0) - * @param int|null $limit Items shown per page (optional) + * @param int $id The ID of the person (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function searchPersonsAsync($term, $fields = null, $exact_match = null, $organization_id = null, $include_fields = null, $start = 0, $limit = null): PromiseInterface + public function getPersonUsersAsync($id): PromiseInterface { - return $this->searchPersonsAsyncWithHttpInfo($term, $fields, $exact_match, $organization_id, $include_fields, $start, $limit) + return $this->getPersonUsersAsyncWithHttpInfo($id) ->then( function ($response) { return $response[0]; @@ -6449,26 +3486,19 @@ function ($response) { } /** - * Operation searchPersonsAsyncWithHttpInfo + * Operation getPersonUsersAsyncWithHttpInfo * - * Search persons + * List permitted users * - * @param string $term The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded. (required) - * @param string|null $fields A comma-separated string array. The fields to perform the search from. Defaults to all of them. Only the following custom field types are searchable: `address`, `varchar`, `text`, `varchar_auto`, `double`, `monetary` and `phone`. Read more about searching by custom fields <a href=\"https://support.pipedrive.com/en/article/search-finding-what-you-need#searching-by-custom-fields\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>. (optional) - * @param bool|null $exact_match When enabled, only full exact matches against the given term are returned. It is <b>not</b> case sensitive. (optional) - * @param int|null $organization_id Will filter persons by the provided organization ID. The upper limit of found persons associated with the organization is 2000. (optional) - * @param string|null $include_fields Supports including optional fields in the results which are not provided by default (optional) - * @param int|0 $start Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter. (optional, default to 0) - * @param int|null $limit Items shown per page (optional) + * @param int $id The ID of the person (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function searchPersonsAsyncWithHttpInfo($term, $fields = null, $exact_match = null, $organization_id = null, $include_fields = null, $start = 0, $limit = null): PromiseInterface + public function getPersonUsersAsyncWithHttpInfo($id): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\PersonSearchResponse'; - $request = $this->searchPersonsRequest($term, $fields, $exact_match, $organization_id, $include_fields, $start, $limit); + $returnType = '\Pipedrive\versions\v1\Model\ListPermittedUsersResponse1'; + $request = $this->getPersonUsersRequest($id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -6505,95 +3535,40 @@ function ($exception) { } /** - * Create request for operation 'searchPersons' - * - * @param string $term The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded. (required) - * @param string|null $fields A comma-separated string array. The fields to perform the search from. Defaults to all of them. Only the following custom field types are searchable: `address`, `varchar`, `text`, `varchar_auto`, `double`, `monetary` and `phone`. Read more about searching by custom fields <a href=\"https://support.pipedrive.com/en/article/search-finding-what-you-need#searching-by-custom-fields\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>. (optional) - * @param bool|null $exact_match When enabled, only full exact matches against the given term are returned. It is <b>not</b> case sensitive. (optional) - * @param int|null $organization_id Will filter persons by the provided organization ID. The upper limit of found persons associated with the organization is 2000. (optional) - * @param string|null $include_fields Supports including optional fields in the results which are not provided by default (optional) - * @param int|0 $start Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter. (optional, default to 0) - * @param int|null $limit Items shown per page (optional) + * Create request for operation 'getPersonUsers' + * + * @param int $id The ID of the person (required) * * @throws InvalidArgumentException|OAuthProviderException * @return Request - * @deprecated */ - public function searchPersonsRequest($term, $fields = null, $exact_match = null, $organization_id = null, $include_fields = null, $start = 0, $limit = null): Request + public function getPersonUsersRequest($id): Request { - // verify the required parameter 'term' is set + // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ - if ($term === null || (is_array($term) && count($term) === 0)) { + if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $term when calling searchPersons' + 'Missing the required parameter $id when calling getPersonUsers' ); } - $resourcePath = '/persons/search'; + $resourcePath = '/persons/{id}/permittedUsers'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - /* @phpstan-ignore-next-line */ - if (is_array($term)) { - $term = ObjectSerializer::serializeCollection($term, '', true); - } - if ($term !== null) { - $queryParams['term'] = $term; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($fields)) { - $fields = ObjectSerializer::serializeCollection($fields, '', true); - } - if ($fields !== null) { - $queryParams['fields'] = $fields; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($exact_match)) { - $exact_match = ObjectSerializer::serializeCollection($exact_match, '', true); - } - if ($exact_match !== null) { - $queryParams['exact_match'] = $exact_match; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($organization_id)) { - $organization_id = ObjectSerializer::serializeCollection($organization_id, '', true); - } - if ($organization_id !== null) { - $queryParams['organization_id'] = $organization_id; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($include_fields)) { - $include_fields = ObjectSerializer::serializeCollection($include_fields, '', true); - } - if ($include_fields !== null) { - $queryParams['include_fields'] = $include_fields; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($start)) { - $start = ObjectSerializer::serializeCollection($start, '', true); - } - if ($start !== null) { - $queryParams['start'] = $start; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($limit)) { - $limit = ObjectSerializer::serializeCollection($limit, '', true); - } - if ($limit !== null) { - $queryParams['limit'] = $limit; - } + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } /* @phpstan-ignore-next-line */ @@ -6669,38 +3644,38 @@ public function searchPersonsRequest($term, $fields = null, $exact_match = null, } /** - * Operation updatePerson + * Operation mergePersons * - * Update a person + * Merge two persons * * @param int $id The ID of the person (required) - * @param \Pipedrive\versions\v1\Model\UpdatePerson|null $update_person update_person (optional) + * @param \Pipedrive\versions\v1\Model\MergePersonsRequest|null $merge_persons_request merge_persons_request (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\UpdatePersonResponse + * @return \Pipedrive\versions\v1\Model\MergePersonsResponse */ - public function updatePerson($id, $update_person = null) + public function mergePersons($id, $merge_persons_request = null) { - list($response) = $this->updatePersonWithHttpInfo($id, $update_person); + list($response) = $this->mergePersonsWithHttpInfo($id, $merge_persons_request); return $response; } /** - * Operation updatePersonWithHttpInfo + * Operation mergePersonsWithHttpInfo * - * Update a person + * Merge two persons * * @param int $id The ID of the person (required) - * @param \Pipedrive\versions\v1\Model\UpdatePerson|null $update_person (optional) + * @param \Pipedrive\versions\v1\Model\MergePersonsRequest|null $merge_persons_request (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\UpdatePersonResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v1\Model\MergePersonsResponse, HTTP status code, HTTP response headers (array of strings) */ - public function updatePersonWithHttpInfo($id, $update_person = null) + public function mergePersonsWithHttpInfo($id, $merge_persons_request = null) { - $request = $this->updatePersonRequest($id, $update_person); + $request = $this->mergePersonsRequest($id, $merge_persons_request); try { $options = $this->createHttpClientOption(); @@ -6709,7 +3684,7 @@ public function updatePersonWithHttpInfo($id, $update_person = null) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->updatePersonRequest($id, $update_person); + $request = $this->mergePersonsRequest($id, $merge_persons_request); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -6734,14 +3709,14 @@ public function updatePersonWithHttpInfo($id, $update_person = null) switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\UpdatePersonResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\MergePersonsResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\UpdatePersonResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\MergePersonsResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -6761,14 +3736,14 @@ public function updatePersonWithHttpInfo($id, $update_person = null) } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\UpdatePersonResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\MergePersonsResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\UpdatePersonResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\MergePersonsResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -6778,7 +3753,7 @@ public function updatePersonWithHttpInfo($id, $update_person = null) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\UpdatePersonResponse', + '\Pipedrive\versions\v1\Model\MergePersonsResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6789,19 +3764,19 @@ public function updatePersonWithHttpInfo($id, $update_person = null) } /** - * Operation updatePersonAsync + * Operation mergePersonsAsync * - * Update a person + * Merge two persons * * @param int $id The ID of the person (required) - * @param \Pipedrive\versions\v1\Model\UpdatePerson|null $update_person (optional) + * @param \Pipedrive\versions\v1\Model\MergePersonsRequest|null $merge_persons_request (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function updatePersonAsync($id, $update_person = null): PromiseInterface + public function mergePersonsAsync($id, $merge_persons_request = null): PromiseInterface { - return $this->updatePersonAsyncWithHttpInfo($id, $update_person) + return $this->mergePersonsAsyncWithHttpInfo($id, $merge_persons_request) ->then( function ($response) { return $response[0]; @@ -6810,20 +3785,20 @@ function ($response) { } /** - * Operation updatePersonAsyncWithHttpInfo + * Operation mergePersonsAsyncWithHttpInfo * - * Update a person + * Merge two persons * * @param int $id The ID of the person (required) - * @param \Pipedrive\versions\v1\Model\UpdatePerson|null $update_person (optional) + * @param \Pipedrive\versions\v1\Model\MergePersonsRequest|null $merge_persons_request (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function updatePersonAsyncWithHttpInfo($id, $update_person = null): PromiseInterface + public function mergePersonsAsyncWithHttpInfo($id, $merge_persons_request = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\UpdatePersonResponse'; - $request = $this->updatePersonRequest($id, $update_person); + $returnType = '\Pipedrive\versions\v1\Model\MergePersonsResponse'; + $request = $this->mergePersonsRequest($id, $merge_persons_request); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -6860,25 +3835,25 @@ function ($exception) { } /** - * Create request for operation 'updatePerson' + * Create request for operation 'mergePersons' * * @param int $id The ID of the person (required) - * @param \Pipedrive\versions\v1\Model\UpdatePerson|null $update_person (optional) + * @param \Pipedrive\versions\v1\Model\MergePersonsRequest|null $merge_persons_request (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function updatePersonRequest($id, $update_person = null): Request + public function mergePersonsRequest($id, $merge_persons_request = null): Request { // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling updatePerson' + 'Missing the required parameter $id when calling mergePersons' ); } - $resourcePath = '/persons/{id}'; + $resourcePath = '/persons/{id}/merge'; $formParams = []; $queryParams = []; $headerParams = []; @@ -6910,11 +3885,11 @@ public function updatePersonRequest($id, $update_person = null): Request } // for model (json/xml) - if (isset($update_person)) { + if (isset($merge_persons_request)) { if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_person)); + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($merge_persons_request)); } else { - $httpBody = $update_person; + $httpBody = $merge_persons_request; } } elseif (count($formParams) > 0) { /* @phpstan-ignore-next-line */ diff --git a/lib/versions/v1/Api/PipelinesApi.php b/lib/versions/v1/Api/PipelinesApi.php index e555ab42..cbfa1df0 100644 --- a/lib/versions/v1/Api/PipelinesApi.php +++ b/lib/versions/v1/Api/PipelinesApi.php @@ -123,1690 +123,42 @@ public function getConfig(): Configuration } /** - * Operation addPipeline - * - * Add a new pipeline - * - * @param \Pipedrive\versions\v1\Model\Pipeline|null $pipeline pipeline (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\AddNewPipeline - * @deprecated - */ - public function addPipeline($pipeline = null) - { - list($response) = $this->addPipelineWithHttpInfo($pipeline); - return $response; - } - - /** - * Operation addPipelineWithHttpInfo - * - * Add a new pipeline - * - * @param \Pipedrive\versions\v1\Model\Pipeline|null $pipeline (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\AddNewPipeline, HTTP status code, HTTP response headers (array of strings) - * @deprecated - */ - public function addPipelineWithHttpInfo($pipeline = null) - { - $request = $this->addPipelineRequest($pipeline); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->addPipelineRequest($pipeline); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\AddNewPipeline' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\AddNewPipeline', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\AddNewPipeline' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\AddNewPipeline', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\AddNewPipeline', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation addPipelineAsync - * - * Add a new pipeline - * - * @param \Pipedrive\versions\v1\Model\Pipeline|null $pipeline (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function addPipelineAsync($pipeline = null): PromiseInterface - { - return $this->addPipelineAsyncWithHttpInfo($pipeline) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation addPipelineAsyncWithHttpInfo - * - * Add a new pipeline - * - * @param \Pipedrive\versions\v1\Model\Pipeline|null $pipeline (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function addPipelineAsyncWithHttpInfo($pipeline = null): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\AddNewPipeline'; - $request = $this->addPipelineRequest($pipeline); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'addPipeline' - * - * @param \Pipedrive\versions\v1\Model\Pipeline|null $pipeline (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - * @deprecated - */ - public function addPipelineRequest($pipeline = null): Request - { - - $resourcePath = '/pipelines'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($pipeline)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($pipeline)); - } else { - $httpBody = $pipeline; - } - } elseif (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation deletePipeline - * - * Delete a pipeline - * - * @param int $id The ID of the pipeline (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\DeletePipelineResponse - * @deprecated - */ - public function deletePipeline($id) - { - list($response) = $this->deletePipelineWithHttpInfo($id); - return $response; - } - - /** - * Operation deletePipelineWithHttpInfo - * - * Delete a pipeline - * - * @param int $id The ID of the pipeline (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\DeletePipelineResponse, HTTP status code, HTTP response headers (array of strings) - * @deprecated - */ - public function deletePipelineWithHttpInfo($id) - { - $request = $this->deletePipelineRequest($id); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->deletePipelineRequest($id); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\DeletePipelineResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DeletePipelineResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\DeletePipelineResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DeletePipelineResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\DeletePipelineResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation deletePipelineAsync - * - * Delete a pipeline - * - * @param int $id The ID of the pipeline (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function deletePipelineAsync($id): PromiseInterface - { - return $this->deletePipelineAsyncWithHttpInfo($id) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation deletePipelineAsyncWithHttpInfo - * - * Delete a pipeline - * - * @param int $id The ID of the pipeline (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function deletePipelineAsyncWithHttpInfo($id): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\DeletePipelineResponse'; - $request = $this->deletePipelineRequest($id); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'deletePipeline' - * - * @param int $id The ID of the pipeline (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - * @deprecated - */ - public function deletePipelineRequest($id): Request - { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling deletePipeline' - ); - } - - $resourcePath = '/pipelines/{id}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getPipeline - * - * Get one pipeline - * - * @param int $id The ID of the pipeline (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\GetOnePipeline - * @deprecated - */ - public function getPipeline($id) - { - list($response) = $this->getPipelineWithHttpInfo($id); - return $response; - } - - /** - * Operation getPipelineWithHttpInfo - * - * Get one pipeline - * - * @param int $id The ID of the pipeline (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\GetOnePipeline, HTTP status code, HTTP response headers (array of strings) - * @deprecated - */ - public function getPipelineWithHttpInfo($id) - { - $request = $this->getPipelineRequest($id); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->getPipelineRequest($id); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetOnePipeline' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetOnePipeline', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetOnePipeline' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetOnePipeline', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\GetOnePipeline', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getPipelineAsync - * - * Get one pipeline - * - * @param int $id The ID of the pipeline (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function getPipelineAsync($id): PromiseInterface - { - return $this->getPipelineAsyncWithHttpInfo($id) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getPipelineAsyncWithHttpInfo - * - * Get one pipeline - * - * @param int $id The ID of the pipeline (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function getPipelineAsyncWithHttpInfo($id): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\GetOnePipeline'; - $request = $this->getPipelineRequest($id); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getPipeline' - * - * @param int $id The ID of the pipeline (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - * @deprecated - */ - public function getPipelineRequest($id): Request - { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getPipeline' - ); - } - - $resourcePath = '/pipelines/{id}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getPipelineConversionStatistics - * - * Get deals conversion rates in pipeline - * - * @param int $id The ID of the pipeline (required) - * @param \DateTime $start_date The start of the period. Date in format of YYYY-MM-DD. (required) - * @param \DateTime $end_date The end of the period. Date in format of YYYY-MM-DD. (required) - * @param int|null $user_id The ID of the user who's pipeline metrics statistics to fetch. If omitted, the authorized user will be used. (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\GetDealsConversionRatesInPipeline - */ - public function getPipelineConversionStatistics($id, $start_date, $end_date, $user_id = null) - { - list($response) = $this->getPipelineConversionStatisticsWithHttpInfo($id, $start_date, $end_date, $user_id); - return $response; - } - - /** - * Operation getPipelineConversionStatisticsWithHttpInfo - * - * Get deals conversion rates in pipeline - * - * @param int $id The ID of the pipeline (required) - * @param \DateTime $start_date The start of the period. Date in format of YYYY-MM-DD. (required) - * @param \DateTime $end_date The end of the period. Date in format of YYYY-MM-DD. (required) - * @param int|null $user_id The ID of the user who's pipeline metrics statistics to fetch. If omitted, the authorized user will be used. (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\GetDealsConversionRatesInPipeline, HTTP status code, HTTP response headers (array of strings) - */ - public function getPipelineConversionStatisticsWithHttpInfo($id, $start_date, $end_date, $user_id = null) - { - $request = $this->getPipelineConversionStatisticsRequest($id, $start_date, $end_date, $user_id); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->getPipelineConversionStatisticsRequest($id, $start_date, $end_date, $user_id); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetDealsConversionRatesInPipeline' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDealsConversionRatesInPipeline', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetDealsConversionRatesInPipeline' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDealsConversionRatesInPipeline', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\GetDealsConversionRatesInPipeline', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getPipelineConversionStatisticsAsync - * - * Get deals conversion rates in pipeline - * - * @param int $id The ID of the pipeline (required) - * @param \DateTime $start_date The start of the period. Date in format of YYYY-MM-DD. (required) - * @param \DateTime $end_date The end of the period. Date in format of YYYY-MM-DD. (required) - * @param int|null $user_id The ID of the user who's pipeline metrics statistics to fetch. If omitted, the authorized user will be used. (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getPipelineConversionStatisticsAsync($id, $start_date, $end_date, $user_id = null): PromiseInterface - { - return $this->getPipelineConversionStatisticsAsyncWithHttpInfo($id, $start_date, $end_date, $user_id) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getPipelineConversionStatisticsAsyncWithHttpInfo - * - * Get deals conversion rates in pipeline - * - * @param int $id The ID of the pipeline (required) - * @param \DateTime $start_date The start of the period. Date in format of YYYY-MM-DD. (required) - * @param \DateTime $end_date The end of the period. Date in format of YYYY-MM-DD. (required) - * @param int|null $user_id The ID of the user who's pipeline metrics statistics to fetch. If omitted, the authorized user will be used. (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getPipelineConversionStatisticsAsyncWithHttpInfo($id, $start_date, $end_date, $user_id = null): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\GetDealsConversionRatesInPipeline'; - $request = $this->getPipelineConversionStatisticsRequest($id, $start_date, $end_date, $user_id); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getPipelineConversionStatistics' - * - * @param int $id The ID of the pipeline (required) - * @param \DateTime $start_date The start of the period. Date in format of YYYY-MM-DD. (required) - * @param \DateTime $end_date The end of the period. Date in format of YYYY-MM-DD. (required) - * @param int|null $user_id The ID of the user who's pipeline metrics statistics to fetch. If omitted, the authorized user will be used. (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - */ - public function getPipelineConversionStatisticsRequest($id, $start_date, $end_date, $user_id = null): Request - { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getPipelineConversionStatistics' - ); - } - // verify the required parameter 'start_date' is set - /* @phpstan-ignore-next-line */ - if ($start_date === null || (is_array($start_date) && count($start_date) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $start_date when calling getPipelineConversionStatistics' - ); - } - // verify the required parameter 'end_date' is set - /* @phpstan-ignore-next-line */ - if ($end_date === null || (is_array($end_date) && count($end_date) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $end_date when calling getPipelineConversionStatistics' - ); - } - - $resourcePath = '/pipelines/{id}/conversion_statistics'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - /* @phpstan-ignore-next-line */ - if (is_array($start_date)) { - $start_date = ObjectSerializer::serializeCollection($start_date, '', true); - } - if ($start_date !== null) { - $queryParams['start_date'] = $start_date; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($end_date)) { - $end_date = ObjectSerializer::serializeCollection($end_date, '', true); - } - if ($end_date !== null) { - $queryParams['end_date'] = $end_date; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($user_id)) { - $user_id = ObjectSerializer::serializeCollection($user_id, '', true); - } - if ($user_id !== null) { - $queryParams['user_id'] = $user_id; - } - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getPipelineDeals - * - * Get deals in a pipeline - * - * @param int $id The ID of the pipeline (required) - * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) - * @param int|null $user_id If supplied, `filter_id` will not be considered and only deals owned by the given user will be returned. If omitted, deals owned by the authorized user will be returned. (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $everyone If supplied, `filter_id` and `user_id` will not be considered – instead, deals owned by everyone will be returned (optional) - * @param int|null $stage_id If supplied, only deals within the given stage will be returned (optional) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $get_summary Whether to include a summary of the pipeline in the `additional_data` or not (optional) - * @param string|null $totals_convert_currency The 3-letter currency code of any of the supported currencies. When supplied, `per_stages_converted` is returned inside `deals_summary` inside `additional_data` which contains the currency-converted total amounts in the given currency per each stage. You may also set this parameter to `default_currency` in which case users default currency is used. Only works when `get_summary` parameter flag is enabled. (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\GetStageDeals - * @deprecated - */ - public function getPipelineDeals($id, $filter_id = null, $user_id = null, $everyone = null, $stage_id = null, $start = 0, $limit = null, $get_summary = null, $totals_convert_currency = null) - { - list($response) = $this->getPipelineDealsWithHttpInfo($id, $filter_id, $user_id, $everyone, $stage_id, $start, $limit, $get_summary, $totals_convert_currency); - return $response; - } - - /** - * Operation getPipelineDealsWithHttpInfo - * - * Get deals in a pipeline - * - * @param int $id The ID of the pipeline (required) - * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) - * @param int|null $user_id If supplied, `filter_id` will not be considered and only deals owned by the given user will be returned. If omitted, deals owned by the authorized user will be returned. (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $everyone If supplied, `filter_id` and `user_id` will not be considered – instead, deals owned by everyone will be returned (optional) - * @param int|null $stage_id If supplied, only deals within the given stage will be returned (optional) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $get_summary Whether to include a summary of the pipeline in the `additional_data` or not (optional) - * @param string|null $totals_convert_currency The 3-letter currency code of any of the supported currencies. When supplied, `per_stages_converted` is returned inside `deals_summary` inside `additional_data` which contains the currency-converted total amounts in the given currency per each stage. You may also set this parameter to `default_currency` in which case users default currency is used. Only works when `get_summary` parameter flag is enabled. (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\GetStageDeals, HTTP status code, HTTP response headers (array of strings) - * @deprecated - */ - public function getPipelineDealsWithHttpInfo($id, $filter_id = null, $user_id = null, $everyone = null, $stage_id = null, $start = 0, $limit = null, $get_summary = null, $totals_convert_currency = null) - { - $request = $this->getPipelineDealsRequest($id, $filter_id, $user_id, $everyone, $stage_id, $start, $limit, $get_summary, $totals_convert_currency); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->getPipelineDealsRequest($id, $filter_id, $user_id, $everyone, $stage_id, $start, $limit, $get_summary, $totals_convert_currency); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetStageDeals' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetStageDeals', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetStageDeals' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetStageDeals', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\GetStageDeals', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getPipelineDealsAsync - * - * Get deals in a pipeline - * - * @param int $id The ID of the pipeline (required) - * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) - * @param int|null $user_id If supplied, `filter_id` will not be considered and only deals owned by the given user will be returned. If omitted, deals owned by the authorized user will be returned. (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $everyone If supplied, `filter_id` and `user_id` will not be considered – instead, deals owned by everyone will be returned (optional) - * @param int|null $stage_id If supplied, only deals within the given stage will be returned (optional) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $get_summary Whether to include a summary of the pipeline in the `additional_data` or not (optional) - * @param string|null $totals_convert_currency The 3-letter currency code of any of the supported currencies. When supplied, `per_stages_converted` is returned inside `deals_summary` inside `additional_data` which contains the currency-converted total amounts in the given currency per each stage. You may also set this parameter to `default_currency` in which case users default currency is used. Only works when `get_summary` parameter flag is enabled. (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function getPipelineDealsAsync($id, $filter_id = null, $user_id = null, $everyone = null, $stage_id = null, $start = 0, $limit = null, $get_summary = null, $totals_convert_currency = null): PromiseInterface - { - return $this->getPipelineDealsAsyncWithHttpInfo($id, $filter_id, $user_id, $everyone, $stage_id, $start, $limit, $get_summary, $totals_convert_currency) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getPipelineDealsAsyncWithHttpInfo - * - * Get deals in a pipeline - * - * @param int $id The ID of the pipeline (required) - * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) - * @param int|null $user_id If supplied, `filter_id` will not be considered and only deals owned by the given user will be returned. If omitted, deals owned by the authorized user will be returned. (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $everyone If supplied, `filter_id` and `user_id` will not be considered – instead, deals owned by everyone will be returned (optional) - * @param int|null $stage_id If supplied, only deals within the given stage will be returned (optional) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $get_summary Whether to include a summary of the pipeline in the `additional_data` or not (optional) - * @param string|null $totals_convert_currency The 3-letter currency code of any of the supported currencies. When supplied, `per_stages_converted` is returned inside `deals_summary` inside `additional_data` which contains the currency-converted total amounts in the given currency per each stage. You may also set this parameter to `default_currency` in which case users default currency is used. Only works when `get_summary` parameter flag is enabled. (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function getPipelineDealsAsyncWithHttpInfo($id, $filter_id = null, $user_id = null, $everyone = null, $stage_id = null, $start = 0, $limit = null, $get_summary = null, $totals_convert_currency = null): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\GetStageDeals'; - $request = $this->getPipelineDealsRequest($id, $filter_id, $user_id, $everyone, $stage_id, $start, $limit, $get_summary, $totals_convert_currency); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getPipelineDeals' - * - * @param int $id The ID of the pipeline (required) - * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) - * @param int|null $user_id If supplied, `filter_id` will not be considered and only deals owned by the given user will be returned. If omitted, deals owned by the authorized user will be returned. (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $everyone If supplied, `filter_id` and `user_id` will not be considered – instead, deals owned by everyone will be returned (optional) - * @param int|null $stage_id If supplied, only deals within the given stage will be returned (optional) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $get_summary Whether to include a summary of the pipeline in the `additional_data` or not (optional) - * @param string|null $totals_convert_currency The 3-letter currency code of any of the supported currencies. When supplied, `per_stages_converted` is returned inside `deals_summary` inside `additional_data` which contains the currency-converted total amounts in the given currency per each stage. You may also set this parameter to `default_currency` in which case users default currency is used. Only works when `get_summary` parameter flag is enabled. (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - * @deprecated - */ - public function getPipelineDealsRequest($id, $filter_id = null, $user_id = null, $everyone = null, $stage_id = null, $start = 0, $limit = null, $get_summary = null, $totals_convert_currency = null): Request - { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getPipelineDeals' - ); - } - - $resourcePath = '/pipelines/{id}/deals'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - /* @phpstan-ignore-next-line */ - if (is_array($filter_id)) { - $filter_id = ObjectSerializer::serializeCollection($filter_id, '', true); - } - if ($filter_id !== null) { - $queryParams['filter_id'] = $filter_id; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($user_id)) { - $user_id = ObjectSerializer::serializeCollection($user_id, '', true); - } - if ($user_id !== null) { - $queryParams['user_id'] = $user_id; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($everyone)) { - $everyone = ObjectSerializer::serializeCollection($everyone, '', true); - } - if ($everyone !== null) { - $queryParams['everyone'] = $everyone; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($stage_id)) { - $stage_id = ObjectSerializer::serializeCollection($stage_id, '', true); - } - if ($stage_id !== null) { - $queryParams['stage_id'] = $stage_id; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($start)) { - $start = ObjectSerializer::serializeCollection($start, '', true); - } - if ($start !== null) { - $queryParams['start'] = $start; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($limit)) { - $limit = ObjectSerializer::serializeCollection($limit, '', true); - } - if ($limit !== null) { - $queryParams['limit'] = $limit; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($get_summary)) { - $get_summary = ObjectSerializer::serializeCollection($get_summary, '', true); - } - if ($get_summary !== null) { - $queryParams['get_summary'] = $get_summary; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($totals_convert_currency)) { - $totals_convert_currency = ObjectSerializer::serializeCollection($totals_convert_currency, '', true); - } - if ($totals_convert_currency !== null) { - $queryParams['totals_convert_currency'] = $totals_convert_currency; - } - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getPipelineMovementStatistics + * Operation getPipelineConversionStatistics * - * Get deals movements in pipeline + * Get deals conversion rates in pipeline * * @param int $id The ID of the pipeline (required) * @param \DateTime $start_date The start of the period. Date in format of YYYY-MM-DD. (required) * @param \DateTime $end_date The end of the period. Date in format of YYYY-MM-DD. (required) - * @param int|null $user_id The ID of the user who's pipeline statistics to fetch. If omitted, the authorized user will be used. (optional) + * @param int|null $user_id The ID of the user who's pipeline metrics statistics to fetch. If omitted, the authorized user will be used. (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\GetDealsMovementsInPipeline + * @return \Pipedrive\versions\v1\Model\GetDealsConversionRatesInPipeline */ - public function getPipelineMovementStatistics($id, $start_date, $end_date, $user_id = null) + public function getPipelineConversionStatistics($id, $start_date, $end_date, $user_id = null) { - list($response) = $this->getPipelineMovementStatisticsWithHttpInfo($id, $start_date, $end_date, $user_id); + list($response) = $this->getPipelineConversionStatisticsWithHttpInfo($id, $start_date, $end_date, $user_id); return $response; } /** - * Operation getPipelineMovementStatisticsWithHttpInfo + * Operation getPipelineConversionStatisticsWithHttpInfo * - * Get deals movements in pipeline + * Get deals conversion rates in pipeline * * @param int $id The ID of the pipeline (required) * @param \DateTime $start_date The start of the period. Date in format of YYYY-MM-DD. (required) * @param \DateTime $end_date The end of the period. Date in format of YYYY-MM-DD. (required) - * @param int|null $user_id The ID of the user who's pipeline statistics to fetch. If omitted, the authorized user will be used. (optional) + * @param int|null $user_id The ID of the user who's pipeline metrics statistics to fetch. If omitted, the authorized user will be used. (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\GetDealsMovementsInPipeline, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v1\Model\GetDealsConversionRatesInPipeline, HTTP status code, HTTP response headers (array of strings) */ - public function getPipelineMovementStatisticsWithHttpInfo($id, $start_date, $end_date, $user_id = null) + public function getPipelineConversionStatisticsWithHttpInfo($id, $start_date, $end_date, $user_id = null) { - $request = $this->getPipelineMovementStatisticsRequest($id, $start_date, $end_date, $user_id); + $request = $this->getPipelineConversionStatisticsRequest($id, $start_date, $end_date, $user_id); try { $options = $this->createHttpClientOption(); @@ -1815,7 +167,7 @@ public function getPipelineMovementStatisticsWithHttpInfo($id, $start_date, $end } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getPipelineMovementStatisticsRequest($id, $start_date, $end_date, $user_id); + $request = $this->getPipelineConversionStatisticsRequest($id, $start_date, $end_date, $user_id); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -1840,14 +192,14 @@ public function getPipelineMovementStatisticsWithHttpInfo($id, $start_date, $end switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetDealsMovementsInPipeline' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\GetDealsConversionRatesInPipeline' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDealsMovementsInPipeline', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDealsConversionRatesInPipeline', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -1867,14 +219,14 @@ public function getPipelineMovementStatisticsWithHttpInfo($id, $start_date, $end } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetDealsMovementsInPipeline' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\GetDealsConversionRatesInPipeline' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDealsMovementsInPipeline', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDealsConversionRatesInPipeline', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -1884,7 +236,7 @@ public function getPipelineMovementStatisticsWithHttpInfo($id, $start_date, $end case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\GetDealsMovementsInPipeline', + '\Pipedrive\versions\v1\Model\GetDealsConversionRatesInPipeline', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1895,21 +247,21 @@ public function getPipelineMovementStatisticsWithHttpInfo($id, $start_date, $end } /** - * Operation getPipelineMovementStatisticsAsync + * Operation getPipelineConversionStatisticsAsync * - * Get deals movements in pipeline + * Get deals conversion rates in pipeline * * @param int $id The ID of the pipeline (required) * @param \DateTime $start_date The start of the period. Date in format of YYYY-MM-DD. (required) * @param \DateTime $end_date The end of the period. Date in format of YYYY-MM-DD. (required) - * @param int|null $user_id The ID of the user who's pipeline statistics to fetch. If omitted, the authorized user will be used. (optional) + * @param int|null $user_id The ID of the user who's pipeline metrics statistics to fetch. If omitted, the authorized user will be used. (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getPipelineMovementStatisticsAsync($id, $start_date, $end_date, $user_id = null): PromiseInterface + public function getPipelineConversionStatisticsAsync($id, $start_date, $end_date, $user_id = null): PromiseInterface { - return $this->getPipelineMovementStatisticsAsyncWithHttpInfo($id, $start_date, $end_date, $user_id) + return $this->getPipelineConversionStatisticsAsyncWithHttpInfo($id, $start_date, $end_date, $user_id) ->then( function ($response) { return $response[0]; @@ -1918,22 +270,22 @@ function ($response) { } /** - * Operation getPipelineMovementStatisticsAsyncWithHttpInfo + * Operation getPipelineConversionStatisticsAsyncWithHttpInfo * - * Get deals movements in pipeline + * Get deals conversion rates in pipeline * * @param int $id The ID of the pipeline (required) * @param \DateTime $start_date The start of the period. Date in format of YYYY-MM-DD. (required) * @param \DateTime $end_date The end of the period. Date in format of YYYY-MM-DD. (required) - * @param int|null $user_id The ID of the user who's pipeline statistics to fetch. If omitted, the authorized user will be used. (optional) + * @param int|null $user_id The ID of the user who's pipeline metrics statistics to fetch. If omitted, the authorized user will be used. (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getPipelineMovementStatisticsAsyncWithHttpInfo($id, $start_date, $end_date, $user_id = null): PromiseInterface + public function getPipelineConversionStatisticsAsyncWithHttpInfo($id, $start_date, $end_date, $user_id = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\GetDealsMovementsInPipeline'; - $request = $this->getPipelineMovementStatisticsRequest($id, $start_date, $end_date, $user_id); + $returnType = '\Pipedrive\versions\v1\Model\GetDealsConversionRatesInPipeline'; + $request = $this->getPipelineConversionStatisticsRequest($id, $start_date, $end_date, $user_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1970,41 +322,41 @@ function ($exception) { } /** - * Create request for operation 'getPipelineMovementStatistics' + * Create request for operation 'getPipelineConversionStatistics' * * @param int $id The ID of the pipeline (required) * @param \DateTime $start_date The start of the period. Date in format of YYYY-MM-DD. (required) * @param \DateTime $end_date The end of the period. Date in format of YYYY-MM-DD. (required) - * @param int|null $user_id The ID of the user who's pipeline statistics to fetch. If omitted, the authorized user will be used. (optional) + * @param int|null $user_id The ID of the user who's pipeline metrics statistics to fetch. If omitted, the authorized user will be used. (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function getPipelineMovementStatisticsRequest($id, $start_date, $end_date, $user_id = null): Request + public function getPipelineConversionStatisticsRequest($id, $start_date, $end_date, $user_id = null): Request { // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getPipelineMovementStatistics' + 'Missing the required parameter $id when calling getPipelineConversionStatistics' ); } // verify the required parameter 'start_date' is set /* @phpstan-ignore-next-line */ if ($start_date === null || (is_array($start_date) && count($start_date) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $start_date when calling getPipelineMovementStatistics' + 'Missing the required parameter $start_date when calling getPipelineConversionStatistics' ); } // verify the required parameter 'end_date' is set /* @phpstan-ignore-next-line */ if ($end_date === null || (is_array($end_date) && count($end_date) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $end_date when calling getPipelineMovementStatistics' + 'Missing the required parameter $end_date when calling getPipelineConversionStatistics' ); } - $resourcePath = '/pipelines/{id}/movement_statistics'; + $resourcePath = '/pipelines/{id}/conversion_statistics'; $formParams = []; $queryParams = []; $headerParams = []; @@ -2120,36 +472,54 @@ public function getPipelineMovementStatisticsRequest($id, $start_date, $end_date } /** - * Operation getPipelines + * Operation getPipelineDeals * - * Get all pipelines + * Get deals in a pipeline * + * @param int $id The ID of the pipeline (required) + * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) + * @param int|null $user_id If supplied, `filter_id` will not be considered and only deals owned by the given user will be returned. If omitted, deals owned by the authorized user will be returned. (optional) + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $everyone If supplied, `filter_id` and `user_id` will not be considered – instead, deals owned by everyone will be returned (optional) + * @param int|null $stage_id If supplied, only deals within the given stage will be returned (optional) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $get_summary Whether to include a summary of the pipeline in the `additional_data` or not (optional) + * @param string|null $totals_convert_currency The 3-letter currency code of any of the supported currencies. When supplied, `per_stages_converted` is returned inside `deals_summary` inside `additional_data` which contains the currency-converted total amounts in the given currency per each stage. You may also set this parameter to `default_currency` in which case users default currency is used. Only works when `get_summary` parameter flag is enabled. (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\GetAllPipelines + * @return \Pipedrive\versions\v1\Model\GetStageDeals * @deprecated */ - public function getPipelines() + public function getPipelineDeals($id, $filter_id = null, $user_id = null, $everyone = null, $stage_id = null, $start = 0, $limit = null, $get_summary = null, $totals_convert_currency = null) { - list($response) = $this->getPipelinesWithHttpInfo(); + list($response) = $this->getPipelineDealsWithHttpInfo($id, $filter_id, $user_id, $everyone, $stage_id, $start, $limit, $get_summary, $totals_convert_currency); return $response; } /** - * Operation getPipelinesWithHttpInfo + * Operation getPipelineDealsWithHttpInfo * - * Get all pipelines + * Get deals in a pipeline * + * @param int $id The ID of the pipeline (required) + * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) + * @param int|null $user_id If supplied, `filter_id` will not be considered and only deals owned by the given user will be returned. If omitted, deals owned by the authorized user will be returned. (optional) + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $everyone If supplied, `filter_id` and `user_id` will not be considered – instead, deals owned by everyone will be returned (optional) + * @param int|null $stage_id If supplied, only deals within the given stage will be returned (optional) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $get_summary Whether to include a summary of the pipeline in the `additional_data` or not (optional) + * @param string|null $totals_convert_currency The 3-letter currency code of any of the supported currencies. When supplied, `per_stages_converted` is returned inside `deals_summary` inside `additional_data` which contains the currency-converted total amounts in the given currency per each stage. You may also set this parameter to `default_currency` in which case users default currency is used. Only works when `get_summary` parameter flag is enabled. (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\GetAllPipelines, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v1\Model\GetStageDeals, HTTP status code, HTTP response headers (array of strings) * @deprecated */ - public function getPipelinesWithHttpInfo() + public function getPipelineDealsWithHttpInfo($id, $filter_id = null, $user_id = null, $everyone = null, $stage_id = null, $start = 0, $limit = null, $get_summary = null, $totals_convert_currency = null) { - $request = $this->getPipelinesRequest(); + $request = $this->getPipelineDealsRequest($id, $filter_id, $user_id, $everyone, $stage_id, $start, $limit, $get_summary, $totals_convert_currency); try { $options = $this->createHttpClientOption(); @@ -2158,7 +528,7 @@ public function getPipelinesWithHttpInfo() } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getPipelinesRequest(); + $request = $this->getPipelineDealsRequest($id, $filter_id, $user_id, $everyone, $stage_id, $start, $limit, $get_summary, $totals_convert_currency); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -2183,14 +553,14 @@ public function getPipelinesWithHttpInfo() switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetAllPipelines' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\GetStageDeals' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetAllPipelines', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetStageDeals', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -2210,14 +580,14 @@ public function getPipelinesWithHttpInfo() } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetAllPipelines' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\GetStageDeals' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetAllPipelines', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetStageDeals', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -2227,7 +597,7 @@ public function getPipelinesWithHttpInfo() case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\GetAllPipelines', + '\Pipedrive\versions\v1\Model\GetStageDeals', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2238,18 +608,27 @@ public function getPipelinesWithHttpInfo() } /** - * Operation getPipelinesAsync + * Operation getPipelineDealsAsync * - * Get all pipelines + * Get deals in a pipeline * + * @param int $id The ID of the pipeline (required) + * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) + * @param int|null $user_id If supplied, `filter_id` will not be considered and only deals owned by the given user will be returned. If omitted, deals owned by the authorized user will be returned. (optional) + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $everyone If supplied, `filter_id` and `user_id` will not be considered – instead, deals owned by everyone will be returned (optional) + * @param int|null $stage_id If supplied, only deals within the given stage will be returned (optional) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $get_summary Whether to include a summary of the pipeline in the `additional_data` or not (optional) + * @param string|null $totals_convert_currency The 3-letter currency code of any of the supported currencies. When supplied, `per_stages_converted` is returned inside `deals_summary` inside `additional_data` which contains the currency-converted total amounts in the given currency per each stage. You may also set this parameter to `default_currency` in which case users default currency is used. Only works when `get_summary` parameter flag is enabled. (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface * @deprecated */ - public function getPipelinesAsync(): PromiseInterface + public function getPipelineDealsAsync($id, $filter_id = null, $user_id = null, $everyone = null, $stage_id = null, $start = 0, $limit = null, $get_summary = null, $totals_convert_currency = null): PromiseInterface { - return $this->getPipelinesAsyncWithHttpInfo() + return $this->getPipelineDealsAsyncWithHttpInfo($id, $filter_id, $user_id, $everyone, $stage_id, $start, $limit, $get_summary, $totals_convert_currency) ->then( function ($response) { return $response[0]; @@ -2258,19 +637,28 @@ function ($response) { } /** - * Operation getPipelinesAsyncWithHttpInfo + * Operation getPipelineDealsAsyncWithHttpInfo * - * Get all pipelines + * Get deals in a pipeline * + * @param int $id The ID of the pipeline (required) + * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) + * @param int|null $user_id If supplied, `filter_id` will not be considered and only deals owned by the given user will be returned. If omitted, deals owned by the authorized user will be returned. (optional) + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $everyone If supplied, `filter_id` and `user_id` will not be considered – instead, deals owned by everyone will be returned (optional) + * @param int|null $stage_id If supplied, only deals within the given stage will be returned (optional) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $get_summary Whether to include a summary of the pipeline in the `additional_data` or not (optional) + * @param string|null $totals_convert_currency The 3-letter currency code of any of the supported currencies. When supplied, `per_stages_converted` is returned inside `deals_summary` inside `additional_data` which contains the currency-converted total amounts in the given currency per each stage. You may also set this parameter to `default_currency` in which case users default currency is used. Only works when `get_summary` parameter flag is enabled. (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface * @deprecated */ - public function getPipelinesAsyncWithHttpInfo(): PromiseInterface + public function getPipelineDealsAsyncWithHttpInfo($id, $filter_id = null, $user_id = null, $everyone = null, $stage_id = null, $start = 0, $limit = null, $get_summary = null, $totals_convert_currency = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\GetAllPipelines'; - $request = $this->getPipelinesRequest(); + $returnType = '\Pipedrive\versions\v1\Model\GetStageDeals'; + $request = $this->getPipelineDealsRequest($id, $filter_id, $user_id, $everyone, $stage_id, $start, $limit, $get_summary, $totals_convert_currency); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2307,25 +695,113 @@ function ($exception) { } /** - * Create request for operation 'getPipelines' + * Create request for operation 'getPipelineDeals' * + * @param int $id The ID of the pipeline (required) + * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) + * @param int|null $user_id If supplied, `filter_id` will not be considered and only deals owned by the given user will be returned. If omitted, deals owned by the authorized user will be returned. (optional) + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $everyone If supplied, `filter_id` and `user_id` will not be considered – instead, deals owned by everyone will be returned (optional) + * @param int|null $stage_id If supplied, only deals within the given stage will be returned (optional) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $get_summary Whether to include a summary of the pipeline in the `additional_data` or not (optional) + * @param string|null $totals_convert_currency The 3-letter currency code of any of the supported currencies. When supplied, `per_stages_converted` is returned inside `deals_summary` inside `additional_data` which contains the currency-converted total amounts in the given currency per each stage. You may also set this parameter to `default_currency` in which case users default currency is used. Only works when `get_summary` parameter flag is enabled. (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request * @deprecated */ - public function getPipelinesRequest(): Request + public function getPipelineDealsRequest($id, $filter_id = null, $user_id = null, $everyone = null, $stage_id = null, $start = 0, $limit = null, $get_summary = null, $totals_convert_currency = null): Request { + // verify the required parameter 'id' is set + /* @phpstan-ignore-next-line */ + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling getPipelineDeals' + ); + } - $resourcePath = '/pipelines'; + $resourcePath = '/pipelines/{id}/deals'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; + // query params + /* @phpstan-ignore-next-line */ + if (is_array($filter_id)) { + $filter_id = ObjectSerializer::serializeCollection($filter_id, '', true); + } + if ($filter_id !== null) { + $queryParams['filter_id'] = $filter_id; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($user_id)) { + $user_id = ObjectSerializer::serializeCollection($user_id, '', true); + } + if ($user_id !== null) { + $queryParams['user_id'] = $user_id; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($everyone)) { + $everyone = ObjectSerializer::serializeCollection($everyone, '', true); + } + if ($everyone !== null) { + $queryParams['everyone'] = $everyone; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($stage_id)) { + $stage_id = ObjectSerializer::serializeCollection($stage_id, '', true); + } + if ($stage_id !== null) { + $queryParams['stage_id'] = $stage_id; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($start)) { + $start = ObjectSerializer::serializeCollection($start, '', true); + } + if ($start !== null) { + $queryParams['start'] = $start; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($limit)) { + $limit = ObjectSerializer::serializeCollection($limit, '', true); + } + if ($limit !== null) { + $queryParams['limit'] = $limit; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($get_summary)) { + $get_summary = ObjectSerializer::serializeCollection($get_summary, '', true); + } + if ($get_summary !== null) { + $queryParams['get_summary'] = $get_summary; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($totals_convert_currency)) { + $totals_convert_currency = ObjectSerializer::serializeCollection($totals_convert_currency, '', true); + } + if ($totals_convert_currency !== null) { + $queryParams['totals_convert_currency'] = $totals_convert_currency; + } + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } /* @phpstan-ignore-next-line */ @@ -2401,40 +877,42 @@ public function getPipelinesRequest(): Request } /** - * Operation updatePipeline + * Operation getPipelineMovementStatistics * - * Update a pipeline + * Get deals movements in pipeline * * @param int $id The ID of the pipeline (required) - * @param \Pipedrive\versions\v1\Model\Pipeline|null $pipeline pipeline (optional) + * @param \DateTime $start_date The start of the period. Date in format of YYYY-MM-DD. (required) + * @param \DateTime $end_date The end of the period. Date in format of YYYY-MM-DD. (required) + * @param int|null $user_id The ID of the user who's pipeline statistics to fetch. If omitted, the authorized user will be used. (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\EditPipeline - * @deprecated + * @return \Pipedrive\versions\v1\Model\GetDealsMovementsInPipeline */ - public function updatePipeline($id, $pipeline = null) + public function getPipelineMovementStatistics($id, $start_date, $end_date, $user_id = null) { - list($response) = $this->updatePipelineWithHttpInfo($id, $pipeline); + list($response) = $this->getPipelineMovementStatisticsWithHttpInfo($id, $start_date, $end_date, $user_id); return $response; } /** - * Operation updatePipelineWithHttpInfo + * Operation getPipelineMovementStatisticsWithHttpInfo * - * Update a pipeline + * Get deals movements in pipeline * * @param int $id The ID of the pipeline (required) - * @param \Pipedrive\versions\v1\Model\Pipeline|null $pipeline (optional) + * @param \DateTime $start_date The start of the period. Date in format of YYYY-MM-DD. (required) + * @param \DateTime $end_date The end of the period. Date in format of YYYY-MM-DD. (required) + * @param int|null $user_id The ID of the user who's pipeline statistics to fetch. If omitted, the authorized user will be used. (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\EditPipeline, HTTP status code, HTTP response headers (array of strings) - * @deprecated + * @return array of \Pipedrive\versions\v1\Model\GetDealsMovementsInPipeline, HTTP status code, HTTP response headers (array of strings) */ - public function updatePipelineWithHttpInfo($id, $pipeline = null) + public function getPipelineMovementStatisticsWithHttpInfo($id, $start_date, $end_date, $user_id = null) { - $request = $this->updatePipelineRequest($id, $pipeline); + $request = $this->getPipelineMovementStatisticsRequest($id, $start_date, $end_date, $user_id); try { $options = $this->createHttpClientOption(); @@ -2443,7 +921,7 @@ public function updatePipelineWithHttpInfo($id, $pipeline = null) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->updatePipelineRequest($id, $pipeline); + $request = $this->getPipelineMovementStatisticsRequest($id, $start_date, $end_date, $user_id); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -2468,14 +946,14 @@ public function updatePipelineWithHttpInfo($id, $pipeline = null) switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\EditPipeline' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\GetDealsMovementsInPipeline' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\EditPipeline', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDealsMovementsInPipeline', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -2495,14 +973,14 @@ public function updatePipelineWithHttpInfo($id, $pipeline = null) } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\EditPipeline' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\GetDealsMovementsInPipeline' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\EditPipeline', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetDealsMovementsInPipeline', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -2512,7 +990,7 @@ public function updatePipelineWithHttpInfo($id, $pipeline = null) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\EditPipeline', + '\Pipedrive\versions\v1\Model\GetDealsMovementsInPipeline', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2523,20 +1001,21 @@ public function updatePipelineWithHttpInfo($id, $pipeline = null) } /** - * Operation updatePipelineAsync + * Operation getPipelineMovementStatisticsAsync * - * Update a pipeline + * Get deals movements in pipeline * * @param int $id The ID of the pipeline (required) - * @param \Pipedrive\versions\v1\Model\Pipeline|null $pipeline (optional) + * @param \DateTime $start_date The start of the period. Date in format of YYYY-MM-DD. (required) + * @param \DateTime $end_date The end of the period. Date in format of YYYY-MM-DD. (required) + * @param int|null $user_id The ID of the user who's pipeline statistics to fetch. If omitted, the authorized user will be used. (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function updatePipelineAsync($id, $pipeline = null): PromiseInterface + public function getPipelineMovementStatisticsAsync($id, $start_date, $end_date, $user_id = null): PromiseInterface { - return $this->updatePipelineAsyncWithHttpInfo($id, $pipeline) + return $this->getPipelineMovementStatisticsAsyncWithHttpInfo($id, $start_date, $end_date, $user_id) ->then( function ($response) { return $response[0]; @@ -2545,21 +1024,22 @@ function ($response) { } /** - * Operation updatePipelineAsyncWithHttpInfo + * Operation getPipelineMovementStatisticsAsyncWithHttpInfo * - * Update a pipeline + * Get deals movements in pipeline * * @param int $id The ID of the pipeline (required) - * @param \Pipedrive\versions\v1\Model\Pipeline|null $pipeline (optional) + * @param \DateTime $start_date The start of the period. Date in format of YYYY-MM-DD. (required) + * @param \DateTime $end_date The end of the period. Date in format of YYYY-MM-DD. (required) + * @param int|null $user_id The ID of the user who's pipeline statistics to fetch. If omitted, the authorized user will be used. (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function updatePipelineAsyncWithHttpInfo($id, $pipeline = null): PromiseInterface + public function getPipelineMovementStatisticsAsyncWithHttpInfo($id, $start_date, $end_date, $user_id = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\EditPipeline'; - $request = $this->updatePipelineRequest($id, $pipeline); + $returnType = '\Pipedrive\versions\v1\Model\GetDealsMovementsInPipeline'; + $request = $this->getPipelineMovementStatisticsRequest($id, $start_date, $end_date, $user_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2596,32 +1076,71 @@ function ($exception) { } /** - * Create request for operation 'updatePipeline' + * Create request for operation 'getPipelineMovementStatistics' * * @param int $id The ID of the pipeline (required) - * @param \Pipedrive\versions\v1\Model\Pipeline|null $pipeline (optional) + * @param \DateTime $start_date The start of the period. Date in format of YYYY-MM-DD. (required) + * @param \DateTime $end_date The end of the period. Date in format of YYYY-MM-DD. (required) + * @param int|null $user_id The ID of the user who's pipeline statistics to fetch. If omitted, the authorized user will be used. (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request - * @deprecated */ - public function updatePipelineRequest($id, $pipeline = null): Request + public function getPipelineMovementStatisticsRequest($id, $start_date, $end_date, $user_id = null): Request { // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling updatePipeline' + 'Missing the required parameter $id when calling getPipelineMovementStatistics' + ); + } + // verify the required parameter 'start_date' is set + /* @phpstan-ignore-next-line */ + if ($start_date === null || (is_array($start_date) && count($start_date) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $start_date when calling getPipelineMovementStatistics' + ); + } + // verify the required parameter 'end_date' is set + /* @phpstan-ignore-next-line */ + if ($end_date === null || (is_array($end_date) && count($end_date) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $end_date when calling getPipelineMovementStatistics' ); } - $resourcePath = '/pipelines/{id}'; + $resourcePath = '/pipelines/{id}/movement_statistics'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; + // query params + /* @phpstan-ignore-next-line */ + if (is_array($start_date)) { + $start_date = ObjectSerializer::serializeCollection($start_date, '', true); + } + if ($start_date !== null) { + $queryParams['start_date'] = $start_date; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($end_date)) { + $end_date = ObjectSerializer::serializeCollection($end_date, '', true); + } + if ($end_date !== null) { + $queryParams['end_date'] = $end_date; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($user_id)) { + $user_id = ObjectSerializer::serializeCollection($user_id, '', true); + } + if ($user_id !== null) { + $queryParams['user_id'] = $user_id; + } // path params @@ -2642,18 +1161,12 @@ public function updatePipelineRequest($id, $pipeline = null): Request } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - ['application/json'] + [] ); } // for model (json/xml) - if (isset($pipeline)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($pipeline)); - } else { - $httpBody = $pipeline; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { /* @phpstan-ignore-next-line */ if ($multipart) { $multipartContents = []; @@ -2705,7 +1218,7 @@ public function updatePipelineRequest($id, $pipeline = null): Request $query = Query::build($queryParams); return new Request( - 'PUT', + 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody diff --git a/lib/versions/v1/Api/ProductsApi.php b/lib/versions/v1/Api/ProductsApi.php index 4c106ddb..bf4b5318 100644 --- a/lib/versions/v1/Api/ProductsApi.php +++ b/lib/versions/v1/Api/ProductsApi.php @@ -122,298 +122,6 @@ public function getConfig(): Configuration return $this->config; } - /** - * Operation addProduct - * - * Add a product - * - * @param \Pipedrive\versions\v1\Model\AddProductRequestBody|null $add_product_request_body add_product_request_body (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\ProductResponse - * @deprecated - */ - public function addProduct($add_product_request_body = null) - { - list($response) = $this->addProductWithHttpInfo($add_product_request_body); - return $response; - } - - /** - * Operation addProductWithHttpInfo - * - * Add a product - * - * @param \Pipedrive\versions\v1\Model\AddProductRequestBody|null $add_product_request_body (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\ProductResponse, HTTP status code, HTTP response headers (array of strings) - * @deprecated - */ - public function addProductWithHttpInfo($add_product_request_body = null) - { - $request = $this->addProductRequest($add_product_request_body); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->addProductRequest($add_product_request_body); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 201: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ProductResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ProductResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ProductResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ProductResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\ProductResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation addProductAsync - * - * Add a product - * - * @param \Pipedrive\versions\v1\Model\AddProductRequestBody|null $add_product_request_body (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function addProductAsync($add_product_request_body = null): PromiseInterface - { - return $this->addProductAsyncWithHttpInfo($add_product_request_body) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation addProductAsyncWithHttpInfo - * - * Add a product - * - * @param \Pipedrive\versions\v1\Model\AddProductRequestBody|null $add_product_request_body (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function addProductAsyncWithHttpInfo($add_product_request_body = null): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\ProductResponse'; - $request = $this->addProductRequest($add_product_request_body); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'addProduct' - * - * @param \Pipedrive\versions\v1\Model\AddProductRequestBody|null $add_product_request_body (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - * @deprecated - */ - public function addProductRequest($add_product_request_body = null): Request - { - - $resourcePath = '/products'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($add_product_request_body)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($add_product_request_body)); - } else { - $httpBody = $add_product_request_body; - } - } elseif (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - /** * Operation addProductFollower * @@ -426,1591 +134,27 @@ public function addProductRequest($add_product_request_body = null): Request * @throws InvalidArgumentException|GuzzleException * @return \Pipedrive\versions\v1\Model\NewFollowerResponse */ - public function addProductFollower($id, $add_product_follower_request = null) - { - list($response) = $this->addProductFollowerWithHttpInfo($id, $add_product_follower_request); - return $response; - } - - /** - * Operation addProductFollowerWithHttpInfo - * - * Add a follower to a product - * - * @param int $id The ID of the product (required) - * @param \Pipedrive\versions\v1\Model\AddProductFollowerRequest|null $add_product_follower_request (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\NewFollowerResponse, HTTP status code, HTTP response headers (array of strings) - */ - public function addProductFollowerWithHttpInfo($id, $add_product_follower_request = null) - { - $request = $this->addProductFollowerRequest($id, $add_product_follower_request); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->addProductFollowerRequest($id, $add_product_follower_request); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 201: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\NewFollowerResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\NewFollowerResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\NewFollowerResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\NewFollowerResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\NewFollowerResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation addProductFollowerAsync - * - * Add a follower to a product - * - * @param int $id The ID of the product (required) - * @param \Pipedrive\versions\v1\Model\AddProductFollowerRequest|null $add_product_follower_request (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function addProductFollowerAsync($id, $add_product_follower_request = null): PromiseInterface - { - return $this->addProductFollowerAsyncWithHttpInfo($id, $add_product_follower_request) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation addProductFollowerAsyncWithHttpInfo - * - * Add a follower to a product - * - * @param int $id The ID of the product (required) - * @param \Pipedrive\versions\v1\Model\AddProductFollowerRequest|null $add_product_follower_request (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function addProductFollowerAsyncWithHttpInfo($id, $add_product_follower_request = null): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\NewFollowerResponse'; - $request = $this->addProductFollowerRequest($id, $add_product_follower_request); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'addProductFollower' - * - * @param int $id The ID of the product (required) - * @param \Pipedrive\versions\v1\Model\AddProductFollowerRequest|null $add_product_follower_request (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - */ - public function addProductFollowerRequest($id, $add_product_follower_request = null): Request - { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling addProductFollower' - ); - } - - $resourcePath = '/products/{id}/followers'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($add_product_follower_request)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($add_product_follower_request)); - } else { - $httpBody = $add_product_follower_request; - } - } elseif (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation deleteProduct - * - * Delete a product - * - * @param int $id The ID of the product (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\DeleteProductResponse - * @deprecated - */ - public function deleteProduct($id) - { - list($response) = $this->deleteProductWithHttpInfo($id); - return $response; - } - - /** - * Operation deleteProductWithHttpInfo - * - * Delete a product - * - * @param int $id The ID of the product (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\DeleteProductResponse, HTTP status code, HTTP response headers (array of strings) - * @deprecated - */ - public function deleteProductWithHttpInfo($id) - { - $request = $this->deleteProductRequest($id); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->deleteProductRequest($id); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\DeleteProductResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DeleteProductResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\DeleteProductResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DeleteProductResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\DeleteProductResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation deleteProductAsync - * - * Delete a product - * - * @param int $id The ID of the product (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function deleteProductAsync($id): PromiseInterface - { - return $this->deleteProductAsyncWithHttpInfo($id) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation deleteProductAsyncWithHttpInfo - * - * Delete a product - * - * @param int $id The ID of the product (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function deleteProductAsyncWithHttpInfo($id): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\DeleteProductResponse'; - $request = $this->deleteProductRequest($id); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'deleteProduct' - * - * @param int $id The ID of the product (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - * @deprecated - */ - public function deleteProductRequest($id): Request - { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling deleteProduct' - ); - } - - $resourcePath = '/products/{id}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation deleteProductFollower - * - * Delete a follower from a product - * - * @param int $id The ID of the product (required) - * @param int $follower_id The ID of the relationship between the follower and the product (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\DeleteProductFollowerResponse - */ - public function deleteProductFollower($id, $follower_id) - { - list($response) = $this->deleteProductFollowerWithHttpInfo($id, $follower_id); - return $response; - } - - /** - * Operation deleteProductFollowerWithHttpInfo - * - * Delete a follower from a product - * - * @param int $id The ID of the product (required) - * @param int $follower_id The ID of the relationship between the follower and the product (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\DeleteProductFollowerResponse, HTTP status code, HTTP response headers (array of strings) - */ - public function deleteProductFollowerWithHttpInfo($id, $follower_id) - { - $request = $this->deleteProductFollowerRequest($id, $follower_id); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->deleteProductFollowerRequest($id, $follower_id); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\DeleteProductFollowerResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DeleteProductFollowerResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\DeleteProductFollowerResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DeleteProductFollowerResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\DeleteProductFollowerResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation deleteProductFollowerAsync - * - * Delete a follower from a product - * - * @param int $id The ID of the product (required) - * @param int $follower_id The ID of the relationship between the follower and the product (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function deleteProductFollowerAsync($id, $follower_id): PromiseInterface - { - return $this->deleteProductFollowerAsyncWithHttpInfo($id, $follower_id) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation deleteProductFollowerAsyncWithHttpInfo - * - * Delete a follower from a product - * - * @param int $id The ID of the product (required) - * @param int $follower_id The ID of the relationship between the follower and the product (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function deleteProductFollowerAsyncWithHttpInfo($id, $follower_id): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\DeleteProductFollowerResponse'; - $request = $this->deleteProductFollowerRequest($id, $follower_id); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'deleteProductFollower' - * - * @param int $id The ID of the product (required) - * @param int $follower_id The ID of the relationship between the follower and the product (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - */ - public function deleteProductFollowerRequest($id, $follower_id): Request - { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling deleteProductFollower' - ); - } - // verify the required parameter 'follower_id' is set - /* @phpstan-ignore-next-line */ - if ($follower_id === null || (is_array($follower_id) && count($follower_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $follower_id when calling deleteProductFollower' - ); - } - - $resourcePath = '/products/{id}/followers/{follower_id}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - // path params - if ($follower_id !== null) { - $resourcePath = str_replace( - '{' . 'follower_id' . '}', - ObjectSerializer::toPathValue($follower_id), - $resourcePath - ); - } - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getProduct - * - * Get one product - * - * @param int $id The ID of the product (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\ProductResponse - * @deprecated - */ - public function getProduct($id) - { - list($response) = $this->getProductWithHttpInfo($id); - return $response; - } - - /** - * Operation getProductWithHttpInfo - * - * Get one product - * - * @param int $id The ID of the product (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\ProductResponse, HTTP status code, HTTP response headers (array of strings) - * @deprecated - */ - public function getProductWithHttpInfo($id) - { - $request = $this->getProductRequest($id); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->getProductRequest($id); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ProductResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ProductResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ProductResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ProductResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\ProductResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getProductAsync - * - * Get one product - * - * @param int $id The ID of the product (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function getProductAsync($id): PromiseInterface - { - return $this->getProductAsyncWithHttpInfo($id) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getProductAsyncWithHttpInfo - * - * Get one product - * - * @param int $id The ID of the product (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function getProductAsyncWithHttpInfo($id): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\ProductResponse'; - $request = $this->getProductRequest($id); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getProduct' - * - * @param int $id The ID of the product (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - * @deprecated - */ - public function getProductRequest($id): Request - { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getProduct' - ); - } - - $resourcePath = '/products/{id}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getProductDeals - * - * Get deals where a product is attached to - * - * @param int $id The ID of the product (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|'all_not_deleted' $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional, default to 'all_not_deleted') - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\ListDealsResponse - */ - public function getProductDeals($id, $start = 0, $limit = null, $status = 'all_not_deleted') - { - list($response) = $this->getProductDealsWithHttpInfo($id, $start, $limit, $status); - return $response; - } - - /** - * Operation getProductDealsWithHttpInfo - * - * Get deals where a product is attached to - * - * @param int $id The ID of the product (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|'all_not_deleted' $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional, default to 'all_not_deleted') - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\ListDealsResponse, HTTP status code, HTTP response headers (array of strings) - */ - public function getProductDealsWithHttpInfo($id, $start = 0, $limit = null, $status = 'all_not_deleted') - { - $request = $this->getProductDealsRequest($id, $start, $limit, $status); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->getProductDealsRequest($id, $start, $limit, $status); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListDealsResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListDealsResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListDealsResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListDealsResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\ListDealsResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getProductDealsAsync - * - * Get deals where a product is attached to - * - * @param int $id The ID of the product (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|'all_not_deleted' $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional, default to 'all_not_deleted') - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getProductDealsAsync($id, $start = 0, $limit = null, $status = 'all_not_deleted'): PromiseInterface - { - return $this->getProductDealsAsyncWithHttpInfo($id, $start, $limit, $status) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getProductDealsAsyncWithHttpInfo - * - * Get deals where a product is attached to - * - * @param int $id The ID of the product (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|'all_not_deleted' $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional, default to 'all_not_deleted') - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getProductDealsAsyncWithHttpInfo($id, $start = 0, $limit = null, $status = 'all_not_deleted'): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\ListDealsResponse'; - $request = $this->getProductDealsRequest($id, $start, $limit, $status); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getProductDeals' - * - * @param int $id The ID of the product (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * @param string|'all_not_deleted' $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional, default to 'all_not_deleted') - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - */ - public function getProductDealsRequest($id, $start = 0, $limit = null, $status = 'all_not_deleted'): Request - { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getProductDeals' - ); - } - - $resourcePath = '/products/{id}/deals'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - /* @phpstan-ignore-next-line */ - if (is_array($start)) { - $start = ObjectSerializer::serializeCollection($start, '', true); - } - if ($start !== null) { - $queryParams['start'] = $start; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($limit)) { - $limit = ObjectSerializer::serializeCollection($limit, '', true); - } - if ($limit !== null) { - $queryParams['limit'] = $limit; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($status)) { - $status = ObjectSerializer::serializeCollection($status, '', true); - } - if ($status !== null) { - $queryParams['status'] = $status; - } - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getProductFiles - * - * List files attached to a product - * - * @param int $id The ID of the product (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) - * @param string|null $sort Supported fields: `id`, `update_time` (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\ListProductFilesResponse - */ - public function getProductFiles($id, $start = 0, $limit = null, $sort = null) + public function addProductFollower($id, $add_product_follower_request = null) { - list($response) = $this->getProductFilesWithHttpInfo($id, $start, $limit, $sort); + list($response) = $this->addProductFollowerWithHttpInfo($id, $add_product_follower_request); return $response; } /** - * Operation getProductFilesWithHttpInfo + * Operation addProductFollowerWithHttpInfo * - * List files attached to a product + * Add a follower to a product * * @param int $id The ID of the product (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) - * @param string|null $sort Supported fields: `id`, `update_time` (optional) + * @param \Pipedrive\versions\v1\Model\AddProductFollowerRequest|null $add_product_follower_request (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\ListProductFilesResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v1\Model\NewFollowerResponse, HTTP status code, HTTP response headers (array of strings) */ - public function getProductFilesWithHttpInfo($id, $start = 0, $limit = null, $sort = null) + public function addProductFollowerWithHttpInfo($id, $add_product_follower_request = null) { - $request = $this->getProductFilesRequest($id, $start, $limit, $sort); + $request = $this->addProductFollowerRequest($id, $add_product_follower_request); try { $options = $this->createHttpClientOption(); @@ -2019,7 +163,7 @@ public function getProductFilesWithHttpInfo($id, $start = 0, $limit = null, $sor } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getProductFilesRequest($id, $start, $limit, $sort); + $request = $this->addProductFollowerRequest($id, $add_product_follower_request); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -2042,16 +186,16 @@ public function getProductFilesWithHttpInfo($id, $start = 0, $limit = null, $sor switch($statusCode) { - case 200: + case 201: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListProductFilesResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\NewFollowerResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListProductFilesResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\NewFollowerResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -2071,24 +215,24 @@ public function getProductFilesWithHttpInfo($id, $start = 0, $limit = null, $sor } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListProductFilesResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\NewFollowerResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListProductFilesResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\NewFollowerResponse', []), $response->getStatusCode(), $response->getHeaders() ]; } catch (ApiException $e) { switch ($e->getCode()) { - case 200: + case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\ListProductFilesResponse', + '\Pipedrive\versions\v1\Model\NewFollowerResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2099,21 +243,19 @@ public function getProductFilesWithHttpInfo($id, $start = 0, $limit = null, $sor } /** - * Operation getProductFilesAsync + * Operation addProductFollowerAsync * - * List files attached to a product + * Add a follower to a product * * @param int $id The ID of the product (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) - * @param string|null $sort Supported fields: `id`, `update_time` (optional) + * @param \Pipedrive\versions\v1\Model\AddProductFollowerRequest|null $add_product_follower_request (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getProductFilesAsync($id, $start = 0, $limit = null, $sort = null): PromiseInterface + public function addProductFollowerAsync($id, $add_product_follower_request = null): PromiseInterface { - return $this->getProductFilesAsyncWithHttpInfo($id, $start, $limit, $sort) + return $this->addProductFollowerAsyncWithHttpInfo($id, $add_product_follower_request) ->then( function ($response) { return $response[0]; @@ -2122,22 +264,20 @@ function ($response) { } /** - * Operation getProductFilesAsyncWithHttpInfo + * Operation addProductFollowerAsyncWithHttpInfo * - * List files attached to a product + * Add a follower to a product * * @param int $id The ID of the product (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) - * @param string|null $sort Supported fields: `id`, `update_time` (optional) + * @param \Pipedrive\versions\v1\Model\AddProductFollowerRequest|null $add_product_follower_request (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getProductFilesAsyncWithHttpInfo($id, $start = 0, $limit = null, $sort = null): PromiseInterface + public function addProductFollowerAsyncWithHttpInfo($id, $add_product_follower_request = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\ListProductFilesResponse'; - $request = $this->getProductFilesRequest($id, $start, $limit, $sort); + $returnType = '\Pipedrive\versions\v1\Model\NewFollowerResponse'; + $request = $this->addProductFollowerRequest($id, $add_product_follower_request); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2174,61 +314,31 @@ function ($exception) { } /** - * Create request for operation 'getProductFiles' + * Create request for operation 'addProductFollower' * * @param int $id The ID of the product (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) - * @param string|null $sort Supported fields: `id`, `update_time` (optional) + * @param \Pipedrive\versions\v1\Model\AddProductFollowerRequest|null $add_product_follower_request (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function getProductFilesRequest($id, $start = 0, $limit = null, $sort = null): Request + public function addProductFollowerRequest($id, $add_product_follower_request = null): Request { // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getProductFiles' + 'Missing the required parameter $id when calling addProductFollower' ); } - if ($limit !== null && $limit > 100) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling ProductsApi.getProductFiles, must be smaller than or equal to 100.'); - } - - $resourcePath = '/products/{id}/files'; + $resourcePath = '/products/{id}/followers'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - /* @phpstan-ignore-next-line */ - if (is_array($start)) { - $start = ObjectSerializer::serializeCollection($start, '', true); - } - if ($start !== null) { - $queryParams['start'] = $start; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($limit)) { - $limit = ObjectSerializer::serializeCollection($limit, '', true); - } - if ($limit !== null) { - $queryParams['limit'] = $limit; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($sort)) { - $sort = ObjectSerializer::serializeCollection($sort, '', true); - } - if ($sort !== null) { - $queryParams['sort'] = $sort; - } // path params @@ -2249,12 +359,18 @@ public function getProductFilesRequest($id, $start = 0, $limit = null, $sort = n } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - [] + ['application/json'] ); } // for model (json/xml) - if (count($formParams) > 0) { + if (isset($add_product_follower_request)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($add_product_follower_request)); + } else { + $httpBody = $add_product_follower_request; + } + } elseif (count($formParams) > 0) { /* @phpstan-ignore-next-line */ if ($multipart) { $multipartContents = []; @@ -2306,7 +422,7 @@ public function getProductFilesRequest($id, $start = 0, $limit = null, $sort = n $query = Query::build($queryParams); return new Request( - 'GET', + 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -2314,40 +430,38 @@ public function getProductFilesRequest($id, $start = 0, $limit = null, $sort = n } /** - * Operation getProductFollowers + * Operation deleteProductFollower * - * List followers of a product + * Delete a follower from a product * * @param int $id The ID of the product (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) + * @param int $follower_id The ID of the relationship between the follower and the product (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\ListProductFollowersResponse + * @return \Pipedrive\versions\v1\Model\DeleteProductFollowerResponse */ - public function getProductFollowers($id, $start = 0, $limit = null) + public function deleteProductFollower($id, $follower_id) { - list($response) = $this->getProductFollowersWithHttpInfo($id, $start, $limit); + list($response) = $this->deleteProductFollowerWithHttpInfo($id, $follower_id); return $response; } /** - * Operation getProductFollowersWithHttpInfo + * Operation deleteProductFollowerWithHttpInfo * - * List followers of a product + * Delete a follower from a product * * @param int $id The ID of the product (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) + * @param int $follower_id The ID of the relationship between the follower and the product (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\ListProductFollowersResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v1\Model\DeleteProductFollowerResponse, HTTP status code, HTTP response headers (array of strings) */ - public function getProductFollowersWithHttpInfo($id, $start = 0, $limit = null) + public function deleteProductFollowerWithHttpInfo($id, $follower_id) { - $request = $this->getProductFollowersRequest($id, $start, $limit); + $request = $this->deleteProductFollowerRequest($id, $follower_id); try { $options = $this->createHttpClientOption(); @@ -2356,7 +470,7 @@ public function getProductFollowersWithHttpInfo($id, $start = 0, $limit = null) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getProductFollowersRequest($id, $start, $limit); + $request = $this->deleteProductFollowerRequest($id, $follower_id); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -2381,14 +495,14 @@ public function getProductFollowersWithHttpInfo($id, $start = 0, $limit = null) switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListProductFollowersResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\DeleteProductFollowerResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListProductFollowersResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DeleteProductFollowerResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -2408,14 +522,14 @@ public function getProductFollowersWithHttpInfo($id, $start = 0, $limit = null) } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ListProductFollowersResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\DeleteProductFollowerResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListProductFollowersResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DeleteProductFollowerResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -2425,7 +539,7 @@ public function getProductFollowersWithHttpInfo($id, $start = 0, $limit = null) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\ListProductFollowersResponse', + '\Pipedrive\versions\v1\Model\DeleteProductFollowerResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2436,20 +550,19 @@ public function getProductFollowersWithHttpInfo($id, $start = 0, $limit = null) } /** - * Operation getProductFollowersAsync + * Operation deleteProductFollowerAsync * - * List followers of a product + * Delete a follower from a product * * @param int $id The ID of the product (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) + * @param int $follower_id The ID of the relationship between the follower and the product (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getProductFollowersAsync($id, $start = 0, $limit = null): PromiseInterface + public function deleteProductFollowerAsync($id, $follower_id): PromiseInterface { - return $this->getProductFollowersAsyncWithHttpInfo($id, $start, $limit) + return $this->deleteProductFollowerAsyncWithHttpInfo($id, $follower_id) ->then( function ($response) { return $response[0]; @@ -2458,21 +571,20 @@ function ($response) { } /** - * Operation getProductFollowersAsyncWithHttpInfo + * Operation deleteProductFollowerAsyncWithHttpInfo * - * List followers of a product + * Delete a follower from a product * * @param int $id The ID of the product (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) + * @param int $follower_id The ID of the relationship between the follower and the product (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getProductFollowersAsyncWithHttpInfo($id, $start = 0, $limit = null): PromiseInterface + public function deleteProductFollowerAsyncWithHttpInfo($id, $follower_id): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\ListProductFollowersResponse'; - $request = $this->getProductFollowersRequest($id, $start, $limit); + $returnType = '\Pipedrive\versions\v1\Model\DeleteProductFollowerResponse'; + $request = $this->deleteProductFollowerRequest($id, $follower_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2509,48 +621,38 @@ function ($exception) { } /** - * Create request for operation 'getProductFollowers' + * Create request for operation 'deleteProductFollower' * * @param int $id The ID of the product (required) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) + * @param int $follower_id The ID of the relationship between the follower and the product (required) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function getProductFollowersRequest($id, $start = 0, $limit = null): Request + public function deleteProductFollowerRequest($id, $follower_id): Request { // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getProductFollowers' + 'Missing the required parameter $id when calling deleteProductFollower' + ); + } + // verify the required parameter 'follower_id' is set + /* @phpstan-ignore-next-line */ + if ($follower_id === null || (is_array($follower_id) && count($follower_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $follower_id when calling deleteProductFollower' ); } - $resourcePath = '/products/{id}/followers'; + $resourcePath = '/products/{id}/followers/{follower_id}'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - /* @phpstan-ignore-next-line */ - if (is_array($start)) { - $start = ObjectSerializer::serializeCollection($start, '', true); - } - if ($start !== null) { - $queryParams['start'] = $start; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($limit)) { - $limit = ObjectSerializer::serializeCollection($limit, '', true); - } - if ($limit !== null) { - $queryParams['limit'] = $limit; - } // path params @@ -2561,6 +663,14 @@ public function getProductFollowersRequest($id, $start = 0, $limit = null): Requ $resourcePath ); } + // path params + if ($follower_id !== null) { + $resourcePath = str_replace( + '{' . 'follower_id' . '}', + ObjectSerializer::toPathValue($follower_id), + $resourcePath + ); + } /* @phpstan-ignore-next-line */ @@ -2628,7 +738,7 @@ public function getProductFollowersRequest($id, $start = 0, $limit = null): Requ $query = Query::build($queryParams); return new Request( - 'GET', + 'DELETE', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -2636,36 +746,42 @@ public function getProductFollowersRequest($id, $start = 0, $limit = null): Requ } /** - * Operation getProductUsers + * Operation getProductDeals * - * List permitted users + * Get deals where a product is attached to * * @param int $id The ID of the product (required) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) + * @param string|'all_not_deleted' $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional, default to 'all_not_deleted') * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\UserIDs + * @return \Pipedrive\versions\v1\Model\ListDealsResponse */ - public function getProductUsers($id) + public function getProductDeals($id, $start = 0, $limit = null, $status = 'all_not_deleted') { - list($response) = $this->getProductUsersWithHttpInfo($id); + list($response) = $this->getProductDealsWithHttpInfo($id, $start, $limit, $status); return $response; } /** - * Operation getProductUsersWithHttpInfo + * Operation getProductDealsWithHttpInfo * - * List permitted users + * Get deals where a product is attached to * * @param int $id The ID of the product (required) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) + * @param string|'all_not_deleted' $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional, default to 'all_not_deleted') * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\UserIDs, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v1\Model\ListDealsResponse, HTTP status code, HTTP response headers (array of strings) */ - public function getProductUsersWithHttpInfo($id) + public function getProductDealsWithHttpInfo($id, $start = 0, $limit = null, $status = 'all_not_deleted') { - $request = $this->getProductUsersRequest($id); + $request = $this->getProductDealsRequest($id, $start, $limit, $status); try { $options = $this->createHttpClientOption(); @@ -2674,7 +790,7 @@ public function getProductUsersWithHttpInfo($id) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getProductUsersRequest($id); + $request = $this->getProductDealsRequest($id, $start, $limit, $status); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -2699,14 +815,14 @@ public function getProductUsersWithHttpInfo($id) switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\UserIDs' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ListDealsResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\UserIDs', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListDealsResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -2726,14 +842,14 @@ public function getProductUsersWithHttpInfo($id) } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\UserIDs' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ListDealsResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\UserIDs', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListDealsResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -2743,7 +859,7 @@ public function getProductUsersWithHttpInfo($id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\UserIDs', + '\Pipedrive\versions\v1\Model\ListDealsResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2754,18 +870,21 @@ public function getProductUsersWithHttpInfo($id) } /** - * Operation getProductUsersAsync + * Operation getProductDealsAsync * - * List permitted users + * Get deals where a product is attached to * * @param int $id The ID of the product (required) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) + * @param string|'all_not_deleted' $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional, default to 'all_not_deleted') * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getProductUsersAsync($id): PromiseInterface + public function getProductDealsAsync($id, $start = 0, $limit = null, $status = 'all_not_deleted'): PromiseInterface { - return $this->getProductUsersAsyncWithHttpInfo($id) + return $this->getProductDealsAsyncWithHttpInfo($id, $start, $limit, $status) ->then( function ($response) { return $response[0]; @@ -2774,19 +893,22 @@ function ($response) { } /** - * Operation getProductUsersAsyncWithHttpInfo + * Operation getProductDealsAsyncWithHttpInfo * - * List permitted users + * Get deals where a product is attached to * * @param int $id The ID of the product (required) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) + * @param string|'all_not_deleted' $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional, default to 'all_not_deleted') * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getProductUsersAsyncWithHttpInfo($id): PromiseInterface + public function getProductDealsAsyncWithHttpInfo($id, $start = 0, $limit = null, $status = 'all_not_deleted'): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\UserIDs'; - $request = $this->getProductUsersRequest($id); + $returnType = '\Pipedrive\versions\v1\Model\ListDealsResponse'; + $request = $this->getProductDealsRequest($id, $start, $limit, $status); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2823,30 +945,57 @@ function ($exception) { } /** - * Create request for operation 'getProductUsers' + * Create request for operation 'getProductDeals' * * @param int $id The ID of the product (required) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) + * @param string|'all_not_deleted' $status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (optional, default to 'all_not_deleted') * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function getProductUsersRequest($id): Request + public function getProductDealsRequest($id, $start = 0, $limit = null, $status = 'all_not_deleted'): Request { // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getProductUsers' + 'Missing the required parameter $id when calling getProductDeals' ); } - $resourcePath = '/products/{id}/permittedUsers'; + $resourcePath = '/products/{id}/deals'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; + // query params + /* @phpstan-ignore-next-line */ + if (is_array($start)) { + $start = ObjectSerializer::serializeCollection($start, '', true); + } + if ($start !== null) { + $queryParams['start'] = $start; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($limit)) { + $limit = ObjectSerializer::serializeCollection($limit, '', true); + } + if ($limit !== null) { + $queryParams['limit'] = $limit; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($status)) { + $status = ObjectSerializer::serializeCollection($status, '', true); + } + if ($status !== null) { + $queryParams['status'] = $status; + } // path params @@ -2932,50 +1081,42 @@ public function getProductUsersRequest($id): Request } /** - * Operation getProducts + * Operation getProductFiles * - * Get all products + * List files attached to a product * - * @param int|null $user_id If supplied, only products owned by the given user will be returned (optional) - * @param int|null $filter_id The ID of the filter to use (optional) - * @param int[]|null $ids An array of integers with the IDs of the products that should be returned in the response (optional) - * @param string|null $first_char If supplied, only products whose name starts with the specified letter will be returned (case-insensitive) (optional) - * @param bool|null $get_summary If supplied, the response will return the total numbers of products in the `additional_data.summary.total_count` property (optional) + * @param int $id The ID of the product (required) * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) + * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) + * @param string|null $sort Supported fields: `id`, `update_time` (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\ProductsResponse - * @deprecated + * @return \Pipedrive\versions\v1\Model\ListProductFilesResponse */ - public function getProducts($user_id = null, $filter_id = null, $ids = null, $first_char = null, $get_summary = null, $start = 0, $limit = null) + public function getProductFiles($id, $start = 0, $limit = null, $sort = null) { - list($response) = $this->getProductsWithHttpInfo($user_id, $filter_id, $ids, $first_char, $get_summary, $start, $limit); + list($response) = $this->getProductFilesWithHttpInfo($id, $start, $limit, $sort); return $response; } /** - * Operation getProductsWithHttpInfo + * Operation getProductFilesWithHttpInfo * - * Get all products + * List files attached to a product * - * @param int|null $user_id If supplied, only products owned by the given user will be returned (optional) - * @param int|null $filter_id The ID of the filter to use (optional) - * @param int[]|null $ids An array of integers with the IDs of the products that should be returned in the response (optional) - * @param string|null $first_char If supplied, only products whose name starts with the specified letter will be returned (case-insensitive) (optional) - * @param bool|null $get_summary If supplied, the response will return the total numbers of products in the `additional_data.summary.total_count` property (optional) + * @param int $id The ID of the product (required) * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) + * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) + * @param string|null $sort Supported fields: `id`, `update_time` (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\ProductsResponse, HTTP status code, HTTP response headers (array of strings) - * @deprecated + * @return array of \Pipedrive\versions\v1\Model\ListProductFilesResponse, HTTP status code, HTTP response headers (array of strings) */ - public function getProductsWithHttpInfo($user_id = null, $filter_id = null, $ids = null, $first_char = null, $get_summary = null, $start = 0, $limit = null) + public function getProductFilesWithHttpInfo($id, $start = 0, $limit = null, $sort = null) { - $request = $this->getProductsRequest($user_id, $filter_id, $ids, $first_char, $get_summary, $start, $limit); + $request = $this->getProductFilesRequest($id, $start, $limit, $sort); try { $options = $this->createHttpClientOption(); @@ -2984,7 +1125,7 @@ public function getProductsWithHttpInfo($user_id = null, $filter_id = null, $ids } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getProductsRequest($user_id, $filter_id, $ids, $first_char, $get_summary, $start, $limit); + $request = $this->getProductFilesRequest($id, $start, $limit, $sort); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -3009,14 +1150,14 @@ public function getProductsWithHttpInfo($user_id = null, $filter_id = null, $ids switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ProductsResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ListProductFilesResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ProductsResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListProductFilesResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -3036,14 +1177,14 @@ public function getProductsWithHttpInfo($user_id = null, $filter_id = null, $ids } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ProductsResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ListProductFilesResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ProductsResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListProductFilesResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -3053,7 +1194,7 @@ public function getProductsWithHttpInfo($user_id = null, $filter_id = null, $ids case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\ProductsResponse', + '\Pipedrive\versions\v1\Model\ListProductFilesResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3064,25 +1205,21 @@ public function getProductsWithHttpInfo($user_id = null, $filter_id = null, $ids } /** - * Operation getProductsAsync + * Operation getProductFilesAsync * - * Get all products + * List files attached to a product * - * @param int|null $user_id If supplied, only products owned by the given user will be returned (optional) - * @param int|null $filter_id The ID of the filter to use (optional) - * @param int[]|null $ids An array of integers with the IDs of the products that should be returned in the response (optional) - * @param string|null $first_char If supplied, only products whose name starts with the specified letter will be returned (case-insensitive) (optional) - * @param bool|null $get_summary If supplied, the response will return the total numbers of products in the `additional_data.summary.total_count` property (optional) + * @param int $id The ID of the product (required) * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) + * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) + * @param string|null $sort Supported fields: `id`, `update_time` (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function getProductsAsync($user_id = null, $filter_id = null, $ids = null, $first_char = null, $get_summary = null, $start = 0, $limit = null): PromiseInterface + public function getProductFilesAsync($id, $start = 0, $limit = null, $sort = null): PromiseInterface { - return $this->getProductsAsyncWithHttpInfo($user_id, $filter_id, $ids, $first_char, $get_summary, $start, $limit) + return $this->getProductFilesAsyncWithHttpInfo($id, $start, $limit, $sort) ->then( function ($response) { return $response[0]; @@ -3091,26 +1228,22 @@ function ($response) { } /** - * Operation getProductsAsyncWithHttpInfo + * Operation getProductFilesAsyncWithHttpInfo * - * Get all products + * List files attached to a product * - * @param int|null $user_id If supplied, only products owned by the given user will be returned (optional) - * @param int|null $filter_id The ID of the filter to use (optional) - * @param int[]|null $ids An array of integers with the IDs of the products that should be returned in the response (optional) - * @param string|null $first_char If supplied, only products whose name starts with the specified letter will be returned (case-insensitive) (optional) - * @param bool|null $get_summary If supplied, the response will return the total numbers of products in the `additional_data.summary.total_count` property (optional) + * @param int $id The ID of the product (required) * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) + * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) + * @param string|null $sort Supported fields: `id`, `update_time` (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function getProductsAsyncWithHttpInfo($user_id = null, $filter_id = null, $ids = null, $first_char = null, $get_summary = null, $start = 0, $limit = null): PromiseInterface + public function getProductFilesAsyncWithHttpInfo($id, $start = 0, $limit = null, $sort = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\ProductsResponse'; - $request = $this->getProductsRequest($user_id, $filter_id, $ids, $first_char, $get_summary, $start, $limit); + $returnType = '\Pipedrive\versions\v1\Model\ListProductFilesResponse'; + $request = $this->getProductFilesRequest($id, $start, $limit, $sort); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -3147,70 +1280,37 @@ function ($exception) { } /** - * Create request for operation 'getProducts' + * Create request for operation 'getProductFiles' * - * @param int|null $user_id If supplied, only products owned by the given user will be returned (optional) - * @param int|null $filter_id The ID of the filter to use (optional) - * @param int[]|null $ids An array of integers with the IDs of the products that should be returned in the response (optional) - * @param string|null $first_char If supplied, only products whose name starts with the specified letter will be returned (case-insensitive) (optional) - * @param bool|null $get_summary If supplied, the response will return the total numbers of products in the `additional_data.summary.total_count` property (optional) + * @param int $id The ID of the product (required) * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) + * @param int|null $limit Items shown per page. Please note that a maximum value of 100 is allowed. (optional) + * @param string|null $sort Supported fields: `id`, `update_time` (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request - * @deprecated */ - public function getProductsRequest($user_id = null, $filter_id = null, $ids = null, $first_char = null, $get_summary = null, $start = 0, $limit = null): Request + public function getProductFilesRequest($id, $start = 0, $limit = null, $sort = null): Request { + // verify the required parameter 'id' is set + /* @phpstan-ignore-next-line */ + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling getProductFiles' + ); + } + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling ProductsApi.getProductFiles, must be smaller than or equal to 100.'); + } - $resourcePath = '/products'; + + $resourcePath = '/products/{id}/files'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - /* @phpstan-ignore-next-line */ - if (is_array($user_id)) { - $user_id = ObjectSerializer::serializeCollection($user_id, '', true); - } - if ($user_id !== null) { - $queryParams['user_id'] = $user_id; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($filter_id)) { - $filter_id = ObjectSerializer::serializeCollection($filter_id, '', true); - } - if ($filter_id !== null) { - $queryParams['filter_id'] = $filter_id; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($ids)) { - $ids = ObjectSerializer::serializeCollection($ids, 'csv', true); - } - if ($ids !== null) { - $queryParams['ids'] = $ids; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($first_char)) { - $first_char = ObjectSerializer::serializeCollection($first_char, '', true); - } - if ($first_char !== null) { - $queryParams['first_char'] = $first_char; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($get_summary)) { - $get_summary = ObjectSerializer::serializeCollection($get_summary, '', true); - } - if ($get_summary !== null) { - $queryParams['get_summary'] = $get_summary; - } // query params /* @phpstan-ignore-next-line */ if (is_array($start)) { @@ -3227,8 +1327,24 @@ public function getProductsRequest($user_id = null, $filter_id = null, $ids = nu if ($limit !== null) { $queryParams['limit'] = $limit; } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($sort)) { + $sort = ObjectSerializer::serializeCollection($sort, '', true); + } + if ($sort !== null) { + $queryParams['sort'] = $sort; + } + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } /* @phpstan-ignore-next-line */ @@ -3304,48 +1420,40 @@ public function getProductsRequest($user_id = null, $filter_id = null, $ids = nu } /** - * Operation searchProducts + * Operation getProductFollowers * - * Search products + * List followers of a product * - * @param string $term The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded. (required) - * @param string|null $fields A comma-separated string array. The fields to perform the search from. Defaults to all of them. Only the following custom field types are searchable: `address`, `varchar`, `text`, `varchar_auto`, `double`, `monetary` and `phone`. Read more about searching by custom fields <a href=\"https://support.pipedrive.com/en/article/search-finding-what-you-need#searching-by-custom-fields\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>. (optional) - * @param bool|null $exact_match When enabled, only full exact matches against the given term are returned. It is <b>not</b> case sensitive. (optional) - * @param string|null $include_fields Supports including optional fields in the results which are not provided by default (optional) - * @param int|0 $start Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter. (optional, default to 0) + * @param int $id The ID of the product (required) + * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\ProductSearchResponse - * @deprecated + * @return \Pipedrive\versions\v1\Model\ListProductFollowersResponse */ - public function searchProducts($term, $fields = null, $exact_match = null, $include_fields = null, $start = 0, $limit = null) + public function getProductFollowers($id, $start = 0, $limit = null) { - list($response) = $this->searchProductsWithHttpInfo($term, $fields, $exact_match, $include_fields, $start, $limit); + list($response) = $this->getProductFollowersWithHttpInfo($id, $start, $limit); return $response; } /** - * Operation searchProductsWithHttpInfo + * Operation getProductFollowersWithHttpInfo * - * Search products + * List followers of a product * - * @param string $term The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded. (required) - * @param string|null $fields A comma-separated string array. The fields to perform the search from. Defaults to all of them. Only the following custom field types are searchable: `address`, `varchar`, `text`, `varchar_auto`, `double`, `monetary` and `phone`. Read more about searching by custom fields <a href=\"https://support.pipedrive.com/en/article/search-finding-what-you-need#searching-by-custom-fields\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>. (optional) - * @param bool|null $exact_match When enabled, only full exact matches against the given term are returned. It is <b>not</b> case sensitive. (optional) - * @param string|null $include_fields Supports including optional fields in the results which are not provided by default (optional) - * @param int|0 $start Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter. (optional, default to 0) + * @param int $id The ID of the product (required) + * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\ProductSearchResponse, HTTP status code, HTTP response headers (array of strings) - * @deprecated + * @return array of \Pipedrive\versions\v1\Model\ListProductFollowersResponse, HTTP status code, HTTP response headers (array of strings) */ - public function searchProductsWithHttpInfo($term, $fields = null, $exact_match = null, $include_fields = null, $start = 0, $limit = null) + public function getProductFollowersWithHttpInfo($id, $start = 0, $limit = null) { - $request = $this->searchProductsRequest($term, $fields, $exact_match, $include_fields, $start, $limit); + $request = $this->getProductFollowersRequest($id, $start, $limit); try { $options = $this->createHttpClientOption(); @@ -3354,7 +1462,7 @@ public function searchProductsWithHttpInfo($term, $fields = null, $exact_match = } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->searchProductsRequest($term, $fields, $exact_match, $include_fields, $start, $limit); + $request = $this->getProductFollowersRequest($id, $start, $limit); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -3379,14 +1487,14 @@ public function searchProductsWithHttpInfo($term, $fields = null, $exact_match = switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ProductSearchResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ListProductFollowersResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ProductSearchResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListProductFollowersResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -3406,14 +1514,14 @@ public function searchProductsWithHttpInfo($term, $fields = null, $exact_match = } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\ProductSearchResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\ListProductFollowersResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ProductSearchResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\ListProductFollowersResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -3423,7 +1531,7 @@ public function searchProductsWithHttpInfo($term, $fields = null, $exact_match = case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\ProductSearchResponse', + '\Pipedrive\versions\v1\Model\ListProductFollowersResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3434,24 +1542,20 @@ public function searchProductsWithHttpInfo($term, $fields = null, $exact_match = } /** - * Operation searchProductsAsync + * Operation getProductFollowersAsync * - * Search products + * List followers of a product * - * @param string $term The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded. (required) - * @param string|null $fields A comma-separated string array. The fields to perform the search from. Defaults to all of them. Only the following custom field types are searchable: `address`, `varchar`, `text`, `varchar_auto`, `double`, `monetary` and `phone`. Read more about searching by custom fields <a href=\"https://support.pipedrive.com/en/article/search-finding-what-you-need#searching-by-custom-fields\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>. (optional) - * @param bool|null $exact_match When enabled, only full exact matches against the given term are returned. It is <b>not</b> case sensitive. (optional) - * @param string|null $include_fields Supports including optional fields in the results which are not provided by default (optional) - * @param int|0 $start Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter. (optional, default to 0) + * @param int $id The ID of the product (required) + * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function searchProductsAsync($term, $fields = null, $exact_match = null, $include_fields = null, $start = 0, $limit = null): PromiseInterface + public function getProductFollowersAsync($id, $start = 0, $limit = null): PromiseInterface { - return $this->searchProductsAsyncWithHttpInfo($term, $fields, $exact_match, $include_fields, $start, $limit) + return $this->getProductFollowersAsyncWithHttpInfo($id, $start, $limit) ->then( function ($response) { return $response[0]; @@ -3460,25 +1564,21 @@ function ($response) { } /** - * Operation searchProductsAsyncWithHttpInfo + * Operation getProductFollowersAsyncWithHttpInfo * - * Search products + * List followers of a product * - * @param string $term The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded. (required) - * @param string|null $fields A comma-separated string array. The fields to perform the search from. Defaults to all of them. Only the following custom field types are searchable: `address`, `varchar`, `text`, `varchar_auto`, `double`, `monetary` and `phone`. Read more about searching by custom fields <a href=\"https://support.pipedrive.com/en/article/search-finding-what-you-need#searching-by-custom-fields\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>. (optional) - * @param bool|null $exact_match When enabled, only full exact matches against the given term are returned. It is <b>not</b> case sensitive. (optional) - * @param string|null $include_fields Supports including optional fields in the results which are not provided by default (optional) - * @param int|0 $start Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter. (optional, default to 0) + * @param int $id The ID of the product (required) + * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function searchProductsAsyncWithHttpInfo($term, $fields = null, $exact_match = null, $include_fields = null, $start = 0, $limit = null): PromiseInterface + public function getProductFollowersAsyncWithHttpInfo($id, $start = 0, $limit = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\ProductSearchResponse'; - $request = $this->searchProductsRequest($term, $fields, $exact_match, $include_fields, $start, $limit); + $returnType = '\Pipedrive\versions\v1\Model\ListProductFollowersResponse'; + $request = $this->getProductFollowersRequest($id, $start, $limit); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -3515,68 +1615,32 @@ function ($exception) { } /** - * Create request for operation 'searchProducts' + * Create request for operation 'getProductFollowers' * - * @param string $term The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded. (required) - * @param string|null $fields A comma-separated string array. The fields to perform the search from. Defaults to all of them. Only the following custom field types are searchable: `address`, `varchar`, `text`, `varchar_auto`, `double`, `monetary` and `phone`. Read more about searching by custom fields <a href=\"https://support.pipedrive.com/en/article/search-finding-what-you-need#searching-by-custom-fields\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>. (optional) - * @param bool|null $exact_match When enabled, only full exact matches against the given term are returned. It is <b>not</b> case sensitive. (optional) - * @param string|null $include_fields Supports including optional fields in the results which are not provided by default (optional) - * @param int|0 $start Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter. (optional, default to 0) + * @param int $id The ID of the product (required) + * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request - * @deprecated */ - public function searchProductsRequest($term, $fields = null, $exact_match = null, $include_fields = null, $start = 0, $limit = null): Request + public function getProductFollowersRequest($id, $start = 0, $limit = null): Request { - // verify the required parameter 'term' is set + // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ - if ($term === null || (is_array($term) && count($term) === 0)) { + if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $term when calling searchProducts' + 'Missing the required parameter $id when calling getProductFollowers' ); } - $resourcePath = '/products/search'; + $resourcePath = '/products/{id}/followers'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - /* @phpstan-ignore-next-line */ - if (is_array($term)) { - $term = ObjectSerializer::serializeCollection($term, '', true); - } - if ($term !== null) { - $queryParams['term'] = $term; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($fields)) { - $fields = ObjectSerializer::serializeCollection($fields, '', true); - } - if ($fields !== null) { - $queryParams['fields'] = $fields; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($exact_match)) { - $exact_match = ObjectSerializer::serializeCollection($exact_match, '', true); - } - if ($exact_match !== null) { - $queryParams['exact_match'] = $exact_match; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($include_fields)) { - $include_fields = ObjectSerializer::serializeCollection($include_fields, '', true); - } - if ($include_fields !== null) { - $queryParams['include_fields'] = $include_fields; - } // query params /* @phpstan-ignore-next-line */ if (is_array($start)) { @@ -3595,6 +1659,14 @@ public function searchProductsRequest($term, $fields = null, $exact_match = null } + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } /* @phpstan-ignore-next-line */ @@ -3670,40 +1742,36 @@ public function searchProductsRequest($term, $fields = null, $exact_match = null } /** - * Operation updateProduct + * Operation getProductUsers * - * Update a product + * List permitted users * * @param int $id The ID of the product (required) - * @param \Pipedrive\versions\v1\Model\UpdateProductRequestBody|null $update_product_request_body update_product_request_body (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\UpdateProductResponse - * @deprecated + * @return \Pipedrive\versions\v1\Model\UserIDs */ - public function updateProduct($id, $update_product_request_body = null) + public function getProductUsers($id) { - list($response) = $this->updateProductWithHttpInfo($id, $update_product_request_body); + list($response) = $this->getProductUsersWithHttpInfo($id); return $response; } /** - * Operation updateProductWithHttpInfo + * Operation getProductUsersWithHttpInfo * - * Update a product + * List permitted users * * @param int $id The ID of the product (required) - * @param \Pipedrive\versions\v1\Model\UpdateProductRequestBody|null $update_product_request_body (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\UpdateProductResponse, HTTP status code, HTTP response headers (array of strings) - * @deprecated + * @return array of \Pipedrive\versions\v1\Model\UserIDs, HTTP status code, HTTP response headers (array of strings) */ - public function updateProductWithHttpInfo($id, $update_product_request_body = null) + public function getProductUsersWithHttpInfo($id) { - $request = $this->updateProductRequest($id, $update_product_request_body); + $request = $this->getProductUsersRequest($id); try { $options = $this->createHttpClientOption(); @@ -3712,7 +1780,7 @@ public function updateProductWithHttpInfo($id, $update_product_request_body = nu } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->updateProductRequest($id, $update_product_request_body); + $request = $this->getProductUsersRequest($id); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -3737,14 +1805,14 @@ public function updateProductWithHttpInfo($id, $update_product_request_body = nu switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\UpdateProductResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\UserIDs' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\UpdateProductResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\UserIDs', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -3764,14 +1832,14 @@ public function updateProductWithHttpInfo($id, $update_product_request_body = nu } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\UpdateProductResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\UserIDs' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\UpdateProductResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\UserIDs', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -3781,7 +1849,7 @@ public function updateProductWithHttpInfo($id, $update_product_request_body = nu case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\UpdateProductResponse', + '\Pipedrive\versions\v1\Model\UserIDs', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3792,20 +1860,18 @@ public function updateProductWithHttpInfo($id, $update_product_request_body = nu } /** - * Operation updateProductAsync + * Operation getProductUsersAsync * - * Update a product + * List permitted users * * @param int $id The ID of the product (required) - * @param \Pipedrive\versions\v1\Model\UpdateProductRequestBody|null $update_product_request_body (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function updateProductAsync($id, $update_product_request_body = null): PromiseInterface + public function getProductUsersAsync($id): PromiseInterface { - return $this->updateProductAsyncWithHttpInfo($id, $update_product_request_body) + return $this->getProductUsersAsyncWithHttpInfo($id) ->then( function ($response) { return $response[0]; @@ -3814,21 +1880,19 @@ function ($response) { } /** - * Operation updateProductAsyncWithHttpInfo + * Operation getProductUsersAsyncWithHttpInfo * - * Update a product + * List permitted users * * @param int $id The ID of the product (required) - * @param \Pipedrive\versions\v1\Model\UpdateProductRequestBody|null $update_product_request_body (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface - * @deprecated */ - public function updateProductAsyncWithHttpInfo($id, $update_product_request_body = null): PromiseInterface + public function getProductUsersAsyncWithHttpInfo($id): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\UpdateProductResponse'; - $request = $this->updateProductRequest($id, $update_product_request_body); + $returnType = '\Pipedrive\versions\v1\Model\UserIDs'; + $request = $this->getProductUsersRequest($id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -3865,26 +1929,24 @@ function ($exception) { } /** - * Create request for operation 'updateProduct' + * Create request for operation 'getProductUsers' * * @param int $id The ID of the product (required) - * @param \Pipedrive\versions\v1\Model\UpdateProductRequestBody|null $update_product_request_body (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request - * @deprecated */ - public function updateProductRequest($id, $update_product_request_body = null): Request + public function getProductUsersRequest($id): Request { // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling updateProduct' + 'Missing the required parameter $id when calling getProductUsers' ); } - $resourcePath = '/products/{id}'; + $resourcePath = '/products/{id}/permittedUsers'; $formParams = []; $queryParams = []; $headerParams = []; @@ -3911,18 +1973,12 @@ public function updateProductRequest($id, $update_product_request_body = null): } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - ['application/json'] + [] ); } // for model (json/xml) - if (isset($update_product_request_body)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_product_request_body)); - } else { - $httpBody = $update_product_request_body; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { /* @phpstan-ignore-next-line */ if ($multipart) { $multipartContents = []; @@ -3974,7 +2030,7 @@ public function updateProductRequest($id, $update_product_request_body = null): $query = Query::build($queryParams); return new Request( - 'PUT', + 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody diff --git a/lib/versions/v1/Api/StagesApi.php b/lib/versions/v1/Api/StagesApi.php index 38e15027..2ea08a3f 100644 --- a/lib/versions/v1/Api/StagesApi.php +++ b/lib/versions/v1/Api/StagesApi.php @@ -123,1620 +123,48 @@ public function getConfig(): Configuration } /** - * Operation addStage - * - * Add a new stage - * - * @param \Pipedrive\versions\v1\Model\Stage|null $stage stage (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\GetAddUpdateStage - * @deprecated - */ - public function addStage($stage = null) - { - list($response) = $this->addStageWithHttpInfo($stage); - return $response; - } - - /** - * Operation addStageWithHttpInfo - * - * Add a new stage - * - * @param \Pipedrive\versions\v1\Model\Stage|null $stage (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\GetAddUpdateStage, HTTP status code, HTTP response headers (array of strings) - * @deprecated - */ - public function addStageWithHttpInfo($stage = null) - { - $request = $this->addStageRequest($stage); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->addStageRequest($stage); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetAddUpdateStage' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetAddUpdateStage', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetAddUpdateStage' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetAddUpdateStage', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\GetAddUpdateStage', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation addStageAsync - * - * Add a new stage - * - * @param \Pipedrive\versions\v1\Model\Stage|null $stage (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function addStageAsync($stage = null): PromiseInterface - { - return $this->addStageAsyncWithHttpInfo($stage) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation addStageAsyncWithHttpInfo - * - * Add a new stage - * - * @param \Pipedrive\versions\v1\Model\Stage|null $stage (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function addStageAsyncWithHttpInfo($stage = null): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\GetAddUpdateStage'; - $request = $this->addStageRequest($stage); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'addStage' - * - * @param \Pipedrive\versions\v1\Model\Stage|null $stage (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - * @deprecated - */ - public function addStageRequest($stage = null): Request - { - - $resourcePath = '/stages'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($stage)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($stage)); - } else { - $httpBody = $stage; - } - } elseif (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation deleteStage - * - * Delete a stage - * - * @param int $id The ID of the stage (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\DeleteStageResponse - * @deprecated - */ - public function deleteStage($id) - { - list($response) = $this->deleteStageWithHttpInfo($id); - return $response; - } - - /** - * Operation deleteStageWithHttpInfo - * - * Delete a stage - * - * @param int $id The ID of the stage (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\DeleteStageResponse, HTTP status code, HTTP response headers (array of strings) - * @deprecated - */ - public function deleteStageWithHttpInfo($id) - { - $request = $this->deleteStageRequest($id); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->deleteStageRequest($id); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\DeleteStageResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DeleteStageResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\DeleteStageResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\DeleteStageResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\DeleteStageResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation deleteStageAsync - * - * Delete a stage - * - * @param int $id The ID of the stage (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function deleteStageAsync($id): PromiseInterface - { - return $this->deleteStageAsyncWithHttpInfo($id) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation deleteStageAsyncWithHttpInfo - * - * Delete a stage - * - * @param int $id The ID of the stage (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function deleteStageAsyncWithHttpInfo($id): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\DeleteStageResponse'; - $request = $this->deleteStageRequest($id); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'deleteStage' - * - * @param int $id The ID of the stage (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - * @deprecated - */ - public function deleteStageRequest($id): Request - { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling deleteStage' - ); - } - - $resourcePath = '/stages/{id}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getStage - * - * Get one stage - * - * @param int $id The ID of the stage (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\GetOneStage - * @deprecated - */ - public function getStage($id) - { - list($response) = $this->getStageWithHttpInfo($id); - return $response; - } - - /** - * Operation getStageWithHttpInfo - * - * Get one stage - * - * @param int $id The ID of the stage (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\GetOneStage, HTTP status code, HTTP response headers (array of strings) - * @deprecated - */ - public function getStageWithHttpInfo($id) - { - $request = $this->getStageRequest($id); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->getStageRequest($id); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetOneStage' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetOneStage', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetOneStage' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetOneStage', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\GetOneStage', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getStageAsync - * - * Get one stage - * - * @param int $id The ID of the stage (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function getStageAsync($id): PromiseInterface - { - return $this->getStageAsyncWithHttpInfo($id) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getStageAsyncWithHttpInfo - * - * Get one stage - * - * @param int $id The ID of the stage (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function getStageAsyncWithHttpInfo($id): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\GetOneStage'; - $request = $this->getStageRequest($id); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getStage' - * - * @param int $id The ID of the stage (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - * @deprecated - */ - public function getStageRequest($id): Request - { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getStage' - ); - } - - $resourcePath = '/stages/{id}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getStageDeals - * - * Get deals in a stage - * - * @param int $id The ID of the stage (required) - * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) - * @param int|null $user_id If supplied, `filter_id` will not be considered and only deals owned by the given user will be returned. If omitted, deals owned by the authorized user will be returned. (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $everyone If supplied, `filter_id` and `user_id` will not be considered – instead, deals owned by everyone will be returned (optional) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\GetStageDeals - * @deprecated - */ - public function getStageDeals($id, $filter_id = null, $user_id = null, $everyone = null, $start = 0, $limit = null) - { - list($response) = $this->getStageDealsWithHttpInfo($id, $filter_id, $user_id, $everyone, $start, $limit); - return $response; - } - - /** - * Operation getStageDealsWithHttpInfo - * - * Get deals in a stage - * - * @param int $id The ID of the stage (required) - * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) - * @param int|null $user_id If supplied, `filter_id` will not be considered and only deals owned by the given user will be returned. If omitted, deals owned by the authorized user will be returned. (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $everyone If supplied, `filter_id` and `user_id` will not be considered – instead, deals owned by everyone will be returned (optional) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\GetStageDeals, HTTP status code, HTTP response headers (array of strings) - * @deprecated - */ - public function getStageDealsWithHttpInfo($id, $filter_id = null, $user_id = null, $everyone = null, $start = 0, $limit = null) - { - $request = $this->getStageDealsRequest($id, $filter_id, $user_id, $everyone, $start, $limit); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->getStageDealsRequest($id, $filter_id, $user_id, $everyone, $start, $limit); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetStageDeals' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetStageDeals', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetStageDeals' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetStageDeals', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\GetStageDeals', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getStageDealsAsync - * - * Get deals in a stage - * - * @param int $id The ID of the stage (required) - * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) - * @param int|null $user_id If supplied, `filter_id` will not be considered and only deals owned by the given user will be returned. If omitted, deals owned by the authorized user will be returned. (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $everyone If supplied, `filter_id` and `user_id` will not be considered – instead, deals owned by everyone will be returned (optional) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function getStageDealsAsync($id, $filter_id = null, $user_id = null, $everyone = null, $start = 0, $limit = null): PromiseInterface - { - return $this->getStageDealsAsyncWithHttpInfo($id, $filter_id, $user_id, $everyone, $start, $limit) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getStageDealsAsyncWithHttpInfo - * - * Get deals in a stage - * - * @param int $id The ID of the stage (required) - * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) - * @param int|null $user_id If supplied, `filter_id` will not be considered and only deals owned by the given user will be returned. If omitted, deals owned by the authorized user will be returned. (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $everyone If supplied, `filter_id` and `user_id` will not be considered – instead, deals owned by everyone will be returned (optional) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function getStageDealsAsyncWithHttpInfo($id, $filter_id = null, $user_id = null, $everyone = null, $start = 0, $limit = null): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\GetStageDeals'; - $request = $this->getStageDealsRequest($id, $filter_id, $user_id, $everyone, $start, $limit); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getStageDeals' - * - * @param int $id The ID of the stage (required) - * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) - * @param int|null $user_id If supplied, `filter_id` will not be considered and only deals owned by the given user will be returned. If omitted, deals owned by the authorized user will be returned. (optional) - * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $everyone If supplied, `filter_id` and `user_id` will not be considered – instead, deals owned by everyone will be returned (optional) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - * @deprecated - */ - public function getStageDealsRequest($id, $filter_id = null, $user_id = null, $everyone = null, $start = 0, $limit = null): Request - { - // verify the required parameter 'id' is set - /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getStageDeals' - ); - } - - $resourcePath = '/stages/{id}/deals'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - /* @phpstan-ignore-next-line */ - if (is_array($filter_id)) { - $filter_id = ObjectSerializer::serializeCollection($filter_id, '', true); - } - if ($filter_id !== null) { - $queryParams['filter_id'] = $filter_id; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($user_id)) { - $user_id = ObjectSerializer::serializeCollection($user_id, '', true); - } - if ($user_id !== null) { - $queryParams['user_id'] = $user_id; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($everyone)) { - $everyone = ObjectSerializer::serializeCollection($everyone, '', true); - } - if ($everyone !== null) { - $queryParams['everyone'] = $everyone; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($start)) { - $start = ObjectSerializer::serializeCollection($start, '', true); - } - if ($start !== null) { - $queryParams['start'] = $start; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($limit)) { - $limit = ObjectSerializer::serializeCollection($limit, '', true); - } - if ($limit !== null) { - $queryParams['limit'] = $limit; - } - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getStages - * - * Get all stages - * - * @param int|null $pipeline_id The ID of the pipeline to fetch stages for. If omitted, stages for all pipelines will be fetched. (optional) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\GetStages - * @deprecated - */ - public function getStages($pipeline_id = null, $start = 0, $limit = null) - { - list($response) = $this->getStagesWithHttpInfo($pipeline_id, $start, $limit); - return $response; - } - - /** - * Operation getStagesWithHttpInfo - * - * Get all stages - * - * @param int|null $pipeline_id The ID of the pipeline to fetch stages for. If omitted, stages for all pipelines will be fetched. (optional) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\GetStages, HTTP status code, HTTP response headers (array of strings) - * @deprecated - */ - public function getStagesWithHttpInfo($pipeline_id = null, $start = 0, $limit = null) - { - $request = $this->getStagesRequest($pipeline_id, $start, $limit); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { - $this->config->refreshToken(); - $request = $this->getStagesRequest($pipeline_id, $start, $limit); - $response = $this->client->send($request, $options); - } else { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetStages' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetStages', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetStages' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetStages', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\GetStages', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getStagesAsync - * - * Get all stages - * - * @param int|null $pipeline_id The ID of the pipeline to fetch stages for. If omitted, stages for all pipelines will be fetched. (optional) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function getStagesAsync($pipeline_id = null, $start = 0, $limit = null): PromiseInterface - { - return $this->getStagesAsyncWithHttpInfo($pipeline_id, $start, $limit) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getStagesAsyncWithHttpInfo - * - * Get all stages - * - * @param int|null $pipeline_id The ID of the pipeline to fetch stages for. If omitted, stages for all pipelines will be fetched. (optional) - * @param int|0 $start Pagination start (optional, default to 0) - * @param int|null $limit Items shown per page (optional) + * Operation getStageDeals * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - * @deprecated - */ - public function getStagesAsyncWithHttpInfo($pipeline_id = null, $start = 0, $limit = null): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\GetStages'; - $request = $this->getStagesRequest($pipeline_id, $start, $limit); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - /* @phpstan-ignore-next-line */ - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getStages' + * Get deals in a stage * - * @param int|null $pipeline_id The ID of the pipeline to fetch stages for. If omitted, stages for all pipelines will be fetched. (optional) + * @param int $id The ID of the stage (required) + * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) + * @param int|null $user_id If supplied, `filter_id` will not be considered and only deals owned by the given user will be returned. If omitted, deals owned by the authorized user will be returned. (optional) + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $everyone If supplied, `filter_id` and `user_id` will not be considered – instead, deals owned by everyone will be returned (optional) * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - * @deprecated - */ - public function getStagesRequest($pipeline_id = null, $start = 0, $limit = null): Request - { - - $resourcePath = '/stages'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - /* @phpstan-ignore-next-line */ - if (is_array($pipeline_id)) { - $pipeline_id = ObjectSerializer::serializeCollection($pipeline_id, '', true); - } - if ($pipeline_id !== null) { - $queryParams['pipeline_id'] = $pipeline_id; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($start)) { - $start = ObjectSerializer::serializeCollection($start, '', true); - } - if ($start !== null) { - $queryParams['start'] = $start; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($limit)) { - $limit = ObjectSerializer::serializeCollection($limit, '', true); - } - if ($limit !== null) { - $queryParams['limit'] = $limit; - } - - - - - /* @phpstan-ignore-next-line */ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (count($formParams) > 0) { - /* @phpstan-ignore-next-line */ - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); - - } else { - // for HTTP post (form) - $httpBody = Query::build($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('x-api-token'); - if ($apiKey !== null) { - $headers['x-api-token'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - // If access token is expired - if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { - $this->config->refreshToken(); - } - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = Query::build($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation updateStage - * - * Update stage details - * - * @param int $id The ID of the stage (required) - * @param \Pipedrive\versions\v1\Model\UpdateStageRequest|null $update_stage_request update_stage_request (optional) - * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\GetAddUpdateStage + * @return \Pipedrive\versions\v1\Model\GetStageDeals * @deprecated */ - public function updateStage($id, $update_stage_request = null) + public function getStageDeals($id, $filter_id = null, $user_id = null, $everyone = null, $start = 0, $limit = null) { - list($response) = $this->updateStageWithHttpInfo($id, $update_stage_request); + list($response) = $this->getStageDealsWithHttpInfo($id, $filter_id, $user_id, $everyone, $start, $limit); return $response; } /** - * Operation updateStageWithHttpInfo + * Operation getStageDealsWithHttpInfo * - * Update stage details + * Get deals in a stage * * @param int $id The ID of the stage (required) - * @param \Pipedrive\versions\v1\Model\UpdateStageRequest|null $update_stage_request (optional) + * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) + * @param int|null $user_id If supplied, `filter_id` will not be considered and only deals owned by the given user will be returned. If omitted, deals owned by the authorized user will be returned. (optional) + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $everyone If supplied, `filter_id` and `user_id` will not be considered – instead, deals owned by everyone will be returned (optional) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\GetAddUpdateStage, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v1\Model\GetStageDeals, HTTP status code, HTTP response headers (array of strings) * @deprecated */ - public function updateStageWithHttpInfo($id, $update_stage_request = null) + public function getStageDealsWithHttpInfo($id, $filter_id = null, $user_id = null, $everyone = null, $start = 0, $limit = null) { - $request = $this->updateStageRequest($id, $update_stage_request); + $request = $this->getStageDealsRequest($id, $filter_id, $user_id, $everyone, $start, $limit); try { $options = $this->createHttpClientOption(); @@ -1745,7 +173,7 @@ public function updateStageWithHttpInfo($id, $update_stage_request = null) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->updateStageRequest($id, $update_stage_request); + $request = $this->getStageDealsRequest($id, $filter_id, $user_id, $everyone, $start, $limit); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -1770,14 +198,14 @@ public function updateStageWithHttpInfo($id, $update_stage_request = null) switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetAddUpdateStage' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\GetStageDeals' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetAddUpdateStage', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetStageDeals', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -1797,14 +225,14 @@ public function updateStageWithHttpInfo($id, $update_stage_request = null) } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v1\Model\GetAddUpdateStage' === '\SplFileObject') { + if ('\Pipedrive\versions\v1\Model\GetStageDeals' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetAddUpdateStage', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetStageDeals', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -1814,7 +242,7 @@ public function updateStageWithHttpInfo($id, $update_stage_request = null) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\GetAddUpdateStage', + '\Pipedrive\versions\v1\Model\GetStageDeals', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1825,20 +253,24 @@ public function updateStageWithHttpInfo($id, $update_stage_request = null) } /** - * Operation updateStageAsync + * Operation getStageDealsAsync * - * Update stage details + * Get deals in a stage * * @param int $id The ID of the stage (required) - * @param \Pipedrive\versions\v1\Model\UpdateStageRequest|null $update_stage_request (optional) + * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) + * @param int|null $user_id If supplied, `filter_id` will not be considered and only deals owned by the given user will be returned. If omitted, deals owned by the authorized user will be returned. (optional) + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $everyone If supplied, `filter_id` and `user_id` will not be considered – instead, deals owned by everyone will be returned (optional) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface * @deprecated */ - public function updateStageAsync($id, $update_stage_request = null): PromiseInterface + public function getStageDealsAsync($id, $filter_id = null, $user_id = null, $everyone = null, $start = 0, $limit = null): PromiseInterface { - return $this->updateStageAsyncWithHttpInfo($id, $update_stage_request) + return $this->getStageDealsAsyncWithHttpInfo($id, $filter_id, $user_id, $everyone, $start, $limit) ->then( function ($response) { return $response[0]; @@ -1847,21 +279,25 @@ function ($response) { } /** - * Operation updateStageAsyncWithHttpInfo + * Operation getStageDealsAsyncWithHttpInfo * - * Update stage details + * Get deals in a stage * * @param int $id The ID of the stage (required) - * @param \Pipedrive\versions\v1\Model\UpdateStageRequest|null $update_stage_request (optional) + * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) + * @param int|null $user_id If supplied, `filter_id` will not be considered and only deals owned by the given user will be returned. If omitted, deals owned by the authorized user will be returned. (optional) + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $everyone If supplied, `filter_id` and `user_id` will not be considered – instead, deals owned by everyone will be returned (optional) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface * @deprecated */ - public function updateStageAsyncWithHttpInfo($id, $update_stage_request = null): PromiseInterface + public function getStageDealsAsyncWithHttpInfo($id, $filter_id = null, $user_id = null, $everyone = null, $start = 0, $limit = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v1\Model\GetAddUpdateStage'; - $request = $this->updateStageRequest($id, $update_stage_request); + $returnType = '\Pipedrive\versions\v1\Model\GetStageDeals'; + $request = $this->getStageDealsRequest($id, $filter_id, $user_id, $everyone, $start, $limit); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1898,32 +334,76 @@ function ($exception) { } /** - * Create request for operation 'updateStage' + * Create request for operation 'getStageDeals' * * @param int $id The ID of the stage (required) - * @param \Pipedrive\versions\v1\Model\UpdateStageRequest|null $update_stage_request (optional) + * @param int|null $filter_id If supplied, only deals matching the given filter will be returned (optional) + * @param int|null $user_id If supplied, `filter_id` will not be considered and only deals owned by the given user will be returned. If omitted, deals owned by the authorized user will be returned. (optional) + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $everyone If supplied, `filter_id` and `user_id` will not be considered – instead, deals owned by everyone will be returned (optional) + * @param int|0 $start Pagination start (optional, default to 0) + * @param int|null $limit Items shown per page (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request * @deprecated */ - public function updateStageRequest($id, $update_stage_request = null): Request + public function getStageDealsRequest($id, $filter_id = null, $user_id = null, $everyone = null, $start = 0, $limit = null): Request { // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling updateStage' + 'Missing the required parameter $id when calling getStageDeals' ); } - $resourcePath = '/stages/{id}'; + $resourcePath = '/stages/{id}/deals'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; + // query params + /* @phpstan-ignore-next-line */ + if (is_array($filter_id)) { + $filter_id = ObjectSerializer::serializeCollection($filter_id, '', true); + } + if ($filter_id !== null) { + $queryParams['filter_id'] = $filter_id; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($user_id)) { + $user_id = ObjectSerializer::serializeCollection($user_id, '', true); + } + if ($user_id !== null) { + $queryParams['user_id'] = $user_id; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($everyone)) { + $everyone = ObjectSerializer::serializeCollection($everyone, '', true); + } + if ($everyone !== null) { + $queryParams['everyone'] = $everyone; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($start)) { + $start = ObjectSerializer::serializeCollection($start, '', true); + } + if ($start !== null) { + $queryParams['start'] = $start; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($limit)) { + $limit = ObjectSerializer::serializeCollection($limit, '', true); + } + if ($limit !== null) { + $queryParams['limit'] = $limit; + } // path params @@ -1944,18 +424,12 @@ public function updateStageRequest($id, $update_stage_request = null): Request } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - ['application/json'] + [] ); } // for model (json/xml) - if (isset($update_stage_request)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_stage_request)); - } else { - $httpBody = $update_stage_request; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { /* @phpstan-ignore-next-line */ if ($multipart) { $multipartContents = []; @@ -2007,7 +481,7 @@ public function updateStageRequest($id, $update_stage_request = null): Request $query = Query::build($queryParams); return new Request( - 'PUT', + 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody diff --git a/lib/versions/v1/Model/BasePersonItem.php b/lib/versions/v1/Model/BasePersonItem.php index 3babbfd3..a04deec3 100644 --- a/lib/versions/v1/Model/BasePersonItem.php +++ b/lib/versions/v1/Model/BasePersonItem.php @@ -75,7 +75,7 @@ class BasePersonItem implements ModelInterface, ArrayAccess, JsonSerializable 'add_time' => 'string', 'update_time' => 'string', 'visible_to' => 'string', - 'picture_id' => '\Pipedrive\versions\v1\Model\PictureDataWithID', + 'picture_id' => '\Pipedrive\versions\v1\Model\PictureDataWithID1', 'label' => 'int', 'label_ids' => 'int[]', 'org_name' => 'string', @@ -531,7 +531,7 @@ public function setVisibleTo($visible_to): self /** * Gets picture_id * - * @return \Pipedrive\versions\v1\Model\PictureDataWithID|null + * @return \Pipedrive\versions\v1\Model\PictureDataWithID1|null */ public function getPictureId() { @@ -541,7 +541,7 @@ public function getPictureId() /** * Sets picture_id * - * @param \Pipedrive\versions\v1\Model\PictureDataWithID|null $picture_id picture_id + * @param \Pipedrive\versions\v1\Model\PictureDataWithID1|null $picture_id picture_id * * @return self */ diff --git a/lib/versions/v1/Model/GetProductFieldResponse.php b/lib/versions/v1/Model/GetProductFieldResponse.php index d4598170..e3e0c7f1 100644 --- a/lib/versions/v1/Model/GetProductFieldResponse.php +++ b/lib/versions/v1/Model/GetProductFieldResponse.php @@ -67,7 +67,7 @@ class GetProductFieldResponse implements ModelInterface, ArrayAccess, JsonSerial */ protected static array $openAPITypes = [ 'success' => 'bool', - 'data' => 'ProductField' + 'data' => '\Pipedrive\versions\v1\Model\ProductField' ]; /** diff --git a/lib/versions/v1/Model/LeadResponse.php b/lib/versions/v1/Model/LeadResponse.php index d94ede22..89ed7387 100644 --- a/lib/versions/v1/Model/LeadResponse.php +++ b/lib/versions/v1/Model/LeadResponse.php @@ -78,6 +78,7 @@ class LeadResponse implements ModelInterface, ArrayAccess, JsonSerializable 'origin_id' => 'string', 'channel' => 'int', 'channel_id' => 'string', + 'source_deal_id' => 'int', 'is_archived' => 'bool', 'was_seen' => 'bool', 'value' => '\Pipedrive\versions\v1\Model\LeadValue', @@ -109,6 +110,7 @@ class LeadResponse implements ModelInterface, ArrayAccess, JsonSerializable 'origin_id' => null, 'channel' => null, 'channel_id' => null, + 'source_deal_id' => null, 'is_archived' => null, 'was_seen' => null, 'value' => null, @@ -163,6 +165,7 @@ public static function openAPIFormats(): array 'origin_id' => 'origin_id', 'channel' => 'channel', 'channel_id' => 'channel_id', + 'source_deal_id' => 'source_deal_id', 'is_archived' => 'is_archived', 'was_seen' => 'was_seen', 'value' => 'value', @@ -192,6 +195,7 @@ public static function openAPIFormats(): array 'origin_id' => 'setOriginId', 'channel' => 'setChannel', 'channel_id' => 'setChannelId', + 'source_deal_id' => 'setSourceDealId', 'is_archived' => 'setIsArchived', 'was_seen' => 'setWasSeen', 'value' => 'setValue', @@ -221,6 +225,7 @@ public static function openAPIFormats(): array 'origin_id' => 'getOriginId', 'channel' => 'getChannel', 'channel_id' => 'getChannelId', + 'source_deal_id' => 'getSourceDealId', 'is_archived' => 'getIsArchived', 'was_seen' => 'getWasSeen', 'value' => 'getValue', @@ -311,6 +316,7 @@ public function __construct(array $data = null) $this->container['origin_id'] = $data['origin_id'] ?? null; $this->container['channel'] = $data['channel'] ?? null; $this->container['channel_id'] = $data['channel_id'] ?? null; + $this->container['source_deal_id'] = $data['source_deal_id'] ?? null; $this->container['is_archived'] = $data['is_archived'] ?? null; $this->container['was_seen'] = $data['was_seen'] ?? null; $this->container['value'] = $data['value'] ?? null; @@ -636,6 +642,30 @@ public function setChannelId($channel_id): self return $this; } + /** + * Gets source_deal_id + * + * @return int|null + */ + public function getSourceDealId() + { + return $this->container['source_deal_id']; + } + + /** + * Sets source_deal_id + * + * @param int|null $source_deal_id The ID of the deal if the lead was converted from a deal. + * + * @return self + */ + public function setSourceDealId($source_deal_id): self + { + $this->container['source_deal_id'] = $source_deal_id; + + return $this; + } + /** * Gets is_archived * diff --git a/lib/versions/v1/Model/MergePersonItem.php b/lib/versions/v1/Model/MergePersonItem.php index a8246f39..24254191 100644 --- a/lib/versions/v1/Model/MergePersonItem.php +++ b/lib/versions/v1/Model/MergePersonItem.php @@ -75,7 +75,7 @@ class MergePersonItem implements ModelInterface, ArrayAccess, JsonSerializable 'add_time' => 'string', 'update_time' => 'string', 'visible_to' => 'string', - 'picture_id' => '\Pipedrive\versions\v1\Model\PictureDataWithID', + 'picture_id' => '\Pipedrive\versions\v1\Model\PictureDataWithID1', 'label' => 'int', 'label_ids' => 'int[]', 'org_name' => 'string', @@ -711,7 +711,7 @@ public function setVisibleTo($visible_to): self /** * Gets picture_id * - * @return \Pipedrive\versions\v1\Model\PictureDataWithID|null + * @return \Pipedrive\versions\v1\Model\PictureDataWithID1|null */ public function getPictureId() { @@ -721,7 +721,7 @@ public function getPictureId() /** * Sets picture_id * - * @param \Pipedrive\versions\v1\Model\PictureDataWithID|null $picture_id picture_id + * @param \Pipedrive\versions\v1\Model\PictureDataWithID1|null $picture_id picture_id * * @return self */ diff --git a/lib/versions/v1/Model/PersonItem.php b/lib/versions/v1/Model/PersonItem.php index f38bb96d..35f36b9a 100644 --- a/lib/versions/v1/Model/PersonItem.php +++ b/lib/versions/v1/Model/PersonItem.php @@ -75,7 +75,7 @@ class PersonItem implements ModelInterface, ArrayAccess, JsonSerializable 'add_time' => 'string', 'update_time' => 'string', 'visible_to' => 'string', - 'picture_id' => '\Pipedrive\versions\v1\Model\PictureDataWithID', + 'picture_id' => '\Pipedrive\versions\v1\Model\PictureDataWithID1', 'label' => 'int', 'label_ids' => 'int[]', 'org_name' => 'string', @@ -693,7 +693,7 @@ public function setVisibleTo($visible_to): self /** * Gets picture_id * - * @return \Pipedrive\versions\v1\Model\PictureDataWithID|null + * @return \Pipedrive\versions\v1\Model\PictureDataWithID1|null */ public function getPictureId() { @@ -703,7 +703,7 @@ public function getPictureId() /** * Sets picture_id * - * @param \Pipedrive\versions\v1\Model\PictureDataWithID|null $picture_id picture_id + * @param \Pipedrive\versions\v1\Model\PictureDataWithID1|null $picture_id picture_id * * @return self */ diff --git a/lib/versions/v1/Model/PictureData.php b/lib/versions/v1/Model/PictureData.php index a720e5a8..e33cb89a 100644 --- a/lib/versions/v1/Model/PictureData.php +++ b/lib/versions/v1/Model/PictureData.php @@ -72,7 +72,7 @@ class PictureData implements ModelInterface, ArrayAccess, JsonSerializable 'add_time' => 'string', 'update_time' => 'string', 'added_by_user_id' => 'int', - 'pictures' => '\Pipedrive\versions\v1\Model\PictureDataPictures' + 'pictures' => '\Pipedrive\versions\v1\Model\PictureDataWithID1Pictures' ]; /** @@ -411,7 +411,7 @@ public function setAddedByUserId($added_by_user_id): self /** * Gets pictures * - * @return \Pipedrive\versions\v1\Model\PictureDataPictures|null + * @return \Pipedrive\versions\v1\Model\PictureDataWithID1Pictures|null */ public function getPictures() { @@ -421,7 +421,7 @@ public function getPictures() /** * Sets pictures * - * @param \Pipedrive\versions\v1\Model\PictureDataPictures|null $pictures pictures + * @param \Pipedrive\versions\v1\Model\PictureDataWithID1Pictures|null $pictures pictures * * @return self */ diff --git a/lib/versions/v1/Model/PictureDataWithID.php b/lib/versions/v1/Model/PictureDataWithID.php index 01ad6c21..8bda694d 100644 --- a/lib/versions/v1/Model/PictureDataWithID.php +++ b/lib/versions/v1/Model/PictureDataWithID.php @@ -73,7 +73,7 @@ class PictureDataWithID implements ModelInterface, ArrayAccess, JsonSerializable 'add_time' => 'string', 'update_time' => 'string', 'added_by_user_id' => 'int', - 'pictures' => '\Pipedrive\versions\v1\Model\PictureDataPictures' + 'pictures' => '\Pipedrive\versions\v1\Model\PictureDataWithID1Pictures' ]; /** @@ -441,7 +441,7 @@ public function setAddedByUserId($added_by_user_id): self /** * Gets pictures * - * @return \Pipedrive\versions\v1\Model\PictureDataPictures|null + * @return \Pipedrive\versions\v1\Model\PictureDataWithID1Pictures|null */ public function getPictures() { @@ -451,7 +451,7 @@ public function getPictures() /** * Sets pictures * - * @param \Pipedrive\versions\v1\Model\PictureDataPictures|null $pictures pictures + * @param \Pipedrive\versions\v1\Model\PictureDataWithID1Pictures|null $pictures pictures * * @return self */ diff --git a/lib/versions/v1/Model/PictureDataWithID1.php b/lib/versions/v1/Model/PictureDataWithID1.php index d5080967..7f3226ee 100644 --- a/lib/versions/v1/Model/PictureDataWithID1.php +++ b/lib/versions/v1/Model/PictureDataWithID1.php @@ -66,7 +66,14 @@ class PictureDataWithID1 implements ModelInterface, ArrayAccess, JsonSerializabl * @phpsalm-var array */ protected static array $openAPITypes = [ - 'id' => 'int' + 'id' => 'int', + 'item_type' => 'string', + 'item_id' => 'int', + 'active_flag' => 'bool', + 'add_time' => 'string', + 'update_time' => 'string', + 'added_by_user_id' => 'int', + 'pictures' => '\Pipedrive\versions\v1\Model\PictureDataWithID1Pictures' ]; /** @@ -77,7 +84,14 @@ class PictureDataWithID1 implements ModelInterface, ArrayAccess, JsonSerializabl * @psalm-var array */ protected static $openAPIFormats = [ - 'id' => null + 'id' => null, + 'item_type' => null, + 'item_id' => null, + 'active_flag' => null, + 'add_time' => null, + 'update_time' => null, + 'added_by_user_id' => null, + 'pictures' => null ]; /** @@ -111,7 +125,14 @@ public static function openAPIFormats(): array * @var string[] */ protected static $attributeMap = [ - 'id' => 'id' + 'id' => 'id', + 'item_type' => 'item_type', + 'item_id' => 'item_id', + 'active_flag' => 'active_flag', + 'add_time' => 'add_time', + 'update_time' => 'update_time', + 'added_by_user_id' => 'added_by_user_id', + 'pictures' => 'pictures' ]; /** @@ -120,7 +141,14 @@ public static function openAPIFormats(): array * @var string[] */ protected static $setters = [ - 'id' => 'setId' + 'id' => 'setId', + 'item_type' => 'setItemType', + 'item_id' => 'setItemId', + 'active_flag' => 'setActiveFlag', + 'add_time' => 'setAddTime', + 'update_time' => 'setUpdateTime', + 'added_by_user_id' => 'setAddedByUserId', + 'pictures' => 'setPictures' ]; /** @@ -129,7 +157,14 @@ public static function openAPIFormats(): array * @var string[] */ protected static $getters = [ - 'id' => 'getId' + 'id' => 'getId', + 'item_type' => 'getItemType', + 'item_id' => 'getItemId', + 'active_flag' => 'getActiveFlag', + 'add_time' => 'getAddTime', + 'update_time' => 'getUpdateTime', + 'added_by_user_id' => 'getAddedByUserId', + 'pictures' => 'getPictures' ]; /** @@ -200,6 +235,13 @@ public function getModelName(): string public function __construct(array $data = null) { $this->container['id'] = $data['id'] ?? null; + $this->container['item_type'] = $data['item_type'] ?? null; + $this->container['item_id'] = $data['item_id'] ?? null; + $this->container['active_flag'] = $data['active_flag'] ?? null; + $this->container['add_time'] = $data['add_time'] ?? null; + $this->container['update_time'] = $data['update_time'] ?? null; + $this->container['added_by_user_id'] = $data['added_by_user_id'] ?? null; + $this->container['pictures'] = $data['pictures'] ?? null; } /** @@ -251,6 +293,174 @@ public function setId($id): self return $this; } + + /** + * Gets item_type + * + * @return string|null + */ + public function getItemType() + { + return $this->container['item_type']; + } + + /** + * Sets item_type + * + * @param string|null $item_type The type of item the picture is related to + * + * @return self + */ + public function setItemType($item_type): self + { + $this->container['item_type'] = $item_type; + + return $this; + } + + /** + * Gets item_id + * + * @return int|null + */ + public function getItemId() + { + return $this->container['item_id']; + } + + /** + * Sets item_id + * + * @param int|null $item_id The ID of related item + * + * @return self + */ + public function setItemId($item_id): self + { + $this->container['item_id'] = $item_id; + + return $this; + } + + /** + * Gets active_flag + * + * @return bool|null + */ + public function getActiveFlag() + { + return $this->container['active_flag']; + } + + /** + * Sets active_flag + * + * @param bool|null $active_flag Whether the associated picture is active or not + * + * @return self + */ + public function setActiveFlag($active_flag): self + { + $this->container['active_flag'] = $active_flag; + + return $this; + } + + /** + * Gets add_time + * + * @return string|null + */ + public function getAddTime() + { + return $this->container['add_time']; + } + + /** + * Sets add_time + * + * @param string|null $add_time The add time of the picture + * + * @return self + */ + public function setAddTime($add_time): self + { + $this->container['add_time'] = $add_time; + + return $this; + } + + /** + * Gets update_time + * + * @return string|null + */ + public function getUpdateTime() + { + return $this->container['update_time']; + } + + /** + * Sets update_time + * + * @param string|null $update_time The update time of the picture + * + * @return self + */ + public function setUpdateTime($update_time): self + { + $this->container['update_time'] = $update_time; + + return $this; + } + + /** + * Gets added_by_user_id + * + * @return int|null + */ + public function getAddedByUserId() + { + return $this->container['added_by_user_id']; + } + + /** + * Sets added_by_user_id + * + * @param int|null $added_by_user_id The ID of the user who added the picture + * + * @return self + */ + public function setAddedByUserId($added_by_user_id): self + { + $this->container['added_by_user_id'] = $added_by_user_id; + + return $this; + } + + /** + * Gets pictures + * + * @return \Pipedrive\versions\v1\Model\PictureDataWithID1Pictures|null + */ + public function getPictures() + { + return $this->container['pictures']; + } + + /** + * Sets pictures + * + * @param \Pipedrive\versions\v1\Model\PictureDataWithID1Pictures|null $pictures pictures + * + * @return self + */ + public function setPictures($pictures): self + { + $this->container['pictures'] = $pictures; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/lib/versions/v1/Model/PictureDataWithID1Pictures.php b/lib/versions/v1/Model/PictureDataWithID1Pictures.php new file mode 100644 index 00000000..0bcf3cef --- /dev/null +++ b/lib/versions/v1/Model/PictureDataWithID1Pictures.php @@ -0,0 +1,375 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class PictureDataWithID1Pictures implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'PictureDataWithID_1_pictures'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + '_128' => 'string', + '_512' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + '_128' => null, + '_512' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @phpstan-return array + * @psalm-return array + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @phpstan-return array + * @psalm-return array + * @return array + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + '_128' => '128', + '_512' => '512' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + '_128' => 'set128', + '_512' => 'set512' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + '_128' => 'get128', + '_512' => 'get512' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @phpstan-return array + * @psalm-return array + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @phpstan-return array + * @psalm-return array + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @phpstan-return array + * @psalm-return array + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + * @phpstan-var array + * @psalm-var array + */ + protected array $container = []; + + /** + * Constructor + * + * @phpstan-param array|null $data + * @psalm-param array|null $data + * @param array|null $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['_128'] = $data['_128'] ?? null; + $this->container['_512'] = $data['_512'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + * @phpstan-return array + * @psalm-return array + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets _128 + * + * @return string|null + */ + public function get128() + { + return $this->container['_128']; + } + + /** + * Sets _128 + * + * @param string|null $_128 The URL of the 128*128 picture + * + * @return self + */ + public function set128($_128): self + { + $this->container['_128'] = $_128; + + return $this; + } + + /** + * Gets _512 + * + * @return string|null + */ + public function get512() + { + return $this->container['_512']; + } + + /** + * Sets _512 + * + * @param string|null $_512 The URL of the 512*512 picture + * + * @return self + */ + public function set512($_512): self + { + $this->container['_512'] = $_512; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @throws JsonException + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @throws JsonException + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this), JSON_THROW_ON_ERROR); + } +} + + diff --git a/lib/versions/v1/Model/PictureDataWithID2.php b/lib/versions/v1/Model/PictureDataWithID2.php new file mode 100644 index 00000000..f1d24dac --- /dev/null +++ b/lib/versions/v1/Model/PictureDataWithID2.php @@ -0,0 +1,345 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class PictureDataWithID2 implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'PictureDataWithID_2'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'id' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @phpstan-return array + * @psalm-return array + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @phpstan-return array + * @psalm-return array + * @return array + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @phpstan-return array + * @psalm-return array + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @phpstan-return array + * @psalm-return array + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @phpstan-return array + * @psalm-return array + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + * @phpstan-var array + * @psalm-var array + */ + protected array $container = []; + + /** + * Constructor + * + * @phpstan-param array|null $data + * @psalm-param array|null $data + * @param array|null $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['id'] = $data['id'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + * @phpstan-return array + * @psalm-return array + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return int|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int|null $id The ID of the picture associated with the item + * + * @return self + */ + public function setId($id): self + { + $this->container['id'] = $id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @throws JsonException + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @throws JsonException + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this), JSON_THROW_ON_ERROR); + } +} + + diff --git a/lib/versions/v1/Model/PictureDataWithValue.php b/lib/versions/v1/Model/PictureDataWithValue.php index 74afa1bf..a7de51a1 100644 --- a/lib/versions/v1/Model/PictureDataWithValue.php +++ b/lib/versions/v1/Model/PictureDataWithValue.php @@ -73,7 +73,7 @@ class PictureDataWithValue implements ModelInterface, ArrayAccess, JsonSerializa 'add_time' => 'string', 'update_time' => 'string', 'added_by_user_id' => 'int', - 'pictures' => '\Pipedrive\versions\v1\Model\PictureDataPictures' + 'pictures' => '\Pipedrive\versions\v1\Model\PictureDataWithID1Pictures' ]; /** @@ -441,7 +441,7 @@ public function setAddedByUserId($added_by_user_id): self /** * Gets pictures * - * @return \Pipedrive\versions\v1\Model\PictureDataPictures|null + * @return \Pipedrive\versions\v1\Model\PictureDataWithID1Pictures|null */ public function getPictures() { @@ -451,7 +451,7 @@ public function getPictures() /** * Sets pictures * - * @param \Pipedrive\versions\v1\Model\PictureDataPictures|null $pictures pictures + * @param \Pipedrive\versions\v1\Model\PictureDataWithID1Pictures|null $pictures pictures * * @return self */ diff --git a/lib/versions/v1/Model/ProjectMandatoryObjectFragment.php b/lib/versions/v1/Model/ProjectMandatoryObjectFragment.php index 484fbf2f..1c0c4b60 100644 --- a/lib/versions/v1/Model/ProjectMandatoryObjectFragment.php +++ b/lib/versions/v1/Model/ProjectMandatoryObjectFragment.php @@ -66,9 +66,7 @@ class ProjectMandatoryObjectFragment implements ModelInterface, ArrayAccess, Jso * @phpsalm-var array */ protected static array $openAPITypes = [ - 'title' => 'string', - 'board_id' => 'float', - 'phase_id' => 'float' + 'title' => 'string' ]; /** @@ -79,9 +77,7 @@ class ProjectMandatoryObjectFragment implements ModelInterface, ArrayAccess, Jso * @psalm-var array */ protected static $openAPIFormats = [ - 'title' => null, - 'board_id' => null, - 'phase_id' => null + 'title' => null ]; /** @@ -115,9 +111,7 @@ public static function openAPIFormats(): array * @var string[] */ protected static $attributeMap = [ - 'title' => 'title', - 'board_id' => 'board_id', - 'phase_id' => 'phase_id' + 'title' => 'title' ]; /** @@ -126,9 +120,7 @@ public static function openAPIFormats(): array * @var string[] */ protected static $setters = [ - 'title' => 'setTitle', - 'board_id' => 'setBoardId', - 'phase_id' => 'setPhaseId' + 'title' => 'setTitle' ]; /** @@ -137,9 +129,7 @@ public static function openAPIFormats(): array * @var string[] */ protected static $getters = [ - 'title' => 'getTitle', - 'board_id' => 'getBoardId', - 'phase_id' => 'getPhaseId' + 'title' => 'getTitle' ]; /** @@ -210,8 +200,6 @@ public function getModelName(): string public function __construct(array $data = null) { $this->container['title'] = $data['title'] ?? null; - $this->container['board_id'] = $data['board_id'] ?? null; - $this->container['phase_id'] = $data['phase_id'] ?? null; } /** @@ -263,54 +251,6 @@ public function setTitle($title): self return $this; } - - /** - * Gets board_id - * - * @return float|null - */ - public function getBoardId() - { - return $this->container['board_id']; - } - - /** - * Sets board_id - * - * @param float|null $board_id The ID of the board this project is associated with - * - * @return self - */ - public function setBoardId($board_id): self - { - $this->container['board_id'] = $board_id; - - return $this; - } - - /** - * Gets phase_id - * - * @return float|null - */ - public function getPhaseId() - { - return $this->container['phase_id']; - } - - /** - * Sets phase_id - * - * @param float|null $phase_id The ID of the phase this project is associated with - * - * @return self - */ - public function setPhaseId($phase_id): self - { - $this->container['phase_id'] = $phase_id; - - return $this; - } /** * Returns true if offset exists. False otherwise. * diff --git a/lib/versions/v1/Model/ProjectObjectFragment.php b/lib/versions/v1/Model/ProjectObjectFragment.php index 1ddb0b1f..85af55ae 100644 --- a/lib/versions/v1/Model/ProjectObjectFragment.php +++ b/lib/versions/v1/Model/ProjectObjectFragment.php @@ -66,6 +66,8 @@ class ProjectObjectFragment implements ModelInterface, ArrayAccess, JsonSerializ * @phpsalm-var array */ protected static array $openAPITypes = [ + 'board_id' => 'float', + 'phase_id' => 'float', 'description' => 'string', 'status' => 'string', 'owner_id' => 'float', @@ -85,6 +87,8 @@ class ProjectObjectFragment implements ModelInterface, ArrayAccess, JsonSerializ * @psalm-var array */ protected static $openAPIFormats = [ + 'board_id' => null, + 'phase_id' => null, 'description' => null, 'status' => null, 'owner_id' => null, @@ -127,6 +131,8 @@ public static function openAPIFormats(): array * @var string[] */ protected static $attributeMap = [ + 'board_id' => 'board_id', + 'phase_id' => 'phase_id', 'description' => 'description', 'status' => 'status', 'owner_id' => 'owner_id', @@ -144,6 +150,8 @@ public static function openAPIFormats(): array * @var string[] */ protected static $setters = [ + 'board_id' => 'setBoardId', + 'phase_id' => 'setPhaseId', 'description' => 'setDescription', 'status' => 'setStatus', 'owner_id' => 'setOwnerId', @@ -161,6 +169,8 @@ public static function openAPIFormats(): array * @var string[] */ protected static $getters = [ + 'board_id' => 'getBoardId', + 'phase_id' => 'getPhaseId', 'description' => 'getDescription', 'status' => 'getStatus', 'owner_id' => 'getOwnerId', @@ -239,6 +249,8 @@ public function getModelName(): string */ public function __construct(array $data = null) { + $this->container['board_id'] = $data['board_id'] ?? null; + $this->container['phase_id'] = $data['phase_id'] ?? null; $this->container['description'] = $data['description'] ?? null; $this->container['status'] = $data['status'] ?? null; $this->container['owner_id'] = $data['owner_id'] ?? null; @@ -276,6 +288,54 @@ public function valid(): bool } + /** + * Gets board_id + * + * @return float|null + */ + public function getBoardId() + { + return $this->container['board_id']; + } + + /** + * Sets board_id + * + * @param float|null $board_id The ID of the board this project is associated with + * + * @return self + */ + public function setBoardId($board_id): self + { + $this->container['board_id'] = $board_id; + + return $this; + } + + /** + * Gets phase_id + * + * @return float|null + */ + public function getPhaseId() + { + return $this->container['phase_id']; + } + + /** + * Sets phase_id + * + * @param float|null $phase_id The ID of the phase this project is associated with + * + * @return self + */ + public function setPhaseId($phase_id): self + { + $this->container['phase_id'] = $phase_id; + + return $this; + } + /** * Gets description * diff --git a/lib/versions/v1/Model/ProjectPostObject.php b/lib/versions/v1/Model/ProjectPostObject.php index 52ac339a..44daf36e 100644 --- a/lib/versions/v1/Model/ProjectPostObject.php +++ b/lib/versions/v1/Model/ProjectPostObject.php @@ -288,12 +288,6 @@ public function listInvalidProperties(): array if ($this->container['title'] === null) { $invalidProperties[] = "'title' can't be null"; } - if ($this->container['board_id'] === null) { - $invalidProperties[] = "'board_id' can't be null"; - } - if ($this->container['phase_id'] === null) { - $invalidProperties[] = "'phase_id' can't be null"; - } return $invalidProperties; } @@ -336,7 +330,7 @@ public function setTitle($title): self /** * Gets board_id * - * @return float + * @return float|null */ public function getBoardId() { @@ -346,7 +340,7 @@ public function getBoardId() /** * Sets board_id * - * @param float $board_id The ID of a project board + * @param float|null $board_id The ID of the board this project is associated with * * @return self */ @@ -360,7 +354,7 @@ public function setBoardId($board_id): self /** * Gets phase_id * - * @return float + * @return float|null */ public function getPhaseId() { @@ -370,7 +364,7 @@ public function getPhaseId() /** * Sets phase_id * - * @param float $phase_id The ID of a phase on a project board + * @param float|null $phase_id The ID of the phase this project is associated with * * @return self */ diff --git a/lib/versions/v1/Model/RelationshipOrganizationInfoItemWithActiveFlag.php b/lib/versions/v1/Model/RelationshipOrganizationInfoItemWithActiveFlag.php index 1fd63d1e..cd117c1b 100644 --- a/lib/versions/v1/Model/RelationshipOrganizationInfoItemWithActiveFlag.php +++ b/lib/versions/v1/Model/RelationshipOrganizationInfoItemWithActiveFlag.php @@ -71,6 +71,7 @@ class RelationshipOrganizationInfoItemWithActiveFlag implements ModelInterface, 'owner_id' => 'int', 'address' => 'string', 'cc_email' => 'string', + 'label_ids' => 'int[]', 'value' => 'int', 'active_flag' => 'bool' ]; @@ -88,6 +89,7 @@ class RelationshipOrganizationInfoItemWithActiveFlag implements ModelInterface, 'owner_id' => null, 'address' => null, 'cc_email' => null, + 'label_ids' => null, 'value' => null, 'active_flag' => null ]; @@ -128,6 +130,7 @@ public static function openAPIFormats(): array 'owner_id' => 'owner_id', 'address' => 'address', 'cc_email' => 'cc_email', + 'label_ids' => 'label_ids', 'value' => 'value', 'active_flag' => 'active_flag' ]; @@ -143,6 +146,7 @@ public static function openAPIFormats(): array 'owner_id' => 'setOwnerId', 'address' => 'setAddress', 'cc_email' => 'setCcEmail', + 'label_ids' => 'setLabelIds', 'value' => 'setValue', 'active_flag' => 'setActiveFlag' ]; @@ -158,6 +162,7 @@ public static function openAPIFormats(): array 'owner_id' => 'getOwnerId', 'address' => 'getAddress', 'cc_email' => 'getCcEmail', + 'label_ids' => 'getLabelIds', 'value' => 'getValue', 'active_flag' => 'getActiveFlag' ]; @@ -234,6 +239,7 @@ public function __construct(array $data = null) $this->container['owner_id'] = $data['owner_id'] ?? null; $this->container['address'] = $data['address'] ?? null; $this->container['cc_email'] = $data['cc_email'] ?? null; + $this->container['label_ids'] = $data['label_ids'] ?? null; $this->container['value'] = $data['value'] ?? null; $this->container['active_flag'] = $data['active_flag'] ?? null; } @@ -384,6 +390,30 @@ public function setCcEmail($cc_email): self return $this; } + /** + * Gets label_ids + * + * @return int[]|null + */ + public function getLabelIds() + { + return $this->container['label_ids']; + } + + /** + * Sets label_ids + * + * @param int[]|null $label_ids The IDs of labels assigned to the organization + * + * @return self + */ + public function setLabelIds($label_ids): self + { + $this->container['label_ids'] = $label_ids; + + return $this; + } + /** * Gets value * diff --git a/lib/versions/v1/Model/RequiredPostProjectParameters.php b/lib/versions/v1/Model/RequiredPostProjectParameters.php index ab229d29..b0ff4b04 100644 --- a/lib/versions/v1/Model/RequiredPostProjectParameters.php +++ b/lib/versions/v1/Model/RequiredPostProjectParameters.php @@ -66,9 +66,7 @@ class RequiredPostProjectParameters implements ModelInterface, ArrayAccess, Json * @phpsalm-var array */ protected static array $openAPITypes = [ - 'title' => 'string', - 'board_id' => 'float', - 'phase_id' => 'float' + 'title' => 'string' ]; /** @@ -79,9 +77,7 @@ class RequiredPostProjectParameters implements ModelInterface, ArrayAccess, Json * @psalm-var array */ protected static $openAPIFormats = [ - 'title' => null, - 'board_id' => null, - 'phase_id' => null + 'title' => null ]; /** @@ -115,9 +111,7 @@ public static function openAPIFormats(): array * @var string[] */ protected static $attributeMap = [ - 'title' => 'title', - 'board_id' => 'board_id', - 'phase_id' => 'phase_id' + 'title' => 'title' ]; /** @@ -126,9 +120,7 @@ public static function openAPIFormats(): array * @var string[] */ protected static $setters = [ - 'title' => 'setTitle', - 'board_id' => 'setBoardId', - 'phase_id' => 'setPhaseId' + 'title' => 'setTitle' ]; /** @@ -137,9 +129,7 @@ public static function openAPIFormats(): array * @var string[] */ protected static $getters = [ - 'title' => 'getTitle', - 'board_id' => 'getBoardId', - 'phase_id' => 'getPhaseId' + 'title' => 'getTitle' ]; /** @@ -210,8 +200,6 @@ public function getModelName(): string public function __construct(array $data = null) { $this->container['title'] = $data['title'] ?? null; - $this->container['board_id'] = $data['board_id'] ?? null; - $this->container['phase_id'] = $data['phase_id'] ?? null; } /** @@ -228,12 +216,6 @@ public function listInvalidProperties(): array if ($this->container['title'] === null) { $invalidProperties[] = "'title' can't be null"; } - if ($this->container['board_id'] === null) { - $invalidProperties[] = "'board_id' can't be null"; - } - if ($this->container['phase_id'] === null) { - $invalidProperties[] = "'phase_id' can't be null"; - } return $invalidProperties; } @@ -272,54 +254,6 @@ public function setTitle($title): self return $this; } - - /** - * Gets board_id - * - * @return float - */ - public function getBoardId() - { - return $this->container['board_id']; - } - - /** - * Sets board_id - * - * @param float $board_id The ID of a project board - * - * @return self - */ - public function setBoardId($board_id): self - { - $this->container['board_id'] = $board_id; - - return $this; - } - - /** - * Gets phase_id - * - * @return float - */ - public function getPhaseId() - { - return $this->container['phase_id']; - } - - /** - * Sets phase_id - * - * @param float $phase_id The ID of a phase on a project board - * - * @return self - */ - public function setPhaseId($phase_id): self - { - $this->container['phase_id'] = $phase_id; - - return $this; - } /** * Returns true if offset exists. False otherwise. * diff --git a/lib/versions/v2/Model/DealItem.php b/lib/versions/v2/Model/DealItem.php index 8d7e1a43..75c87307 100644 --- a/lib/versions/v2/Model/DealItem.php +++ b/lib/versions/v2/Model/DealItem.php @@ -93,6 +93,7 @@ class DealItem implements ModelInterface, ArrayAccess, JsonSerializable 'origin_id' => 'string', 'channel' => 'int', 'channel_id' => 'string', + 'source_lead_id' => 'string', 'arr' => 'float', 'mrr' => 'float', 'acv' => 'float', @@ -134,6 +135,7 @@ class DealItem implements ModelInterface, ArrayAccess, JsonSerializable 'origin_id' => null, 'channel' => null, 'channel_id' => null, + 'source_lead_id' => 'uuid', 'arr' => null, 'mrr' => null, 'acv' => null, @@ -198,6 +200,7 @@ public static function openAPIFormats(): array 'origin_id' => 'origin_id', 'channel' => 'channel', 'channel_id' => 'channel_id', + 'source_lead_id' => 'source_lead_id', 'arr' => 'arr', 'mrr' => 'mrr', 'acv' => 'acv', @@ -237,6 +240,7 @@ public static function openAPIFormats(): array 'origin_id' => 'setOriginId', 'channel' => 'setChannel', 'channel_id' => 'setChannelId', + 'source_lead_id' => 'setSourceLeadId', 'arr' => 'setArr', 'mrr' => 'setMrr', 'acv' => 'setAcv', @@ -276,6 +280,7 @@ public static function openAPIFormats(): array 'origin_id' => 'getOriginId', 'channel' => 'getChannel', 'channel_id' => 'getChannelId', + 'source_lead_id' => 'getSourceLeadId', 'arr' => 'getArr', 'mrr' => 'getMrr', 'acv' => 'getAcv', @@ -376,6 +381,7 @@ public function __construct(array $data = null) $this->container['origin_id'] = $data['origin_id'] ?? null; $this->container['channel'] = $data['channel'] ?? null; $this->container['channel_id'] = $data['channel_id'] ?? null; + $this->container['source_lead_id'] = $data['source_lead_id'] ?? null; $this->container['arr'] = $data['arr'] ?? null; $this->container['mrr'] = $data['mrr'] ?? null; $this->container['acv'] = $data['acv'] ?? null; @@ -1056,6 +1062,30 @@ public function setChannelId($channel_id): self return $this; } + /** + * Gets source_lead_id + * + * @return string|null + */ + public function getSourceLeadId() + { + return $this->container['source_lead_id']; + } + + /** + * Sets source_lead_id + * + * @param string|null $source_lead_id The ID of the lead if the deal was converted from a lead. Only included when requested via include_fields parameter. + * + * @return self + */ + public function setSourceLeadId($source_lead_id): self + { + $this->container['source_lead_id'] = $source_lead_id; + + return $this; + } + /** * Gets arr *